diff options
author | Roland McGrath <roland@gnu.org> | 1992-10-19 23:45:52 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1992-10-19 23:45:52 +0000 |
commit | 77b94d776c2700f21953625c38418a1df1181325 (patch) | |
tree | b7cb07d6be0b1bb8e2fa409f329acb9642185453 /manual/examples | |
parent | c7bb437152861499e13eb9061ba18feb6d4b2786 (diff) |
(do_stuff): Use puts, not printf.
(main): Specify return type; return instead of exit.
Diffstat (limited to 'manual/examples')
-rw-r--r-- | manual/examples/sigh1.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/manual/examples/sigh1.c b/manual/examples/sigh1.c index 909c55b995..2c6e95b9c9 100644 --- a/manual/examples/sigh1.c +++ b/manual/examples/sigh1.c @@ -3,12 +3,9 @@ #include <stdlib.h> /* This flag controls termination of the main loop. */ - volatile sig_atomic_t keep_going = 1; - /* The signal handler just clears the flag and re-enables itself. */ - void catch_alarm (int sig) { @@ -19,20 +16,21 @@ catch_alarm (int sig) void do_stuff (void) { - printf ("Doing stuff while waiting for alarm....\n"); + puts ("Doing stuff while waiting for alarm...."); } -main () +int +main (void) { - /* Establish a handler for SIGALRM signals. */ signal (SIGALRM, catch_alarm); - /* Set an alarm to go off in a little while. */ + /* Set an alarm to go off in a little while. */ alarm (2); /* Check the flag once in a while to see when to quit. */ while (keep_going) do_stuff (); - exit (EXIT_SUCCESS); + + return EXIT_SUCCESS; } |