]>
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.
11 #include "context_save.h"
17 showfile (char **arg
, char *file
)
24 context_save(); /* save the context file */
28 * If you have your lproc listed as "mhl",
29 * then really invoked the mhlproc instead
30 * (which is usually mhl anyway).
32 if (!strcmp (r1bindex (lproc
, '/'), "mhl"))
35 switch (pid
= fork()) {
38 advise ("fork", "unable to");
43 vec
= argsplit(lproc
, &program
, &vecp
);
53 if (!strcmp (vec
[0], "show"))
54 vec
[vecp
++] = "-file";
59 execvp (program
, vec
);
60 fprintf (stderr
, "unable to exec ");
66 retval
= pidwait (pid
, -1) & 0377 ? 1 : 0;