]> diplodocus.org Git - nmh/blob - docs/historical/mh-6.8.5/uip/RCS/mhparam.c,v
Always check that mktemp()/mktemp2() succeeds before trying to
[nmh] / docs / historical / mh-6.8.5 / uip / RCS / mhparam.c,v
1 head 1.9;
2 access;
3 symbols;
4 locks; strict;
5 comment @ * @;
6
7
8 1.9
9 date 93.09.01.23.00.59; author jromine; state Exp;
10 branches;
11 next 1.8;
12
13 1.8
14 date 93.09.01.22.50.54; author jromine; state Exp;
15 branches;
16 next 1.7;
17
18 1.7
19 date 92.12.15.00.20.22; author jromine; state Exp;
20 branches;
21 next 1.6;
22
23 1.6
24 date 92.11.16.22.26.50; author jromine; state Exp;
25 branches;
26 next 1.5;
27
28 1.5
29 date 92.10.27.16.44.07; author jromine; state Exp;
30 branches;
31 next 1.4;
32
33 1.4
34 date 92.05.19.21.06.11; author jromine; state Exp;
35 branches;
36 next 1.3;
37
38 1.3
39 date 92.02.09.22.28.58; author jromine; state Exp;
40 branches;
41 next 1.2;
42
43 1.2
44 date 92.02.06.17.12.41; author jromine; state Exp;
45 branches;
46 next 1.1;
47
48 1.1
49 date 92.02.06.17.11.53; author jromine; state Exp;
50 branches;
51 next ;
52
53
54 desc
55 @contributed by Jeffrey C Honig <jch@@risci.tn.cornell.EDU>
56 @
57
58
59 1.9
60 log
61 @add sbackup (SBACKUP=",") link (LINK="@@")
62 @
63 text
64 @/* mhparam.c - print mh_profile values */
65 #ifndef lint
66 static char ident[] = "@@(#)$Id: mhparam.c,v 1.8 1993/09/01 22:50:54 jromine Exp jromine $";
67 #endif /* lint */
68 /* contributed by Jeffrey C Honig <Jeffrey_C_Honig@@cornell.edu> */
69
70 #include "../h/mh.h"
71 #include <stdio.h>
72
73 extern char *mhlibdir; /* NB: this will change soon */
74 char *sbackup = SBACKUP;
75 char *slink = LINK;
76
77 /* \f */
78
79 static struct swit switches[] = {
80 #define COMPSW 0
81 "components", 0,
82 #define NCOMPSW 1
83 "nocomponents", 0,
84 #define ALLSW 2
85 "all", 0,
86 #define HELPSW 3
87 "help", 4,
88
89 NULL, 0
90 };
91
92 static char *p_find();
93
94 /* \f */
95
96 /* ARGSUSED */
97
98 main(argc, argv)
99 int argc;
100 char *argv[];
101 {
102 int i,
103 all = 0,
104 compp = 0,
105 components = -1,
106 missed = 0;
107 char *cp,
108 buf[100],
109 **ap,
110 **argp,
111 *arguments[MAXARGS],
112 *comps[MAXARGS];
113
114 invo_name = r1bindex (argv[0], '/');
115 if ((cp = m_find (invo_name)) != NULL) {
116 ap = brkstring (cp = getcpy (cp), " ", "\n");
117 ap = copyip (ap, arguments);
118 }
119 else
120 ap = arguments;
121 (void) copyip (argv + 1, ap);
122 argp = arguments;
123
124 /* \f */
125
126 while (cp = *argp++) {
127 if (*cp == '-')
128 switch (smatch (++cp, switches)) {
129 case AMBIGSW:
130 ambigsw (cp, switches);
131 done (1);
132 case UNKWNSW:
133 adios (NULLCP, "-%s unknown", cp);
134 case HELPSW:
135 (void) sprintf (buf, "%s [profile-components] [switches]",
136 invo_name);
137 help (buf, switches);
138 done (1);
139
140 case COMPSW:
141 components = 1;
142 break;
143 case NCOMPSW:
144 components = 0;
145 break;
146
147 case ALLSW:
148 all = 1;
149 break;
150
151 }
152 else
153 comps[compp++] = cp;
154 }
155
156 /* \f */
157
158 if (all) {
159 register struct node *np;
160
161 if (compp)
162 advise(NULLCP, "profile-components ignored with -all");
163
164 if (components >= 0)
165 advise(NULLCP, "-%scomponents ignored with -all",
166 components ? "" : "no");
167
168 m_getdefs ();
169 for (np = m_defs; np; np = np -> n_next)
170 printf("%s:\t%s\n", np -> n_name, np -> n_field);
171 } else {
172 if (components < 0)
173 components = compp > 1;
174
175 for (i = 0; i < compp; i++) {
176 register char *value = m_find(comps[i]);
177
178 if (!value)
179 value = p_find(comps[i]);
180
181 if (value) {
182 if (components)
183 printf("%s:\t", comps[i]);
184
185 printf("%s\n", value);
186 } else
187 missed++;
188 }
189 }
190
191 done (missed);
192 }
193
194 static struct procs {
195 char *p_name;
196 char **p_field;
197 } procs [] = {
198 { "context", &context },
199 { "faceproc", &faceproc },
200 { "fileproc", &fileproc },
201 { "foldprot", &foldprot },
202 { "incproc", &incproc },
203 { "installproc", &installproc },
204 { "lproc", &lproc },
205 { "mailproc", &mailproc },
206 { "mhlproc", &mhlproc },
207 { "moreproc", &moreproc },
208 { "msgprot", &msgprot },
209 { "mshproc", &mshproc },
210 { "packproc", &packproc },
211 { "postproc", &postproc },
212 { "rmfproc", &rmfproc },
213 { "rmmproc", &rmmproc },
214 { "sendproc", &sendproc },
215 { "showproc", &showproc },
216 { "slocalproc", &slocalproc },
217 { "version", &version },
218 { "vmhproc", &vmhproc },
219 { "whatnowproc", &whatnowproc },
220 { "whomproc", &whomproc },
221 { "libdir", &mhlibdir },
222 { "sbackup", &sbackup },
223 { "link", &slink },
224
225 { NULL, NULL },
226 };
227
228 static char *p_find(str)
229 register char *str;
230 {
231 register struct procs *ps;
232
233 for (ps = procs; ps->p_name; ps++)
234 if (uleq (ps -> p_name, str))
235 return (*ps -> p_field);
236
237 return NULL;
238 }
239 @
240
241
242 1.8
243 log
244 @add "libdir" -- note: this is subject to change
245 @
246 text
247 @d3 1
248 a3 1
249 static char ident[] = "@@(#)$Id: mhparam.c,v 1.7 1992/12/15 00:20:22 jromine Exp jromine $";
250 d11 2
251 d159 3
252 @
253
254
255 1.7
256 log
257 @endif sugar
258 @
259 text
260 @d3 1
261 a3 1
262 static char ident[] = "@@(#)$Id: mhparam.c,v 1.6 1992/11/16 22:26:50 jromine Exp jromine $";
263 d10 2
264 d156 1
265 @
266
267
268 1.6
269 log
270 @lookup "procs" as well as profile-components
271 @
272 text
273 @d3 2
274 a4 2
275 static char ident[] = "@@(#)$Id: mhparam.c,v 1.5 1992/10/27 16:44:07 jromine Exp jromine $";
276 #endif lint
277 @
278
279
280 1.5
281 log
282 @change jch e-mail address
283 @
284 text
285 @d3 1
286 a3 1
287 static char ident[] = "@@(#)$Id: mhparam.c,v 1.4 1992/05/19 21:06:11 jromine Exp jromine $";
288 d25 2
289 d111 3
290 d125 42
291 @
292
293
294 1.4
295 log
296 @AIX
297 @
298 text
299 @d3 1
300 a3 1
301 static char ident[] = "@@(#)$Id: mhparam.c,v 1.3 1992/02/09 22:28:58 jromine Exp jromine $";
302 d5 1
303 a5 1
304 /* contributed by Jeffrey C Honig <jch@@risci.tn.cornell.EDU> */
305 @
306
307
308 1.3
309 log
310 @re-order switches
311 @
312 text
313 @d3 1
314 a3 1
315 static char ident[] = "@@(#)$Id: mhparam.c,v 1.2 1992/02/06 17:12:41 jromine Exp jromine $";
316 d22 1
317 a22 1
318 NULL, NULL
319 @
320
321
322 1.2
323 log
324 @add by-line
325 @
326 text
327 @d3 1
328 a3 1
329 static char ident[] = "@@(#)$Id: mhparam.c,v 1.1 1992/02/06 17:11:53 jromine Exp jromine $";
330 d13 1
331 a13 4
332 #define HELPSW 0
333 "help", 4,
334
335 #define COMPSW 1
336 d15 1
337 a15 1
338 #define NCOMPSW 2
339 d17 1
340 a17 2
341
342 #define ALLSW 3
343 d19 2
344 @
345
346
347 1.1
348 log
349 @Initial revision
350 @
351 text
352 @d3 1
353 a3 1
354 static char ident[] = "@@(#)$Id: scan.c,v 1.13 1992/02/05 22:50:17 jromine Exp jromine $";
355 d5 1
356 @