|
|
1.1 root 1: /* showfile.c - invoke lproc */
2:
3: #include "../h/mh.h"
4: #include <stdio.h>
5:
6:
7: showfile (arg, file)
8: register char **arg,
9: *file;
10: {
11: int isdraft,
12: pid;
13: register int vecp;
14: char *vec[MAXARGS];
15:
16: m_update ();
17: (void) fflush (stdout);
18:
19: if (strcmp (r1bindex (lproc, '/'), "mhl") == 0)
20: lproc = mhlproc;
21:
22: switch (pid = vfork ()) {
23: case NOTOK:
24: advise ("fork", "unable to");
25: return 1;
26:
27: case OK:
28: vecp = 0;
29: vec[vecp++] = r1bindex (lproc, '/');
30: isdraft = 1;
31: if (arg)
32: while (*arg) {
33: if (**arg != '-')
34: isdraft = 0;
35: vec[vecp++] = *arg++;
36: }
37: if (isdraft) {
38: if (strcmp (vec[0], "show") == 0)
39: vec[vecp++] = "-file";
40: vec[vecp++] = file;
41: }
42: vec[vecp] = NULL;
43:
44: execvp (lproc, vec);
45: fprintf (stderr, "unable to exec ");
46: perror (lproc);
47: _exit (-1);
48:
49: default:
50: return (pidwait (pid, NOTOK) & 0377 ? 1 : 0);
51: }
52: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.