]>
diplodocus.org Git - nmh/blob - sbr/showfile.c
1 /* showfile.c -- invoke the `lproc' command
3 * This code is Copyright (c) 2002, by the authors of nmh. See the
4 * COPYRIGHT file in the root directory of the nmh distribution for
5 * complete copyright information.
12 showfile (char **arg
, char *file
)
19 context_save(); /* save the context file */
23 * If you have your lproc listed as "mhl",
24 * then really invoked the mhlproc instead
25 * (which is usually mhl anyway).
27 if (!strcmp (r1bindex (lproc
, '/'), "mhl"))
30 switch (pid
= fork()) {
33 advise ("fork", "unable to");
38 vec
= argsplit(lproc
, &program
, &vecp
);
48 if (!strcmp (vec
[0], "show"))
49 vec
[vecp
++] = "-file";
54 execvp (program
, vec
);
55 fprintf (stderr
, "unable to exec ");
61 retval
= pidwait (pid
, -1) & 0377 ? 1 : 0;