Files
oldlinux-files/bin/old/bash-1.11/longest_sig.c
2024-02-19 00:21:52 -05:00

52 lines
1.3 KiB
C
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/* The answer to this question is 24. */
#include <stdio.h>
#include <signal.h>
/* Copyright (C) 1987,1989 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 1, or (at your option) any later
version.
Bash is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
with Bash; see the file COPYING. If not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
main (argc, argv)
int argc;
char **argv;
{
extern char *sys_siglist[];
int longest, length = 0;
int i;
for (i = 0; i < NSIG; i++)
{
printf ("%2d) %s\n", i, sys_siglist[i]);
if (strlen (sys_siglist[i]) > length)
{
longest = i;
length = strlen (sys_siglist[i]);
}
}
printf ("The longest name is %d:\"%s\", which is %d chars in length.\n",
longest, sys_siglist[longest], length);
}
/*
* Local variables:
* compile-command: "cc -o longest_sig longest_sig.c"
* end:
*/