minix/commands/sleep/sleep.c
Lionel Sambuc 0ac803292e Fix warnings trivial warnings.
Fix warnings about:
 . Unused variables
 . format mismatch in printf/scanf format string and arguments
 . Missing parenthesis around assignment as truth values
 . Clang warnings anout unknown GCC pragma
2013-01-14 11:44:31 +01:00

34 lines
561 B
C

/* sleep - suspend a process for x sec Author: Andy Tanenbaum */
#include <sys/types.h>
#include <stdlib.h>
#include <unistd.h>
#include <minix/minlib.h>
int main(int argc, char **argv);
int main(argc, argv)
int argc;
char *argv[];
{
register int seconds;
register char c;
seconds = 0;
if (argc != 2) {
std_err("Usage: sleep time\n");
exit(1);
}
while ((c = *(argv[1])++)) {
if (c < '0' || c > '9') {
std_err("sleep: bad arg\n");
exit(1);
}
seconds = 10 * seconds + (c - '0');
}
/* Now sleep. */
sleep(seconds);
return(0);
}