uuprog
diff sleep.c @ 0:4f628556fa3e
uuprog initial commit
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Thu, 25 Aug 2011 08:53:01 +0300 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/sleep.c Thu Aug 25 08:53:01 2011 +0300 1.3 @@ -0,0 +1,20 @@ 1.4 +/*! cc -o sleep sleep.c */ 1.5 +#include <stdio.h> 1.6 +#include <stdlib.h> 1.7 +#include <ctype.h> 1.8 +#include <unistd.h> 1.9 + 1.10 +int main(int argc, char **argv) 1.11 +{ 1.12 + if(argc < 2) { 1.13 + puts("seconds argument missing..."); 1.14 + return 1; 1.15 + } 1.16 + if(!isdigit(argv[1][0])) { 1.17 + fprintf(stderr, "invalid argument: %s\n", argv[1]); 1.18 + return 1; 1.19 + } 1.20 + 1.21 + sleep(atoi(argv[1])); 1.22 + return 0; 1.23 +}