Репозитории ALT
S: | 9.4.0.24.75e248-alt1 |
5.1: | 7.6-alt1 |
4.1: | 6.11-alt1 |
4.0: | 5.97-alt6 |
3.0: | 5.3.1-alt0.4 |
Другие репозитории
Upstream: | 8.1pl3 |
Группа :: Система/Основа
Пакет: coreutils
Главная Изменения Спек Патчи Исходники Загрузить Gear Bugs and FR Repocop
/*
* Written by Dmitry V. Levin and placed in the public domain.
* Further modifications by Solar Designer, still public domain.
*
* There's absolutely no warranty.
*
* $Id: usleep.c,v 1.5 2005/05/07 22:26:06 solar Exp $
*/
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <stdio.h>
#include <errno.h>
#include <error.h>
#include <stdlib.h>
#include <limits.h>
#include <unistd.h>
static void __attribute__ ((__noreturn__)) usage(void)
{
fprintf(stderr, "usage: %s [microseconds]\n",
program_invocation_short_name);
exit(EXIT_FAILURE);
}
int main(int argc, const char **argv)
{
unsigned long delay = 1;
if (argc > 2)
usage();
if (argc == 2) {
char *p = 0;
errno = 0;
delay = strtoul(argv[1], &p, 10);
if (!*argv[1] || *p || errno) {
error(EXIT_SUCCESS, errno ? : EINVAL, "%s", argv[1]);
usage();
}
}
if (usleep(delay))
error(EXIT_FAILURE, errno, "%s", argv[1]);
return EXIT_SUCCESS;
}