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