add head
This commit is contained in:
5
sleep.c
5
sleep.c
@@ -6,6 +6,7 @@
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
char *end;
|
||||
unsigned int seconds;
|
||||
|
||||
if(getopt(argc, argv, "") != -1)
|
||||
@@ -13,7 +14,9 @@ main(int argc, char *argv[])
|
||||
if(optind != argc-1)
|
||||
eprintf("usage: %s seconds\n", argv[0]);
|
||||
|
||||
seconds = atoi(argv[optind]);
|
||||
seconds = strtol(argv[optind], &end, 0);
|
||||
if(*end != '\0')
|
||||
eprintf("%s: not a number\n", argv[optind]);
|
||||
while((seconds = sleep(seconds)) > 0)
|
||||
;
|
||||
return EXIT_SUCCESS;
|
||||
|
Reference in New Issue
Block a user