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