xref: /freebsd/contrib/tcsh/sh.init.c (revision 84ee9401a3fc8d3c22424266f421a928989cd692)
1 /* $Header: /src/pub/tcsh/sh.init.c,v 3.55 2005/01/18 20:43:31 christos Exp $ */
2 /*
3  * sh.init.c: Function and signal tables
4  */
5 /*-
6  * Copyright (c) 1980, 1991 The Regents of the University of California.
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  * 3. Neither the name of the University nor the names of its contributors
18  *    may be used to endorse or promote products derived from this software
19  *    without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31  * SUCH DAMAGE.
32  */
33 #include "sh.h"
34 
35 RCSID("$Id: sh.init.c,v 3.55 2005/01/18 20:43:31 christos Exp $")
36 
37 #include "ed.h"
38 #include "tw.h"
39 
40 /*
41  * C shell
42  */
43 
44 #define	INF	0x7fffffff
45 
46 struct	biltins bfunc[] = {
47     { ":",		dozip,		0,	INF	},
48     { "@",		dolet,		0,	INF	},
49     { "alias",		doalias,	0,	INF	},
50 #ifdef OBSOLETE
51     { "aliases",	doaliases,	0,	1,	},
52 #endif /* OBSOLETE */
53     { "alloc",		showall,	0,	1	},
54 #if defined(_CX_UX)
55     { "att",		doatt,		0,	INF	},
56 #endif /* _CX_UX */
57     { "bg",		dobg,		0,	INF	},
58 #ifdef OBSOLETE
59     { "bind",		dobind,		0,	2	},
60 #endif /* OBSOLETE */
61     { "bindkey",	dobindkey,	0,	8	},
62     { "break",		dobreak,	0,	0	},
63     { "breaksw",	doswbrk,	0,	0	},
64 #ifdef _OSD_POSIX
65     { "bs2cmd",		dobs2cmd,	1,	INF	},
66 #endif /* OBSOLETE */
67     { "builtins",	dobuiltins,	0,	0	},
68 #ifdef KAI
69     { "bye",		goodbye,	0,	0	},
70 #endif /* KAI */
71     { "case",		dozip,		0,	1	},
72     { "cd",		dochngd,	0,	INF	},
73     { "chdir",		dochngd,	0,	INF	},
74     { "complete",	docomplete,	0,	INF	},
75     { "continue",	docontin,	0,	0	},
76     { "default",	dozip,		0,	0	},
77     { "dirs",		dodirs,		0,	INF	},
78 #if defined(_CRAY) && !defined(_CRAYMPP)
79     { "dmmode",		dodmmode,	0,	1	},
80 #endif /* _CRAY && !_CRAYMPP */
81     { "echo",		doecho,		0,	INF	},
82     { "echotc",		doechotc,	0,	INF	},
83     { "else",		doelse,		0,	INF	},
84     { "end",		doend,		0,	0	},
85     { "endif",		dozip,		0,	0	},
86     { "endsw",		dozip,		0,	0	},
87     { "eval",		doeval,		0,	INF	},
88     { "exec",		execash,	1,	INF	},
89     { "exit",		doexit,		0,	INF	},
90     { "fg",		dofg,		0,	INF	},
91     { "filetest",	dofiletest,	2,	INF	},
92     { "foreach",	doforeach,	3,	INF	},
93 #ifdef TCF
94     { "getspath",	dogetspath,	0,	0	},
95     { "getxvers",	dogetxvers,	0,	0	},
96 #endif /* TCF */
97     { "glob",		doglob,		0,	INF	},
98     { "goto",		dogoto,		1,	1	},
99     { "hashstat",	hashstat,	0,	0	},
100     { "history",	dohist,		0,	2	},
101     { "hup",		dohup,		0,	INF	},
102     { "if",		doif,		1,	INF	},
103 #ifdef apollo
104     { "inlib", 		doinlib,	1,	INF	},
105 #endif /* apollo */
106     { "jobs",		dojobs,		0,	1	},
107     { "kill",		dokill,		1,	INF	},
108 #ifndef HAVENOLIMIT
109     { "limit",		dolimit,	0,	3	},
110 #endif /* !HAVENOLIMIT */
111 #ifdef OBSOLETE
112     { "linedit",	doecho,		0,	INF	},
113 #endif /* OBSOLETE */
114 #if !defined(HAVENOUTMP) && !defined(KAI)
115     { "log",		dolog,		0,	0	},
116 #endif /* !HAVENOUTMP && !KAI */
117     { "login",		dologin,	0,	1	},
118     { "logout",		dologout,	0,	0	},
119     { "ls-F",		dolist,		0,	INF	},
120 #ifdef TCF
121     { "migrate",	domigrate,	1,	INF	},
122 #endif /* TCF */
123 #ifdef NEWGRP
124     { "newgrp",		donewgrp,	0,	2	},
125 #endif /* NEWGRP */
126     { "nice",		donice,		0,	INF	},
127     { "nohup",		donohup,	0,	INF	},
128     { "notify",		donotify,	0,	INF	},
129     { "onintr",		doonintr,	0,	2	},
130     { "popd",		dopopd,		0,	INF	},
131     { "printenv",	doprintenv,	0,	1	},
132     { "pushd",		dopushd,	0,	INF	},
133     { "rehash",		dohash,		0,	3	},
134     { "repeat",		dorepeat,	2,	INF	},
135 #ifdef apollo
136     { "rootnode",	dorootnode,	1,	1	},
137 #endif /* apollo */
138     { "sched",		dosched,	0,	INF	},
139     { "set",		doset,		0,	INF	},
140     { "setenv",		dosetenv,	0,	2	},
141 #ifdef MACH
142     { "setpath",	dosetpath,	0,	INF	},
143 #endif	/* MACH */
144 #ifdef TCF
145     { "setspath",	dosetspath,	1,	INF	},
146 #endif /* TCF */
147     { "settc",		dosettc,	2,	2	},
148     { "setty", 		dosetty,	0,      INF	},
149 #ifdef TCF
150     { "setxvers",	dosetxvers,	0,	1	},
151 #endif /* TCF */
152     { "shift",		shift,		0,	1	},
153     { "source",		dosource,	1,	INF	},
154     { "stop",		dostop,		1,	INF	},
155     { "suspend",	dosuspend,	0,	0	},
156     { "switch",		doswitch,	1,	INF	},
157     { "telltc",		dotelltc,	0,	INF	},
158 #ifndef WINNT_NATIVE
159     { "termname",	dotermname,	0,  	1       },
160 #endif
161     { "time",		dotime,		0,	INF	},
162 #if defined(_CX_UX)
163     { "ucb",		doucb,		0,	INF	},
164 #endif /* _CX_UX */
165     { "umask",		doumask,	0,	1	},
166     { "unalias",	unalias,	1,	INF	},
167     { "uncomplete",	douncomplete,	1,	INF	},
168     { "unhash",		dounhash,	0,	0	},
169 #if defined(masscomp) || defined(_CX_UX)
170     { "universe",	douniverse,	0,	INF	},
171 #endif /* masscomp || _CX_UX */
172 #ifndef HAVENOLIMIT
173     { "unlimit",	dounlimit,	0,	INF	},
174 #endif /* !HAVENOLIMIT */
175     { "unset",		unset,		1,	INF	},
176     { "unsetenv",	dounsetenv,	1,	INF	},
177 #ifdef apollo
178     { "ver",		dover,		0,	INF	},
179 #endif /* apollo */
180     { "wait",		dowait,		0,	0	},
181 #ifdef WARP
182     { "warp",		dowarp,		0,	2	},
183 #endif /* WARP */
184 #if !defined(HAVENOUTMP) && defined(KAI)
185     { "watchlog",	dolog,		0,	0	},
186 #endif /* !HAVENOUTMP && KAI */
187     { "where",		dowhere,	1,	INF	},
188     { "which",		dowhich,	1,	INF	},
189     { "while",		dowhile,	1,	INF	}
190 };
191 int nbfunc = sizeof bfunc / sizeof *bfunc;
192 
193 struct srch srchn[] = {
194     { "@",		TC_LET		},
195     { "break",		TC_BREAK	},
196     { "breaksw",	TC_BRKSW	},
197     { "case",		TC_CASE		},
198     { "default", 	TC_DEFAULT	},
199     { "else",		TC_ELSE		},
200     { "end",		TC_END		},
201     { "endif",		TC_ENDIF	},
202     { "endsw",		TC_ENDSW	},
203     { "exit",		TC_EXIT		},
204     { "foreach", 	TC_FOREACH	},
205     { "goto",		TC_GOTO		},
206     { "if",		TC_IF		},
207     { "label",		TC_LABEL	},
208     { "set",		TC_SET		},
209     { "switch",		TC_SWITCH	},
210     { "while",		TC_WHILE	}
211 };
212 int nsrchn = sizeof srchn / sizeof *srchn;
213 
214 
215 /*
216  * Note: For some machines, (hpux eg.)
217  * NSIG = number of signals + 1...
218  * so we define 33 or 65 (POSIX) signals for
219  * everybody
220  */
221 
222 /* We define NUMSIG to avoid changing NSIG or MAXSIG */
223 #if defined(POSIX) && !defined(__CYGWIN__)
224 # define NUMSIG 65
225 #else /* !POSIX */
226 # define NUMSIG 33
227 #endif /* POSIX */
228 
229 int	nsig = NUMSIG - 1;	/* This should be the number of real signals */
230 				/* not counting signal 0 */
231 struct mesg mesg[NUMSIG];	/* Arrays start at [0] so we initialize from */
232 				/* 0 to 32 or 64, the max real signal number */
233 
234 void
235 mesginit()
236 {
237 
238 #ifdef NLS_CATALOGS
239     int i;
240 
241     for (i = 0; i < NUMSIG; i++) {
242 	xfree((ptr_t) mesg[i].pname);
243 	mesg[i].pname = NULL;
244     }
245 #endif /* NLS_CATALOGS */
246 
247 #if defined(SIGNULL) || defined(DECOSF1)
248 # ifndef SIGNULL
249 #  define SIGNULL 0
250 # endif /* !SIGNULL */
251     if (mesg[SIGNULL].pname == NULL) {
252 	mesg[SIGNULL].iname = "NULL";
253 	mesg[SIGNULL].pname = CSAVS(2, 1, "Null signal");
254     }
255 #endif /* SIGNULL || DECOSF1 */
256 
257 #ifdef SIGHUP
258     if (mesg[SIGHUP].pname == NULL) {
259 	mesg[SIGHUP].iname = "HUP";
260 	mesg[SIGHUP].pname = CSAVS(2, 2, "Hangup");
261     }
262 #endif /* SIGHUP */
263 
264 #ifdef SIGINT
265     if (mesg[SIGINT].pname == NULL) {
266 	mesg[SIGINT].iname = "INT";
267 	mesg[SIGINT].pname = CSAVS(2, 3, "Interrupt");
268     }
269 #endif /* SIGINT */
270 
271 #ifdef SIGQUIT
272     if (mesg[SIGQUIT].pname == NULL) {
273 	mesg[SIGQUIT].iname = "QUIT";
274 	mesg[SIGQUIT].pname = CSAVS(2, 4, "Quit");
275     }
276 #endif /* SIGQUIT */
277 
278 #ifdef SIGILL
279     if (mesg[SIGILL].pname == NULL) {
280 	mesg[SIGILL].iname = "ILL";
281 	mesg[SIGILL].pname = CSAVS(2, 5, "Illegal instruction");
282     }
283 #endif /* SIGILL */
284 
285 #ifdef SIGTRAP
286     if (mesg[SIGTRAP].pname == NULL) {
287 	mesg[SIGTRAP].iname = "TRAP";
288 	mesg[SIGTRAP].pname = CSAVS(2, 6, "Trace/BPT trap");
289     }
290 #endif /* SIGTRAP */
291 
292 #ifdef SIGABRT
293     if (mesg[SIGABRT].pname == NULL) {
294 	mesg[SIGABRT].iname = "ABRT";
295 	mesg[SIGABRT].pname = CSAVS(2, 7, "Abort");
296     }
297 #endif /* SIGABRT */
298 
299 #ifdef SIGIOT
300     if (mesg[SIGIOT].pname == NULL) {
301 	mesg[SIGIOT].iname = "IOT";
302 	mesg[SIGIOT].pname = CSAVS(2, 8, "IOT trap");
303     }
304 #endif /* SIGIOT */
305 
306 #ifdef SIGDANGER
307     /* aiws */
308     if (mesg[SIGDANGER].pname == NULL) {
309 	mesg[SIGDANGER].iname = "DANGER";
310 	mesg[SIGDANGER].pname = CSAVS(2, 9, "System Crash Imminent");
311     }
312 #endif /* SIGDANGER */
313 
314 #ifdef SIGERR
315     /* _CRAY */
316     if (mesg[SIGERR].pname == NULL) {
317 	mesg[SIGERR].iname = "ERR";
318 	mesg[SIGERR].pname = CSAVS(2, 10, "Error exit");
319     }
320 #endif /* SIGERR */
321 
322 #ifdef SIGEMT
323     if (mesg[SIGEMT].pname == NULL) {
324 	mesg[SIGEMT].iname = "EMT";
325 	mesg[SIGEMT].pname = CSAVS(2, 11, "EMT trap");
326     }
327 #endif /* SIGEMT */
328 
329 #ifdef SIGFPE
330     if (mesg[SIGFPE].pname == NULL) {
331 	mesg[SIGFPE].iname = "FPE";
332 	mesg[SIGFPE].pname = CSAVS(2, 12, "Floating exception");
333     }
334 #endif /* SIGFPE */
335 
336 #ifdef SIGKILL
337     if (mesg[SIGKILL].pname == NULL) {
338 	mesg[SIGKILL].iname = "KILL";
339 	mesg[SIGKILL].pname = CSAVS(2, 13, "Killed");
340     }
341 #endif /* SIGKILL */
342 
343 #ifdef SIGUSR1
344     if (mesg[SIGUSR1].pname == NULL) {
345 	mesg[SIGUSR1].iname = "USR1";
346 	mesg[SIGUSR1].pname = CSAVS(2, 14, "User signal 1");
347     }
348 #endif /* SIGUSR1 */
349 
350 #ifdef SIGUSR2
351     if (mesg[SIGUSR2].pname == NULL) {
352 	mesg[SIGUSR2].iname = "USR2";
353 	mesg[SIGUSR2].pname = CSAVS(2, 15, "User signal 2");
354     }
355 #endif /* SIGUSR2 */
356 
357 #ifdef SIGSEGV
358     if (mesg[SIGSEGV].pname == NULL) {
359 	mesg[SIGSEGV].iname = "SEGV";
360 	mesg[SIGSEGV].pname = CSAVS(2, 16, "Segmentation fault");
361     }
362 #endif /* SIGSEGV */
363 
364 #ifdef SIGBUS
365     if (mesg[SIGBUS].pname == NULL) {
366 	mesg[SIGBUS].iname = "BUS";
367 	mesg[SIGBUS].pname = CSAVS(2, 17, "Bus error");
368     }
369 #endif /* SIGBUS */
370 
371 #ifdef SIGPRE
372     /* _CRAY || IBMAIX */
373     if (mesg[SIGPRE].pname == NULL) {
374 	mesg[SIGPRE].iname = "PRE";
375 	mesg[SIGPRE].pname = CSAVS(2, 18, "Program range error");
376     }
377 #endif /* SIGPRE */
378 
379 #ifdef SIGORE
380     /* _CRAY */
381     if (mesg[SIGORE].pname == NULL) {
382 	mesg[SIGORE].iname = "ORE";
383 	mesg[SIGORE].pname = CSAVS(2, 19, "Operand range error");
384     }
385 #endif /* SIGORE */
386 
387 #ifdef SIGSYS
388     if (mesg[SIGSYS].pname == NULL) {
389 	mesg[SIGSYS].iname = "SYS";
390 	mesg[SIGSYS].pname = CSAVS(2, 20, "Bad system call");
391     }
392 #endif /* SIGSYS */
393 
394 #ifdef SIGPIPE
395     if (mesg[SIGPIPE].pname == NULL) {
396 	mesg[SIGPIPE].iname = "PIPE";
397 	mesg[SIGPIPE].pname = CSAVS(2, 21, "Broken pipe");
398     }
399 #endif /* SIGPIPE */
400 
401 #ifdef SIGALRM
402     if (mesg[SIGALRM].pname == NULL) {
403 	mesg[SIGALRM].iname = "ALRM";
404 	mesg[SIGALRM].pname = CSAVS(2, 22, "Alarm clock");
405     }
406 #endif /* SIGALRM */
407 
408 #ifdef SIGTERM
409     if (mesg[SIGTERM].pname == NULL) {
410 	mesg[SIGTERM].iname = "TERM";
411 	mesg[SIGTERM].pname = CSAVS(2, 23, "Terminated");
412     }
413 #endif /* SIGTERM */
414 
415 /* SIGCLD vs SIGCHLD */
416 #if !defined(SIGCHLD) || defined(SOLARIS2) || defined(apollo) || defined(__EMX__)
417     /* If we don't define SIGCHLD, or our OS prefers SIGCLD to SIGCHLD, */
418     /* check for SIGCLD */
419 # ifdef SIGCLD
420     if (mesg[SIGCLD].pname == NULL) {
421 	mesg[SIGCLD].iname = "CLD";
422 #  ifdef BSDJOBS
423 	mesg[SIGCLD].pname = CSAVS(2, 24, "Child status change");
424 #  else /* !BSDJOBS */
425 	mesg[SIGCLD].pname = CSAVS(2, 25, "Death of child");
426 #  endif /* BSDJOBS */
427     }
428 # endif /* SIGCLD */
429 #else /* !(!SIGCHLD || SOLARIS2 || apollo || __EMX__) */
430     /* We probably define SIGCHLD */
431 # ifdef SIGCHLD
432     if (mesg[SIGCHLD].pname == NULL) {
433 	mesg[SIGCHLD].iname = "CHLD";
434 #  ifdef BSDJOBS
435 	mesg[SIGCHLD].pname = CSAVS(2, 27, "Child stopped or exited");
436 #  else /* !BSDJOBS */
437 	mesg[SIGCHLD].pname = CSAVS(2, 28, "Child exited");
438 #  endif /* BSDJOBS */
439     }
440 # endif /* SIGCHLD */
441 #endif /* !SIGCHLD || SOLARIS2 || apollo || __EMX__ */
442 
443 #ifdef SIGAPOLLO
444     /* apollo */
445     if (mesg[SIGAPOLLO].pname == NULL) {
446 	mesg[SIGAPOLLO].iname = "APOLLO";
447 	mesg[SIGAPOLLO].pname = CSAVS(2, 26, "Apollo-specific fault");
448     }
449 #endif /* SIGAPOLLO */
450 
451 #ifdef SIGPWR
452     if (mesg[SIGPWR].pname == NULL) {
453 	mesg[SIGPWR].iname = "PWR";
454 	mesg[SIGPWR].pname = CSAVS(2, 29, "Power failure");
455     }
456 #endif /* SIGPWR */
457 
458 #ifdef SIGLOST
459     if (mesg[SIGLOST].pname == NULL) {
460 	mesg[SIGLOST].iname = "LOST";
461 	mesg[SIGLOST].pname = CSAVS(2, 30, "Resource Lost");
462     }
463 #endif /* SIGLOST */
464 
465 #ifdef SIGBREAK
466     /* __EMX__ */
467     if (mesg[SIGBREAK].pname == NULL) {
468 	mesg[SIGBREAK].iname = "BREAK";
469 	mesg[SIGBREAK].pname = CSAVS(2, 31, "Break (Ctrl-Break)");
470     }
471 #endif /* SIGBREAK */
472 
473 #ifdef SIGIO
474 # if !defined(SIGPOLL) || SIGPOLL != SIGIO
475     if (mesg[SIGIO].pname == NULL) {
476 	mesg[SIGIO].iname = "IO";
477 #  ifdef cray
478 	mesg[SIGIO].pname = CSAVS(2, 32, "Input/output possible signal");
479 #  else /* !cray */
480 	mesg[SIGIO].pname = CSAVS(2, 33, "Asynchronous I/O (select)");
481 #  endif /* cray */
482     }
483 # endif /* !SIGPOLL || SIGPOLL != SIGIO */
484 #endif /* SIGIO */
485 
486 #ifdef SIGURG
487     if (mesg[SIGURG].pname == NULL) {
488 	mesg[SIGURG].iname = "URG";
489 	mesg[SIGURG].pname = CSAVS(2, 34, "Urgent condition on I/O channel");
490     }
491 #endif /* SIGURG */
492 
493 #ifdef SIGMT
494     /* cray */
495     if (mesg[SIGMT].pname == NULL) {
496 	mesg[SIGMT].iname = "MT";
497 	mesg[SIGMT].pname = CSAVS(2, 35, "Multitasking wake-up");
498     }
499 #endif /* SIGMT */
500 
501 #ifdef SIGMTKILL
502     /* cray */
503     if (mesg[SIGMTKILL].pname == NULL) {
504 	mesg[SIGMTKILL].iname = "MTKILL";
505 	mesg[SIGMTKILL].pname = CSAVS(2, 36, "Multitasking kill");
506     }
507 #endif /* SIGMTKILL */
508 
509 #ifdef SIGBUFIO
510     /* _CRAYCOM */
511     if (mesg[SIGBUFIO].pname == NULL) {
512 	mesg[SIGBUFIO].iname = "BUFIO";
513 	mesg[SIGBUFIO].pname = CSAVS(2, 37,
514 				    "Fortran asynchronous I/O completion");
515     }
516 #endif /* SIGBUFIO */
517 
518 #ifdef SIGRECOVERY
519     /* _CRAYCOM */
520     if (mesg[SIGRECOVERY].pname == NULL) {
521 	mesg[SIGRECOVERY].iname = "RECOVERY";
522 	mesg[SIGRECOVERY].pname = CSAVS(2, 38, "Recovery");
523     }
524 #endif /* SIGRECOVERY */
525 
526 #ifdef SIGUME
527     /* _CRAYCOM */
528     if (mesg[SIGUME].pname == NULL) {
529 	mesg[SIGUME].iname = "UME";
530 	mesg[SIGUME].pname = CSAVS(2, 39, "Uncorrectable memory error");
531     }
532 #endif /* SIGUME */
533 
534 #ifdef SIGCPULIM
535     /* _CRAYCOM */
536     if (mesg[SIGCPULIM].pname == NULL) {
537 	mesg[SIGCPULIM].iname = "CPULIM";
538 	mesg[SIGCPULIM].pname = CSAVS(2, 40, "CPU time limit exceeded");
539     }
540 #endif /* SIGCPULIM */
541 
542 #ifdef SIGSHUTDN
543     /* _CRAYCOM */
544     if (mesg[SIGSHUTDN].pname == NULL) {
545 	mesg[SIGSHUTDN].iname = "SHUTDN";
546 	mesg[SIGSHUTDN].pname = CSAVS(2, 41, "System shutdown imminent");
547     }
548 #endif /* SIGSHUTDN */
549 
550 #ifdef SIGNOWAK
551     /* _CRAYCOM */
552     if (mesg[SIGNOWAK].pname == NULL) {
553 	mesg[SIGNOWAK].iname = "NOWAK";
554 	mesg[SIGNOWAK].pname = CSAVS(2, 42,
555 				    "Micro-tasking group-no wakeup flag set");
556     }
557 #endif /* SIGNOWAK */
558 
559 #ifdef SIGTHERR
560     /* _CRAYCOM */
561     if (mesg[SIGTHERR].pname == NULL) {
562 	mesg[SIGTHERR].iname = "THERR";
563 	mesg[SIGTHERR].pname = CSAVS(2, 43,
564 			    "Thread error - (use cord -T for detailed info)");
565     }
566 #endif /* SIGTHERR */
567 
568 #ifdef SIGRPE
569     /* cray */
570     if (mesg[SIGRPE].pname == NULL) {
571 	mesg[SIGRPE].pname = CSAVS(2, 44, "CRAY Y-MP register parity error");
572 	mesg[SIGRPE].iname = "RPE";
573     }
574 #endif /* SIGRPE */
575 
576 #ifdef SIGINFO
577     if (mesg[SIGINFO].pname == NULL) {
578 	mesg[SIGINFO].iname = "INFO";
579 	mesg[SIGINFO].pname = CSAVS(2, 45, "Information request");
580     }
581 #endif /* SIGINFO */
582 
583 #ifdef SIGSTOP
584     if (mesg[SIGSTOP].pname == NULL) {
585 	mesg[SIGSTOP].iname = "STOP";
586 # ifdef SUSPENDED
587 	mesg[SIGSTOP].pname = CSAVS(2, 46, "Suspended (signal)");
588 # else /* !SUSPENDED */
589 	mesg[SIGSTOP].pname = CSAVS(2, 47, "Stopped (signal)");
590 # endif /* SUSPENDED */
591     }
592 #endif /* SIGSTOP */
593 
594 #ifdef SIGTSTP
595     if (mesg[SIGTSTP].pname == NULL) {
596 	mesg[SIGTSTP].iname = "TSTP";
597 # ifdef SUSPENDED
598 	mesg[SIGTSTP].pname = CSAVS(2, 48, "Suspended");
599 # else /* !SUSPENDED */
600 	mesg[SIGTSTP].pname = CSAVS(2, 49, "Stopped");
601 # endif /* SUSPENDED */
602     }
603 #endif /* SIGTSTP */
604 
605 #ifdef SIGCONT
606     if (mesg[SIGCONT].pname == NULL) {
607 	mesg[SIGCONT].iname = "CONT";
608 	mesg[SIGCONT].pname = CSAVS(2, 50, "Continued");
609     }
610 #endif /* SIGCONT */
611 
612 #ifdef SIGTTIN
613     if (mesg[SIGTTIN].pname == NULL) {
614 	mesg[SIGTTIN].iname = "TTIN";
615 # ifdef SUSPENDED
616 	mesg[SIGTTIN].pname = CSAVS(2, 51, "Suspended (tty input)");
617 # else /* !SUSPENDED */
618 	mesg[SIGTTIN].pname = CSAVS(2, 52, "Stopped (tty input)");
619 # endif /* SUSPENDED */
620     }
621 #endif /* SIGTTIN */
622 
623 #ifdef SIGTTOU
624     if (mesg[SIGTTOU].pname == NULL) {
625 	mesg[SIGTTOU].iname = "TTOU";
626 # ifdef SUSPENDED
627 	mesg[SIGTTOU].pname = CSAVS(2, 53, "Suspended (tty output)");
628 # else /* SUSPENDED */
629 	mesg[SIGTTOU].pname = CSAVS(2, 54, "Stopped (tty output)");
630 # endif /* SUSPENDED */
631     }
632 #endif /* SIGTTOU */
633 
634 #ifdef SIGWIND
635     /* UNIXPC */
636     if (mesg[SIGWIND].pname == NULL) {
637 	mesg[SIGWIND].iname = "WIND";
638 	mesg[SIGWIND].pname = CSAVS(2, 55, "Window status changed");
639     }
640 #endif /* SIGWIND */
641 
642 #ifdef SIGWINDOW
643     if (mesg[SIGWINDOW].pname == NULL) {
644 	mesg[SIGWINDOW].iname = "WINDOW";
645 	mesg[SIGWINDOW].pname = CSAVS(2, 56, "Window size changed");
646     }
647 #endif /* SIGWINDOW */
648 
649 #ifdef SIGWINCH
650     if (mesg[SIGWINCH].pname == NULL) {
651 	mesg[SIGWINCH].iname = "WINCH";
652 	mesg[SIGWINCH].pname = CSAVS(2, 56, "Window size changed");
653     }
654 #endif /* SIGWINCH */
655 
656 #ifdef SIGPHONE
657     /* UNIXPC */
658     if (mesg[SIGPHONE].pname == NULL) {
659 	mesg[SIGPHONE].iname = "PHONE";
660 	mesg[SIGPHONE].pname = CSAVS(2, 57, "Phone status changed");
661     }
662 # endif /* SIGPHONE */
663 
664 #ifdef SIGXCPU
665     if (mesg[SIGXCPU].pname == NULL) {
666 	mesg[SIGXCPU].iname = "XCPU";
667 	mesg[SIGXCPU].pname = CSAVS(2, 58, "Cputime limit exceeded");
668     }
669 #endif /* SIGXCPU */
670 
671 #ifdef SIGXFSZ
672     if (mesg[SIGXFSZ].pname == NULL) {
673 	mesg[SIGXFSZ].iname = "XFSZ";
674 	mesg[SIGXFSZ].pname = CSAVS(2, 59, "Filesize limit exceeded");
675     }
676 #endif /* SIGXFSZ */
677 
678 #ifdef SIGVTALRM
679     if (mesg[SIGVTALRM].pname == NULL) {
680 	mesg[SIGVTALRM].iname = "VTALRM";
681 	mesg[SIGVTALRM].pname = CSAVS(2, 60, "Virtual time alarm");
682     }
683 #endif /* SIGVTALRM */
684 
685 #ifdef SIGPROF
686     if (mesg[SIGPROF].pname == NULL) {
687 	mesg[SIGPROF].iname = "PROF";
688 	mesg[SIGPROF].pname = CSAVS(2, 61, "Profiling time alarm");
689     }
690 #endif /* SIGPROF */
691 
692 #ifdef SIGDIL
693     /* hpux */
694     if (mesg[SIGDIL].pname == NULL) {
695 	mesg[SIGDIL].iname = "DIL";
696 	mesg[SIGDIL].pname = CSAVS(2, 62, "DIL signal");
697     }
698 #endif /* SIGDIL */
699 
700 #ifdef SIGPOLL
701     if (mesg[SIGPOLL].pname == NULL) {
702 	mesg[SIGPOLL].iname = "POLL";
703 	mesg[SIGPOLL].pname = CSAVS(2, 63, "Pollable event occured");
704     }
705 #endif /* SIGPOLL */
706 
707 #ifdef SIGWAITING
708     /* solaris */
709     if (mesg[SIGWAITING].pname == NULL) {
710 	mesg[SIGWAITING].iname = "WAITING";
711 	mesg[SIGWAITING].pname = CSAVS(2, 64, "Process's lwps are blocked");
712     }
713 #endif /* SIGWAITING */
714 
715 #ifdef SIGLWP
716     /* solaris */
717     if (mesg[SIGLWP].pname == NULL) {
718 	mesg[SIGLWP].iname = "LWP";
719 	mesg[SIGLWP].pname = CSAVS(2, 65, "Special LWP signal");
720     }
721 #endif /* SIGLWP */
722 
723 #ifdef SIGFREEZE
724     /* solaris */
725     if (mesg[SIGFREEZE].pname == NULL) {
726 	mesg[SIGFREEZE].iname = "FREEZE";
727 	mesg[SIGFREEZE].pname = CSAVS(2, 66, "Special CPR Signal");
728     }
729 #endif /* SIGFREEZE */
730 
731 #ifdef SIGTHAW
732     /* solaris */
733     if (mesg[SIGTHAW].pname == NULL) {
734 	mesg[SIGTHAW].iname = "THAW";
735 	mesg[SIGTHAW].pname = CSAVS(2, 67, "Special CPR Signal");
736     }
737 #endif /* SIGTHAW */
738 
739 #ifdef SIGCANCEL
740     /* solaris */
741     if (mesg[SIGCANCEL].pname == NULL) {
742 	mesg[SIGCANCEL].iname = "CANCEL";
743 	mesg[SIGCANCEL].pname = CSAVS(2, 109,
744 	    "Thread cancellation signal used by libthread");
745     }
746 #endif /* SIGCANCEL */
747 
748 /*
749  * Careful, some OS's (HP/UX 10.0) define these as -1
750  */
751 #ifdef SIGRTMIN
752     /*
753      * Cannot do this at compile time; Solaris2 uses _sysconf for these
754      */
755     if (SIGRTMIN > 0 && SIGRTMIN < NUMSIG) {
756 	if (mesg[SIGRTMIN].pname == NULL) {
757 	    mesg[SIGRTMIN].iname = "RTMIN";
758 	    mesg[SIGRTMIN].pname = CSAVS(2, 68, "First Realtime Signal");
759 	}
760 
761 	if (mesg[SIGRTMIN+1].pname == NULL) {
762 	    mesg[SIGRTMIN+1].iname = "RTMIN+1";
763 	    mesg[SIGRTMIN+1].pname = CSAVS(2, 69, "Second Realtime Signal");
764 	}
765 
766 	if (mesg[SIGRTMIN+2].pname == NULL) {
767 	    mesg[SIGRTMIN+2].iname = "RTMIN+2";
768 	    mesg[SIGRTMIN+2].pname = CSAVS(2, 70, "Third Realtime Signal");
769 	}
770 
771 	if (mesg[SIGRTMIN+3].pname == NULL) {
772 	    mesg[SIGRTMIN+3].iname = "RTMIN+3";
773 	    mesg[SIGRTMIN+3].pname = CSAVS(2, 71, "Fourth Realtime Signal");
774 	}
775     }
776 #endif /* SIGRTMIN */
777 
778 #ifdef SIGRTMAX
779     /*
780      * Cannot do this at compile time; Solaris2 uses _sysconf for these
781      */
782     if (SIGRTMAX > 0 && SIGRTMAX < NUMSIG) {
783 	if (mesg[SIGRTMAX-3].pname == NULL) {
784 	    mesg[SIGRTMAX-3].iname = "RTMAX-3";
785 	    mesg[SIGRTMAX-3].pname = CSAVS(2, 72,
786 					   "Fourth Last Realtime Signal");
787 	}
788 
789 	if (mesg[SIGRTMAX-2].pname == NULL) {
790 	    mesg[SIGRTMAX-2].iname = "RTMAX-2";
791 	    mesg[SIGRTMAX-2].pname = CSAVS(2, 73,
792 					   "Third Last Realtime Signal");
793 	}
794 
795 	if (mesg[SIGRTMAX-1].pname == NULL) {
796 	    mesg[SIGRTMAX-1].iname = "RTMAX-1";
797 	    mesg[SIGRTMAX-1].pname = CSAVS(2, 74,
798 					   "Second Last Realtime Signal");
799 	}
800 
801 	if (mesg[SIGRTMAX].pname == NULL) {
802 	    mesg[SIGRTMAX].iname = "RTMAX";
803 	    mesg[SIGRTMAX].pname = CSAVS(2, 75,
804 					 "Last Realtime Signal");
805 	}
806     }
807 #endif /* SIGRTMAX */
808 
809 
810 #ifdef SIGAIO
811     /* aiws */
812     if (mesg[SIGAIO].pname == NULL) {
813 	mesg[SIGAIO].iname = "AIO";
814 	mesg[SIGAIO].pname = CSAVS(2, 76, "LAN Asyncronous I/O");
815     }
816 #endif /* SIGAIO */
817 
818 #ifdef SIGPTY
819     /* aiws */
820     if (mesg[SIGPTY].pname == NULL) {
821 	mesg[SIGPTY].iname = "PTY";
822 	mesg[SIGPTY].pname = CSAVS(2, 77, "PTY read/write availability");
823     }
824 #endif /* SIGPTY */
825 
826 #ifdef SIGIOINT
827     /* aiws */
828     if (mesg[SIGIOINT].pname == NULL) {
829 	mesg[SIGIOINT].iname = "IOINT";
830 	mesg[SIGIOINT].pname = CSAVS(2, 78, "I/O intervention required");
831     }
832 #endif /* SIGIOINT */
833 
834 #ifdef SIGGRANT
835     /* aiws */
836     if (mesg[SIGGRANT].pname == NULL) {
837 	mesg[SIGGRANT].iname = "GRANT";
838 	mesg[SIGGRANT].pname = CSAVS(2, 79, "HFT monitor mode granted");
839     }
840 #endif /* SIGGRANT */
841 
842 #ifdef SIGRETRACT
843     /* aiws */
844     if (mesg[SIGRETRACT].pname == NULL) {
845 	mesg[SIGRETRACT].iname = "RETRACT";
846 	mesg[SIGRETRACT].pname = CSAVS(2, 80,
847 				  "HFT monitor mode should be relinguished");
848     }
849 #endif /* SIGRETRACT */
850 
851 #ifdef SIGSOUND
852     /* aiws */
853     if (mesg[SIGSOUND].pname == NULL) {
854 	mesg[SIGSOUND].iname = "SOUND";
855 	mesg[SIGSOUND].pname = CSAVS(2, 81, "HFT sound control has completed");
856     }
857 #endif /* SIGSOUND */
858 
859 #ifdef SIGSMSG
860     /* aiws */
861     if (mesg[SIGSMSG].pname == NULL) {
862 	mesg[SIGSMSG].iname = "SMSG";
863 	mesg[SIGSMSG].pname = CSAVS(2, 82, "Data in HFT ring buffer");
864     }
865 #endif /* SIGMSG */
866 
867 #ifdef SIGMIGRATE
868     /* IBMAIX */
869     if (mesg[SIGMIGRATE].pname == NULL) {
870 	mesg[SIGMIGRATE].iname = "MIGRATE";
871 	mesg[SIGMIGRATE].pname = CSAVS(2, 83, "Migrate process");
872     }
873 #endif /* SIGMIGRATE */
874 
875 #ifdef SIGSAK
876     /* IBMAIX */
877     if (mesg[SIGSAK].pname == NULL) {
878 	mesg[SIGSAK].iname = "SAK";
879 	mesg[SIGSAK].pname = CSAVS(2, 84, "Secure attention key");
880     }
881 #endif /* SIGSAK */
882 
883 #ifdef SIGRESCHED
884     /* CX/UX */
885     if (mesg[SIGRESCHED].pname == NULL) {
886 	mesg[SIGRESCHED].iname = "RESCHED";
887 	mesg[SIGRESCHED].pname = CSAVS(2, 85, "Reschedule");
888     }
889 #endif /* SIGRESCHED */
890 
891 #ifdef SIGDEBUG
892     /* VMS_POSIX */
893     if (mesg[SIGDEBUG].pname == NULL) {
894 	mesg[SIGDEBUG].iname = "DEBUG";
895 	mesg[SIGDEBUG].pname = CSAVS(2, 86, "Signaling SS$_DEBUG");
896     }
897 #endif /* SIGDEBUG */
898 
899 #ifdef SIGPRIO
900     /* Lynx */
901     if (mesg[SIGPRIO].pname == NULL) {
902 	mesg[SIGPRIO].iname = "PRIO";
903 	mesg[SIGPRIO].pname = CSAVS(2, 87, "Priority changed");
904     }
905 #endif /* SIGPRIO */
906 
907 #ifdef SIGDLK
908     /* cray */
909     if (mesg[SIGDLK].pname == NULL) {
910 	mesg[SIGDLK].iname = "DLK";
911 	mesg[SIGDLK].pname = CSAVS(2, 88, "True deadlock detected");
912     }
913 #endif /* SIGDLK */
914 
915 #ifdef SIGTINT
916     /* masscomp */
917     if (mesg[SIGTINT].pname == NULL) {
918 	mesg[SIGTINT].iname = "TINT";
919 	mesg[SIGTINT].pname = CSAVS(2, 89, "New input character");
920     }
921 #endif /* SIGTINT */
922 
923 #ifdef SIGSTKFLT
924     if (mesg[SIGSTKFLT].pname == NULL) {
925 	mesg[SIGSTKFLT].iname = "STKFLT";
926 	mesg[SIGSTKFLT].pname = CSAVS(2, 90, "Stack limit exceeded");
927     }
928 #endif /* SIGSTKFLT */
929 
930 #ifdef SIGUNUSED
931     if (mesg[SIGUNUSED].pname == NULL) {
932 	mesg[SIGUNUSED].iname = "UNUSED";
933 	mesg[SIGUNUSED].pname = CSAVS(2, 91, "Unused signal");
934     }
935 #endif /* SIGUNUSED */
936 
937 #ifdef SIGOVLY
938     /* SX-4 */
939     if (mesg[SIGOVLY].pname == NULL) {
940 	mesg[SIGOVLY].iname = "OVLY";
941 	mesg[SIGOVLY].pname = CSAVS(2, 92, "LM overlay");
942     }
943 #endif /* SIGOVLY */
944 
945 #ifdef SIGFRZ
946     /* SX-4 */
947     if (mesg[SIGFRZ].pname == NULL) {
948 	mesg[SIGFRZ].iname = "FRZ";
949 	mesg[SIGFRZ].pname = CSAVS(2, 93, "system freeze");
950     }
951 #endif /* SIGFRZ */
952 
953 #ifdef SIGDFRZ
954     /* SX-4 */
955     if (mesg[SIGDFRZ].pname == NULL) {
956 	mesg[SIGDFRZ].iname = "DFRZ";
957 	mesg[SIGDFRZ].pname = CSAVS(2, 94, "system defreeze");
958     }
959 #endif /* SIGDFRZ */
960 
961 #ifdef SIGDEAD
962     /* SX-4 */
963     if (mesg[SIGDEAD].pname == NULL) {
964 	mesg[SIGDEAD].iname = "DEAD";
965 	mesg[SIGDEAD].pname = CSAVS(2, 95, "dead lock");
966     }
967 #endif /* SIGDEAD */
968 
969 #ifdef SIGXMEM
970     /* SX-4 */
971     if (mesg[SIGXMEM].pname == NULL) {
972 	mesg[SIGXMEM].iname = "XMEM";
973 	mesg[SIGXMEM].pname = CSAVS(2, 96, "exceeded memory size limit");
974     }
975 #endif /* SIGXMEM */
976 
977 #ifdef SIGXDSZ
978     /* SX-4 */
979     if (mesg[SIGXDSZ].pname == NULL) {
980 	mesg[SIGXDSZ].iname = "XDSZ";
981 	mesg[SIGXDSZ].pname = CSAVS(2, 97, "exceeded data size limit");
982     }
983 #endif /* SIGXDSZ */
984 
985 #ifdef SIGMEM32
986     /* SX-4 */
987     if (mesg[SIGMEM32].pname == NULL) {
988 	mesg[SIGMEM32].iname = "MEM32";
989 	mesg[SIGMEM32].pname = CSAVS(2, 98, "exceeded memory size limit of 32KB");
990     }
991 #endif /* SIGMEM32 */
992 
993 #ifdef SIGNMEM
994     /* SX-4 */
995     if (mesg[SIGNMEM].pname == NULL) {
996 	mesg[SIGNMEM].iname = "NMEM";
997 	mesg[SIGNMEM].pname = CSAVS(2, 99, "exce error for no memory");
998     }
999 #endif /* SIGNMEM */
1000 
1001 #ifdef SIGCHKP
1002     /* SX-4 */
1003     if (mesg[SIGCHKP].pname == NULL) {
1004 	mesg[SIGCHKP].iname = "CHKP";
1005 	mesg[SIGCHKP].pname = CSAVS(2, 100, "check point start");
1006     }
1007 #endif /* SIGCHKP */
1008 
1009 #ifdef SIGKCHKP
1010 #if 0
1011     /* SX-4 */
1012     if (mesg[SIGKCHKP].pname == NULL) {
1013 	mesg[SIGKCHKP].iname = "KCHKP";
1014 	mesg[SIGKCHKP].pname = CSAVS(2, 101, "check point start of kernel");
1015     }
1016 #endif
1017 #endif /* SIGKCHKP */
1018 
1019 #ifdef SIGRSTA
1020     /* SX-4 */
1021     if (mesg[SIGRSTA].pname == NULL) {
1022 	mesg[SIGRSTA].iname = "RSTA";
1023 	mesg[SIGRSTA].pname = CSAVS(2, 102, "restart start");
1024     }
1025 #endif /* SIGRSTA */
1026 
1027 #ifdef SIGKRSTA
1028 #if 0
1029     /* SX-4 */
1030     if (mesg[SIGKRSTA].pname == NULL) {
1031 	mesg[SIGKRSTA].iname = "KRSTA";
1032 	mesg[SIGKRSTA].pname = CSAVS(2, 103, "restart of kernel");
1033     }
1034 #endif
1035 #endif /* SIGKRSTA */
1036 
1037 #ifdef SIGXXMU
1038     /* SX-4 */
1039     if (mesg[SIGXXMU].pname == NULL) {
1040 	mesg[SIGXXMU].iname = "XXMU";
1041 	mesg[SIGXXMU].pname = CSAVS(2, 104, "exeeded XMU size limit");
1042     }
1043 #endif /* SIGXXMU */
1044 
1045 #ifdef SIGXRLG0
1046     /* SX-4 */
1047     if (mesg[SIGXRLG0].pname == NULL) {
1048 	mesg[SIGXRLG0].iname = "XRLG0";
1049 	mesg[SIGXRLG0].pname = CSAVS(2, 105, "exeeded RLG0 limit");
1050     }
1051 #endif /* SIGXRLG0 */
1052 
1053 #ifdef SIGXRLG1
1054     /* SX-4 */
1055     if (mesg[SIGXRLG1].pname == NULL) {
1056 	mesg[SIGXRLG1].iname = "XRLG1";
1057 	mesg[SIGXRLG1].pname = CSAVS(2, 106, "exeeded RLG1 limit");
1058     }
1059 #endif /* SIGXRLG1 */
1060 
1061 #ifdef SIGXRLG2
1062     /* SX-4 */
1063     if (mesg[SIGXRLG2].pname == NULL) {
1064 	mesg[SIGXRLG2].iname = "XRLG2";
1065 	mesg[SIGXRLG2].pname = CSAVS(2, 107, "exeeded RLG2 limit");
1066     }
1067 #endif /* SIGXRLG2 */
1068 
1069 #ifdef SIGXRLG3
1070     /* SX-4 */
1071     if (mesg[SIGXRLG3].pname == NULL) {
1072 	mesg[SIGXRLG3].iname = "XRLG3";
1073 	mesg[SIGXRLG3].pname = CSAVS(2, 108, "exeeded RLG3 limit");
1074     }
1075 #endif /* SIGXRLG3 */
1076 }
1077