gdb-3.3
[binutils-gdb.git] / gdb / utils.c
1 /* General utility routines for GDB, the GNU debugger.
2 Copyright (C) 1986, 1989 Free Software Foundation, Inc.
3
4 This file is part of GDB.
5
6 GDB is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 1, or (at your option)
9 any later version.
10
11 GDB is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GDB; see the file COPYING. If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
19
20 #include <stdio.h>
21 #include <signal.h>
22 #include <sys/ioctl.h>
23 #include <sys/param.h>
24 #include <pwd.h>
25 #include "defs.h"
26 #include "param.h"
27 #ifdef HAVE_TERMIO
28 #include <termio.h>
29 #endif
30
31 /* If this definition isn't overridden by the header files, assume
32 that isatty and fileno exist on this system. */
33 #ifndef ISATTY
34 #define ISATTY(FP) (isatty (fileno (FP)))
35 #endif
36
37 void error ();
38 void fatal ();
39
40 /* Chain of cleanup actions established with make_cleanup,
41 to be executed if an error happens. */
42
43 static struct cleanup *cleanup_chain;
44
45 /* Nonzero means a quit has been requested. */
46
47 int quit_flag;
48
49 /* Nonzero means quit immediately if Control-C is typed now,
50 rather than waiting until QUIT is executed. */
51
52 int immediate_quit;
53 \f
54 /* Add a new cleanup to the cleanup_chain,
55 and return the previous chain pointer
56 to be passed later to do_cleanups or discard_cleanups.
57 Args are FUNCTION to clean up with, and ARG to pass to it. */
58
59 struct cleanup *
60 make_cleanup (function, arg)
61 void (*function) ();
62 int arg;
63 {
64 register struct cleanup *new
65 = (struct cleanup *) xmalloc (sizeof (struct cleanup));
66 register struct cleanup *old_chain = cleanup_chain;
67
68 new->next = cleanup_chain;
69 new->function = function;
70 new->arg = arg;
71 cleanup_chain = new;
72
73 return old_chain;
74 }
75
76 /* Discard cleanups and do the actions they describe
77 until we get back to the point OLD_CHAIN in the cleanup_chain. */
78
79 void
80 do_cleanups (old_chain)
81 register struct cleanup *old_chain;
82 {
83 register struct cleanup *ptr;
84 while ((ptr = cleanup_chain) != old_chain)
85 {
86 (*ptr->function) (ptr->arg);
87 cleanup_chain = ptr->next;
88 free (ptr);
89 }
90 }
91
92 /* Discard cleanups, not doing the actions they describe,
93 until we get back to the point OLD_CHAIN in the cleanup_chain. */
94
95 void
96 discard_cleanups (old_chain)
97 register struct cleanup *old_chain;
98 {
99 register struct cleanup *ptr;
100 while ((ptr = cleanup_chain) != old_chain)
101 {
102 cleanup_chain = ptr->next;
103 free (ptr);
104 }
105 }
106
107 /* Set the cleanup_chain to 0, and return the old cleanup chain. */
108 struct cleanup *
109 save_cleanups ()
110 {
111 struct cleanup *old_chain = cleanup_chain;
112
113 cleanup_chain = 0;
114 return old_chain;
115 }
116
117 /* Restore the cleanup chain from a previously saved chain. */
118 void
119 restore_cleanups (chain)
120 struct cleanup *chain;
121 {
122 cleanup_chain = chain;
123 }
124
125 /* This function is useful for cleanups.
126 Do
127
128 foo = xmalloc (...);
129 old_chain = make_cleanup (free_current_contents, &foo);
130
131 to arrange to free the object thus allocated. */
132
133 void
134 free_current_contents (location)
135 char **location;
136 {
137 free (*location);
138 }
139 \f
140 /* Generally useful subroutines used throughout the program. */
141
142 /* Like malloc but get error if no storage available. */
143
144 char *
145 xmalloc (size)
146 long size;
147 {
148 register char *val = (char *) malloc (size);
149 if (!val)
150 fatal ("virtual memory exhausted.", 0);
151 return val;
152 }
153
154 /* Like realloc but get error if no storage available. */
155
156 char *
157 xrealloc (ptr, size)
158 char *ptr;
159 long size;
160 {
161 register char *val = (char *) realloc (ptr, size);
162 if (!val)
163 fatal ("virtual memory exhausted.", 0);
164 return val;
165 }
166
167 /* Print the system error message for errno, and also mention STRING
168 as the file name for which the error was encountered.
169 Then return to command level. */
170
171 void
172 perror_with_name (string)
173 char *string;
174 {
175 extern int sys_nerr;
176 extern char *sys_errlist[];
177 extern int errno;
178 char *err;
179 char *combined;
180
181 if (errno < sys_nerr)
182 err = sys_errlist[errno];
183 else
184 err = "unknown error";
185
186 combined = (char *) alloca (strlen (err) + strlen (string) + 3);
187 strcpy (combined, string);
188 strcat (combined, ": ");
189 strcat (combined, err);
190
191 error ("%s.", combined);
192 }
193
194 /* Print the system error message for ERRCODE, and also mention STRING
195 as the file name for which the error was encountered. */
196
197 void
198 print_sys_errmsg (string, errcode)
199 char *string;
200 int errcode;
201 {
202 extern int sys_nerr;
203 extern char *sys_errlist[];
204 char *err;
205 char *combined;
206
207 if (errcode < sys_nerr)
208 err = sys_errlist[errcode];
209 else
210 err = "unknown error";
211
212 combined = (char *) alloca (strlen (err) + strlen (string) + 3);
213 strcpy (combined, string);
214 strcat (combined, ": ");
215 strcat (combined, err);
216
217 printf ("%s.\n", combined);
218 }
219
220 void
221 quit ()
222 {
223 #ifdef HAVE_TERMIO
224 ioctl (fileno (stdout), TCFLSH, 1);
225 #else /* not HAVE_TERMIO */
226 ioctl (fileno (stdout), TIOCFLUSH, 0);
227 #endif /* not HAVE_TERMIO */
228 #ifdef TIOCGPGRP
229 error ("Quit");
230 #else
231 error ("Quit (expect signal %d when inferior is resumed)", SIGINT);
232 #endif /* TIOCGPGRP */
233 }
234
235 /* Control C comes here */
236
237 void
238 request_quit ()
239 {
240 quit_flag = 1;
241
242 #ifdef USG
243 /* Restore the signal handler. */
244 signal (SIGINT, request_quit);
245 #endif
246
247 if (immediate_quit)
248 quit ();
249 }
250
251 /* Print an error message and return to command level.
252 STRING is the error message, used as a fprintf string,
253 and ARG is passed as an argument to it. */
254
255 void
256 error (string, arg1, arg2, arg3)
257 char *string;
258 int arg1, arg2, arg3;
259 {
260 terminal_ours (); /* Should be ok even if no inf. */
261 fflush (stdout);
262 fprintf (stderr, string, arg1, arg2, arg3);
263 fprintf (stderr, "\n");
264 return_to_top_level ();
265 }
266
267 /* Print an error message and exit reporting failure.
268 This is for a error that we cannot continue from.
269 STRING and ARG are passed to fprintf. */
270
271 void
272 fatal (string, arg)
273 char *string;
274 int arg;
275 {
276 fprintf (stderr, "gdb: ");
277 fprintf (stderr, string, arg);
278 fprintf (stderr, "\n");
279 exit (1);
280 }
281
282 /* Print an error message and exit, dumping core.
283 STRING is a printf-style control string, and ARG is a corresponding
284 argument. */
285 void
286 fatal_dump_core (string, arg)
287 char *string;
288 int arg;
289 {
290 fprintf (stderr, "gdb: ");
291 fprintf (stderr, string, arg);
292 fprintf (stderr, "\n");
293 signal (SIGQUIT, SIG_DFL);
294 kill (getpid (), SIGQUIT);
295 /* We should never get here, but just in case... */
296 exit (1);
297 }
298
299 /* Make a copy of the string at PTR with SIZE characters
300 (and add a null character at the end in the copy).
301 Uses malloc to get the space. Returns the address of the copy. */
302
303 char *
304 savestring (ptr, size)
305 char *ptr;
306 int size;
307 {
308 register char *p = (char *) xmalloc (size + 1);
309 bcopy (ptr, p, size);
310 p[size] = 0;
311 return p;
312 }
313
314 char *
315 concat (s1, s2, s3)
316 char *s1, *s2, *s3;
317 {
318 register int len = strlen (s1) + strlen (s2) + strlen (s3) + 1;
319 register char *val = (char *) xmalloc (len);
320 strcpy (val, s1);
321 strcat (val, s2);
322 strcat (val, s3);
323 return val;
324 }
325
326 void
327 print_spaces (n, file)
328 register int n;
329 register FILE *file;
330 {
331 while (n-- > 0)
332 fputc (' ', file);
333 }
334
335 /* Ask user a y-or-n question and return 1 iff answer is yes.
336 Takes three args which are given to printf to print the question.
337 The first, a control string, should end in "? ".
338 It should not say how to answer, because we do that. */
339
340 int
341 query (ctlstr, arg1, arg2)
342 char *ctlstr;
343 {
344 register int answer;
345
346 /* Automatically answer "yes" if input is not from a terminal. */
347 if (!input_from_terminal_p ())
348 return 1;
349
350 while (1)
351 {
352 printf (ctlstr, arg1, arg2);
353 printf ("(y or n) ");
354 fflush (stdout);
355 answer = fgetc (stdin);
356 clearerr (stdin); /* in case of C-d */
357 if (answer != '\n')
358 while (fgetc (stdin) != '\n') clearerr (stdin);
359 if (answer >= 'a')
360 answer -= 040;
361 if (answer == 'Y')
362 return 1;
363 if (answer == 'N')
364 return 0;
365 printf ("Please answer y or n.\n");
366 }
367 }
368 \f
369 /* Parse a C escape sequence. STRING_PTR points to a variable
370 containing a pointer to the string to parse. That pointer
371 is updated past the characters we use. The value of the
372 escape sequence is returned.
373
374 A negative value means the sequence \ newline was seen,
375 which is supposed to be equivalent to nothing at all.
376
377 If \ is followed by a null character, we return a negative
378 value and leave the string pointer pointing at the null character.
379
380 If \ is followed by 000, we return 0 and leave the string pointer
381 after the zeros. A value of 0 does not mean end of string. */
382
383 int
384 parse_escape (string_ptr)
385 char **string_ptr;
386 {
387 register int c = *(*string_ptr)++;
388 switch (c)
389 {
390 case 'a':
391 return '\a';
392 case 'b':
393 return '\b';
394 case 'e':
395 return 033;
396 case 'f':
397 return '\f';
398 case 'n':
399 return '\n';
400 case 'r':
401 return '\r';
402 case 't':
403 return '\t';
404 case 'v':
405 return '\v';
406 case '\n':
407 return -2;
408 case 0:
409 (*string_ptr)--;
410 return 0;
411 case '^':
412 c = *(*string_ptr)++;
413 if (c == '\\')
414 c = parse_escape (string_ptr);
415 if (c == '?')
416 return 0177;
417 return (c & 0200) | (c & 037);
418
419 case '0':
420 case '1':
421 case '2':
422 case '3':
423 case '4':
424 case '5':
425 case '6':
426 case '7':
427 {
428 register int i = c - '0';
429 register int count = 0;
430 while (++count < 3)
431 {
432 if ((c = *(*string_ptr)++) >= '0' && c <= '7')
433 {
434 i *= 8;
435 i += c - '0';
436 }
437 else
438 {
439 (*string_ptr)--;
440 break;
441 }
442 }
443 return i;
444 }
445 default:
446 return c;
447 }
448 }
449 \f
450 /* Print the character CH on STREAM as part of the contents
451 of a literal string whose delimiter is QUOTER. */
452
453 void
454 printchar (ch, stream, quoter)
455 unsigned char ch;
456 FILE *stream;
457 int quoter;
458 {
459 register int c = ch;
460 if (c < 040 || c >= 0177)
461 switch (c)
462 {
463 case '\n':
464 fputs_filtered ("\\n", stream);
465 break;
466 case '\b':
467 fputs_filtered ("\\b", stream);
468 break;
469 case '\t':
470 fputs_filtered ("\\t", stream);
471 break;
472 case '\f':
473 fputs_filtered ("\\f", stream);
474 break;
475 case '\r':
476 fputs_filtered ("\\r", stream);
477 break;
478 case '\033':
479 fputs_filtered ("\\e", stream);
480 break;
481 case '\007':
482 fputs_filtered ("\\a", stream);
483 break;
484 default:
485 fprintf_filtered (stream, "\\%.3o", (unsigned int) c);
486 break;
487 }
488 else
489 {
490 if (c == '\\' || c == quoter)
491 fputs_filtered ("\\", stream);
492 fprintf_filtered (stream, "%c", c);
493 }
494 }
495 \f
496 static int lines_per_page, lines_printed, chars_per_line, chars_printed;
497
498 /* Set values of page and line size. */
499 static void
500 set_screensize_command (arg, from_tty)
501 char *arg;
502 int from_tty;
503 {
504 char *p = arg;
505 char *p1;
506 int tolinesize = lines_per_page;
507 int tocharsize = chars_per_line;
508
509 if (p == 0)
510 error_no_arg ("set screensize");
511
512 while (*p >= '0' && *p <= '9')
513 p++;
514
515 if (*p && *p != ' ' && *p != '\t')
516 error ("Non-integral argument given to \"set screensize\".");
517
518 tolinesize = atoi (arg);
519
520 while (*p == ' ' || *p == '\t')
521 p++;
522
523 if (*p)
524 {
525 p1 = p;
526 while (*p1 >= '0' && *p1 <= '9')
527 p1++;
528
529 if (*p1)
530 error ("Non-integral second argument given to \"set screensize\".");
531
532 tocharsize = atoi (p);
533 }
534
535 lines_per_page = tolinesize;
536 chars_per_line = tocharsize;
537 }
538
539 static void
540 prompt_for_continue ()
541 {
542 immediate_quit++;
543 gdb_readline ("---Type <return> to continue---", 0);
544 chars_printed = lines_printed = 0;
545 immediate_quit--;
546 }
547
548 /* Reinitialize filter; ie. tell it to reset to original values. */
549
550 void
551 reinitialize_more_filter ()
552 {
553 lines_printed = 0;
554 chars_printed = 0;
555 }
556
557 static void
558 screensize_info (arg, from_tty)
559 char *arg;
560 int from_tty;
561 {
562 if (arg)
563 error ("\"info screensize\" does not take any arguments.");
564
565 if (!lines_per_page)
566 printf ("Output more filtering is disabled.\n");
567 else
568 {
569 printf ("Output more filtering is enabled with\n");
570 printf ("%d lines per page and %d characters per line.\n",
571 lines_per_page, chars_per_line);
572 }
573 }
574
575 /* Like fputs but pause after every screenful.
576 Unlike fputs, fputs_filtered does not return a value.
577 It is OK for LINEBUFFER to be NULL, in which case just don't print
578 anything.
579
580 Note that a longjmp to top level may occur in this routine
581 (since prompt_for_continue may do so) so this routine should not be
582 called when cleanups are not in place. */
583
584 void
585 fputs_filtered (linebuffer, stream)
586 char *linebuffer;
587 FILE *stream;
588 {
589 char *lineptr;
590
591 if (linebuffer == 0)
592 return;
593
594 /* Don't do any filtering if it is disabled. */
595 if (stream != stdout || !ISATTY(stdout) || lines_per_page == 0)
596 {
597 fputs (linebuffer, stream);
598 return;
599 }
600
601 /* Go through and output each character. Show line extension
602 when this is necessary; prompt user for new page when this is
603 necessary. */
604
605 lineptr = linebuffer;
606 while (*lineptr)
607 {
608 /* Possible new page. */
609 if (lines_printed >= lines_per_page - 1)
610 prompt_for_continue ();
611
612 while (*lineptr && *lineptr != '\n')
613 {
614 /* Print a single line. */
615 if (*lineptr == '\t')
616 {
617 putc ('\t', stream);
618 /* Shifting right by 3 produces the number of tab stops
619 we have already passed, and then adding one and
620 shifting left 3 advances to the next tab stop. */
621 chars_printed = ((chars_printed >> 3) + 1) << 3;
622 lineptr++;
623 }
624 else
625 {
626 putc (*lineptr, stream);
627 chars_printed++;
628 lineptr++;
629 }
630
631 if (chars_printed >= chars_per_line)
632 {
633 chars_printed = 0;
634 lines_printed++;
635 /* Possible new page. */
636 if (lines_printed >= lines_per_page - 1)
637 prompt_for_continue ();
638 }
639 }
640
641 if (*lineptr == '\n')
642 {
643 lines_printed++;
644 putc ('\n', stream);
645 lineptr++;
646 chars_printed = 0;
647 }
648 }
649 }
650
651 /* Print ARG1, ARG2, and ARG3 on stdout using format FORMAT. If this
652 information is going to put the amount written since the last call
653 to INIIALIZE_MORE_FILTER or the last page break over the page size,
654 print out a pause message and do a gdb_readline to get the users
655 permision to continue.
656
657 Unlike fprintf, this function does not return a value.
658
659 Note that this routine has a restriction that the length of the
660 final output line must be less than 255 characters *or* it must be
661 less than twice the size of the format string. This is a very
662 arbitrary restriction, but it is an internal restriction, so I'll
663 put it in. This means that the %s format specifier is almost
664 useless; unless the caller can GUARANTEE that the string is short
665 enough, fputs_filtered should be used instead.
666
667 Note also that a longjmp to top level may occur in this routine
668 (since prompt_for_continue may do so) so this routine should not be
669 called when cleanups are not in place. */
670
671 void
672 fprintf_filtered (stream, format, arg1, arg2, arg3, arg4, arg5, arg6)
673 FILE *stream;
674 char *format;
675 int arg1, arg2, arg3, arg4, arg5, arg6;
676 {
677 static char *linebuffer = (char *) 0;
678 static int line_size;
679 int format_length = strlen (format);
680 int numchars;
681
682 /* Allocated linebuffer for the first time. */
683 if (!linebuffer)
684 {
685 linebuffer = (char *) xmalloc (255);
686 line_size = 255;
687 }
688
689 /* Reallocate buffer to a larger size if this is necessary. */
690 if (format_length * 2 > line_size)
691 {
692 line_size = format_length * 2;
693
694 /* You don't have to copy. */
695 free (linebuffer);
696 linebuffer = (char *) xmalloc (line_size);
697 }
698
699 /* This won't blow up if the restrictions described above are
700 followed. */
701 (void) sprintf (linebuffer, format, arg1, arg2, arg3);
702
703 fputs_filtered (linebuffer, stream);
704 }
705
706 void
707 printf_filtered (format, arg1, arg2, arg3, arg4, arg5, arg6)
708 char *format;
709 int arg1, arg2, arg3, arg4, arg5, arg6;
710 {
711 fprintf_filtered (stdout, format, arg1, arg2, arg3, arg4, arg5, arg6);
712 }
713
714 /* Print N spaces. */
715 void
716 print_spaces_filtered (n, stream)
717 int n;
718 FILE *stream;
719 {
720 register char *s = (char *) alloca (n + 1);
721 register char *t = s;
722
723 while (n--)
724 *t++ = ' ';
725 *t = '\0';
726
727 fputs_filtered (s, stream);
728 }
729
730 \f
731 #ifdef USG
732 bcopy (from, to, count)
733 char *from, *to;
734 {
735 memcpy (to, from, count);
736 }
737
738 bcmp (from, to, count)
739 {
740 return (memcmp (to, from, count));
741 }
742
743 bzero (to, count)
744 char *to;
745 {
746 while (count--)
747 *to++ = 0;
748 }
749
750 getwd (buf)
751 char *buf;
752 {
753 getcwd (buf, MAXPATHLEN);
754 }
755
756 char *
757 index (s, c)
758 char *s;
759 {
760 char *strchr ();
761 return strchr (s, c);
762 }
763
764 char *
765 rindex (s, c)
766 char *s;
767 {
768 char *strrchr ();
769 return strrchr (s, c);
770 }
771
772 #ifndef USG
773 char *sys_siglist[32] = {
774 "SIG0",
775 "SIGHUP",
776 "SIGINT",
777 "SIGQUIT",
778 "SIGILL",
779 "SIGTRAP",
780 "SIGIOT",
781 "SIGEMT",
782 "SIGFPE",
783 "SIGKILL",
784 "SIGBUS",
785 "SIGSEGV",
786 "SIGSYS",
787 "SIGPIPE",
788 "SIGALRM",
789 "SIGTERM",
790 "SIGUSR1",
791 "SIGUSR2",
792 "SIGCLD",
793 "SIGPWR",
794 "SIGWIND",
795 "SIGPHONE",
796 "SIGPOLL",
797 };
798 #endif
799
800 /* Queue routines */
801
802 struct queue {
803 struct queue *forw;
804 struct queue *back;
805 };
806
807 insque (item, after)
808 struct queue *item;
809 struct queue *after;
810 {
811 item->forw = after->forw;
812 after->forw->back = item;
813
814 item->back = after;
815 after->forw = item;
816 }
817
818 remque (item)
819 struct queue *item;
820 {
821 item->forw->back = item->back;
822 item->back->forw = item->forw;
823 }
824 #endif /* USG */
825 \f
826 #ifdef USG
827 /* There is too much variation in Sys V signal numbers and names, so
828 we must initialize them at runtime. */
829 static char undoc[] = "(undocumented)";
830
831 char *sys_siglist[NSIG];
832 #endif /* USG */
833
834 extern struct cmd_list_element *setlist;
835
836 void
837 _initialize_utils ()
838 {
839 int i;
840 add_cmd ("screensize", class_support, set_screensize_command,
841 "Change gdb's notion of the size of the output screen.\n\
842 The first argument is the number of lines on a page.\n\
843 The second argument (optional) is the number of characters on a line.",
844 &setlist);
845 add_info ("screensize", screensize_info,
846 "Show gdb's current notion of the size of the output screen.");
847
848 /* These defaults will be used if we are unable to get the correct
849 values from termcap. */
850 lines_per_page = 24;
851 chars_per_line = 80;
852 /* Initialize the screen height and width from termcap. */
853 {
854 int termtype = getenv ("TERM");
855
856 /* Positive means success, nonpositive means failure. */
857 int status;
858
859 /* 2048 is large enough for all known terminals, according to the
860 GNU termcap manual. */
861 char term_buffer[2048];
862
863 if (termtype)
864 {
865 status = tgetent (term_buffer, termtype);
866 if (status > 0)
867 {
868 int val;
869
870 val = tgetnum ("li");
871 if (val >= 0)
872 lines_per_page = val;
873 else
874 /* The number of lines per page is not mentioned
875 in the terminal description. This probably means
876 that paging is not useful (e.g. emacs shell window),
877 so disable paging. */
878 lines_per_page = 0;
879
880 val = tgetnum ("co");
881 if (val >= 0)
882 chars_per_line = val;
883 }
884 }
885 }
886
887 #ifdef USG
888 /* Initialize signal names. */
889 for (i = 0; i < NSIG; i++)
890 sys_siglist[i] = undoc;
891
892 #ifdef SIGHUP
893 sys_siglist[SIGHUP ] = "SIGHUP";
894 #endif
895 #ifdef SIGINT
896 sys_siglist[SIGINT ] = "SIGINT";
897 #endif
898 #ifdef SIGQUIT
899 sys_siglist[SIGQUIT ] = "SIGQUIT";
900 #endif
901 #ifdef SIGILL
902 sys_siglist[SIGILL ] = "SIGILL";
903 #endif
904 #ifdef SIGTRAP
905 sys_siglist[SIGTRAP ] = "SIGTRAP";
906 #endif
907 #ifdef SIGIOT
908 sys_siglist[SIGIOT ] = "SIGIOT";
909 #endif
910 #ifdef SIGEMT
911 sys_siglist[SIGEMT ] = "SIGEMT";
912 #endif
913 #ifdef SIGFPE
914 sys_siglist[SIGFPE ] = "SIGFPE";
915 #endif
916 #ifdef SIGKILL
917 sys_siglist[SIGKILL ] = "SIGKILL";
918 #endif
919 #ifdef SIGBUS
920 sys_siglist[SIGBUS ] = "SIGBUS";
921 #endif
922 #ifdef SIGSEGV
923 sys_siglist[SIGSEGV ] = "SIGSEGV";
924 #endif
925 #ifdef SIGSYS
926 sys_siglist[SIGSYS ] = "SIGSYS";
927 #endif
928 #ifdef SIGPIPE
929 sys_siglist[SIGPIPE ] = "SIGPIPE";
930 #endif
931 #ifdef SIGALRM
932 sys_siglist[SIGALRM ] = "SIGALRM";
933 #endif
934 #ifdef SIGTERM
935 sys_siglist[SIGTERM ] = "SIGTERM";
936 #endif
937 #ifdef SIGUSR1
938 sys_siglist[SIGUSR1 ] = "SIGUSR1";
939 #endif
940 #ifdef SIGUSR2
941 sys_siglist[SIGUSR2 ] = "SIGUSR2";
942 #endif
943 #ifdef SIGCLD
944 sys_siglist[SIGCLD ] = "SIGCLD";
945 #endif
946 #ifdef SIGCHLD
947 sys_siglist[SIGCHLD ] = "SIGCHLD";
948 #endif
949 #ifdef SIGPWR
950 sys_siglist[SIGPWR ] = "SIGPWR";
951 #endif
952 #ifdef SIGTSTP
953 sys_siglist[SIGTSTP ] = "SIGTSTP";
954 #endif
955 #ifdef SIGTTIN
956 sys_siglist[SIGTTIN ] = "SIGTTIN";
957 #endif
958 #ifdef SIGTTOU
959 sys_siglist[SIGTTOU ] = "SIGTTOU";
960 #endif
961 #ifdef SIGSTOP
962 sys_siglist[SIGSTOP ] = "SIGSTOP";
963 #endif
964 #ifdef SIGXCPU
965 sys_siglist[SIGXCPU ] = "SIGXCPU";
966 #endif
967 #ifdef SIGXFSZ
968 sys_siglist[SIGXFSZ ] = "SIGXFSZ";
969 #endif
970 #ifdef SIGVTALRM
971 sys_siglist[SIGVTALRM ] = "SIGVTALRM";
972 #endif
973 #ifdef SIGPROF
974 sys_siglist[SIGPROF ] = "SIGPROF";
975 #endif
976 #ifdef SIGWINCH
977 sys_siglist[SIGWINCH ] = "SIGWINCH";
978 #endif
979 #ifdef SIGCONT
980 sys_siglist[SIGCONT ] = "SIGCONT";
981 #endif
982 #ifdef SIGURG
983 sys_siglist[SIGURG ] = "SIGURG";
984 #endif
985 #ifdef SIGIO
986 sys_siglist[SIGIO ] = "SIGIO";
987 #endif
988 #ifdef SIGWIND
989 sys_siglist[SIGWIND ] = "SIGWIND";
990 #endif
991 #ifdef SIGPHONE
992 sys_siglist[SIGPHONE ] = "SIGPHONE";
993 #endif
994 #ifdef SIGPOLL
995 sys_siglist[SIGPOLL ] = "SIGPOLL";
996 #endif
997 #endif /* USG */
998 }