home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_09_03
/
9n03127b
< prev
next >
Wrap
Text File
|
1991-01-16
|
455b
|
25 lines
/* given signal index or name as string, */
/* returns signal index or -1 if bad arg */
string_to_signal(s)
char *s;
{
int sig;
char *name;
/* try interpreting as an integer */
if (1 == sscanf(s,"%d",&sig)) return(sig);
/* try interpreting as a string */
for (sig=0;sig<NSIG;sig++) {
name = signals[sig].name;
if (SIG_RESERVED(sig)) name++;
if (streq(s,name) || streq(s,name+3))
return(sig);
}
return(-1);
}