refactor strnum

This commit is contained in:
Connor Lane Smith
2011-06-10 05:41:40 +01:00
parent 70ba7a6e62
commit 7c251bcd4f
10 changed files with 18 additions and 39 deletions

View File

@@ -6,7 +6,6 @@
int
main(int argc, char *argv[])
{
char *end;
unsigned int seconds;
if(getopt(argc, argv, "") != -1)
@@ -14,9 +13,7 @@ main(int argc, char *argv[])
if(optind != argc-1)
eprintf("usage: %s seconds\n", argv[0]);
seconds = strtol(argv[optind], &end, 0);
if(*end != '\0')
eprintf("%s: not a number\n", argv[optind]);
seconds = strnum(argv[optind], 0);
while((seconds = sleep(seconds)) > 0)
;
return EXIT_SUCCESS;