/* * mystop.c - Another handy routine for testing your tiny shell * * usage: mystop * Sleeps for seconds and sends SIGTSTP to itself. * */ #include #include #include #include #include #include int main(int argc, char **argv) { int i, secs; pid_t pid; if (argc != 2) { fprintf(stderr, "Usage: %s \n", argv[0]); exit(0); } secs = atoi(argv[1]); for (i=0; i < secs; i++) sleep(1); pid = getpid(); if (kill(-pid, SIGTSTP) < 0) fprintf(stderr, "kill (tstp) error"); exit(0); }