home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR24 / BASH_112.ZIP / BASH-112.TAR / bash-1.12 / longest_sig.c < prev    next >
C/C++ Source or Header  |  1991-07-09  |  1KB  |  52 lines

  1. /* The answer to this question is 24. */
  2. #include <stdio.h>
  3. #include <signal.h>
  4.  
  5. /* Copyright (C) 1987,1989 Free Software Foundation, Inc.
  6.  
  7. This file is part of GNU Bash, the Bourne Again SHell.
  8.  
  9. Bash is free software; you can redistribute it and/or modify it under
  10. the terms of the GNU General Public License as published by the Free
  11. Software Foundation; either version 1, or (at your option) any later
  12. version.
  13.  
  14. Bash is distributed in the hope that it will be useful, but WITHOUT ANY
  15. WARRANTY; without even the implied warranty of MERCHANTABILITY or
  16. FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  17. for more details.
  18.  
  19. You should have received a copy of the GNU General Public License along
  20. with Bash; see the file COPYING.  If not, write to the Free Software
  21. Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
  22.  
  23. main (argc, argv)
  24.      int argc;
  25.      char **argv;
  26. {
  27.   extern char *sys_siglist[];
  28.   
  29.   int longest, length = 0;
  30.   int i;
  31.  
  32.   for (i = 0; i < NSIG; i++)
  33.     {
  34.       printf ("%2d) %s\n", i, sys_siglist[i]);
  35.       if (strlen (sys_siglist[i]) > length)
  36.     {
  37.       longest = i;
  38.       length = strlen (sys_siglist[i]);
  39.     }
  40.     }
  41.  
  42.   printf ("The longest name is %d:\"%s\", which is %d chars in length.\n",
  43.       longest, sys_siglist[longest], length);
  44. }
  45.  
  46. /*
  47.  * Local variables:
  48.  * compile-command: "cc -o longest_sig longest_sig.c"
  49.  * end:
  50.  */
  51.  
  52.