Files
oldlinux-files/study/linux-travel/MINIX-1.5/1.5/Source/commands/sleep.c
2024-02-19 00:25:23 -05:00

28 lines
425 B
C

/* sleep - suspend a process for x sec Author: Andy Tanenbaum */
main(argc, argv)
int argc;
char *argv[];
{
register 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);
exit(0);
}