/[hurd]/hurd/fstests/timertest.c
ViewVC logotype

Diff of /hurd/fstests/timertest.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by roland, Mon Feb 26 04:14:34 2001 UTC revision 1.5 by neal, Tue Mar 26 19:00:56 2002 UTC
# Line 1  Line 1 
1  /*  /* A test for the Hurd timer and getchar
2     Copyright (C) 1994, 2001 Free Software Foundation, Inc.     Copyright (C) 1994,2001,02 Free Software Foundation, Inc.
3    
4     This program is free software; you can redistribute it and/or     This program is free software; you can redistribute it and/or
5     modify it under the terms of the GNU General Public License as     modify it under the terms of the GNU General Public License as
# Line 19  Line 19 
19  #include <sys/time.h>  #include <sys/time.h>
20  #include <stdio.h>  #include <stdio.h>
21  #include <stdlib.h>  #include <stdlib.h>
22    #include <errno.h>
23    #include <error.h>
24    
25  void  void
26  alarm_handler (int signo)  alarm_handler (int signo)
# Line 28  alarm_handler (int signo) Line 30  alarm_handler (int signo)
30  }  }
31    
32  int  int
33  main()  main(int argc, char *argv[])
34  {  {
35    struct itimerval real_timer;    struct itimerval real_timer;
36    
# Line 40  main() Line 42  main()
42    signal (SIGALRM, alarm_handler);    signal (SIGALRM, alarm_handler);
43    
44    if (setitimer (ITIMER_REAL, &real_timer, 0) < 0)    if (setitimer (ITIMER_REAL, &real_timer, 0) < 0)
45      {      error (1, errno, "Setting timer");
       perror ("Setting timer");  
       exit (1);  
     }  
46    
47    while (1)    while (1)
48      {      {
# Line 52  main() Line 51  main()
51        fflush (stdout);        fflush (stdout);
52        c = getchar ();        c = getchar ();
53        if (ferror (stdin))        if (ferror (stdin))
54          {          error (1, errno, "getchar");
           perror ("getchar");  
           exit (1);  
         }  
55        if (c == EOF)        if (c == EOF)
56          {          {
57            puts ("Saw EOF.  Pausing (no input)...");            puts ("Saw EOF.  Pausing (no input)...");

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26