]> diplodocus.org Git - nmh/blob - docs/historical/mh-6.8.5/sbr/RCS/pidstatus.c,v
Exposed a bunch of switches that are now documented.
[nmh] / docs / historical / mh-6.8.5 / sbr / RCS / pidstatus.c,v
1 head 1.4;
2 access;
3 symbols;
4 locks; strict;
5 comment @ * @;
6
7
8 1.4
9 date 93.02.26.21.57.34; author jromine; state Exp;
10 branches;
11 next 1.3;
12
13 1.3
14 date 92.12.15.00.20.22; author jromine; state Exp;
15 branches;
16 next 1.2;
17
18 1.2
19 date 92.12.14.17.47.34; author jromine; state Exp;
20 branches;
21 next 1.1;
22
23 1.1
24 date 92.12.14.17.44.38; author jromine; state Exp;
25 branches;
26 next ;
27
28
29 desc
30 @@
31
32
33 1.4
34 log
35 @BSd44
36 @
37 text
38 @/* pidstatus.c - report child's status */
39 #ifndef lint
40 static char ident[] = "@@(#)$Id: pidstatus.c,v 1.3 1992/12/15 00:20:22 jromine Exp jromine $";
41 #endif /* lint */
42
43 #include "../h/mh.h"
44 #include <signal.h>
45 #include <stdio.h>
46
47
48 #ifndef BSD44
49 #ifndef BSD42
50 static char *sigs[] = {
51 NULL,
52 "Hangup",
53 "Interrupt",
54 "Quit",
55 "Illegal instruction",
56 "Trace/BPT trap",
57 "IOT trap",
58 "EMT trap",
59 "Floating exception",
60 "Killed",
61 "Bus error",
62 "Segmentation fault",
63 "Bad system call",
64 "Broken pipe",
65 "Alarm clock",
66 "Terminated",
67 #ifdef SIGURG
68 "Urgent I/O condition",
69 #else
70 NULL,
71 #endif
72 "Stopped (signal)",
73 "Stopped",
74 "Continued",
75 "Child exited",
76 "Stopped (tty input)",
77 "Stopped (tty output)",
78 "Tty input interrupt",
79 "Cputime limit exceeded",
80 "Filesize limit exceeded",
81 NULL
82 };
83 #else
84 extern char *sys_siglist[];
85 #endif /* BSD42 */
86 #endif /* BSD44 defines sys_siglist in signal.h */
87
88 /* \f */
89
90 int pidstatus (status, fp, cp)
91 register int status;
92 register FILE *fp;
93 register char *cp;
94 {
95 int signum;
96
97 if ((status & 0xff00) == 0xff00)
98 return status;
99
100 switch (signum = status & 0x007f) {
101 case OK:
102 if (signum = ((status & 0xff00) >> 8)) {
103 if (cp)
104 fprintf (fp, "%s: ", cp);
105 fprintf (fp, "Exit %d\n", signum);
106 }
107 break;
108
109 case SIGINT:
110 break;
111
112 default:
113 if (cp)
114 fprintf (fp, "%s: ", cp);
115 #ifndef BSD42
116 if (signum >= sizeof sigs || sigs[signum] == NULL)
117 fprintf (fp, "Signal %d", signum);
118 else
119 fprintf (fp, "%s", sigs[signum]);
120 #else /* BSD42 */
121 if (signum >= NSIG)
122 fprintf (fp, "Signal %d", signum);
123 else
124 fprintf (fp, "%s", sys_siglist[signum]);
125 #endif /* BSD42 */
126 fprintf (fp, "%s\n", status & 0x80 ? " (core dumped)" : "");
127 break;
128 }
129
130 return status;
131 }
132 @
133
134
135 1.3
136 log
137 @endif sugar
138 @
139 text
140 @d3 1
141 a3 1
142 static char ident[] = "@@(#)$Id: pidstatus.c,v 1.2 1992/12/14 17:47:34 jromine Exp jromine $";
143 d11 1
144 d49 1
145 @
146
147
148 1.2
149 log
150 @add id
151 @
152 text
153 @d3 1
154 a3 1
155 static char ident[] = "@@(#)$Id: pidwait.c,v 1.9 1992/12/14 17:10:58 jromine Exp $";
156 d47 1
157 a47 1
158 #endif BSD42
159 d81 1
160 a81 1
161 #else BSD42
162 d86 1
163 a86 1
164 #endif BSD42
165 @
166
167
168 1.1
169 log
170 @Initial revision
171 @
172 text
173 @d2 3
174 @