]> diplodocus.org Git - nmh/blob - docs/historical/mh-nov-1983/subs/showfile.c
Update XOAUTH2 documentation.
[nmh] / docs / historical / mh-nov-1983 / subs / showfile.c
1 #include "mh.h"
2 #include <signal.h>
3 #include <stdio.h>
4
5 showfile(file)
6 char *file;
7 {
8 int pid, wpid, intr, status;
9 char *vec[4];
10
11 intr = (int) signal(SIGINT, SIG_IGN);
12 m_update();
13 fflush(stdout);
14 if((pid = fork()) == 0) {
15 vec[0] = "mh-type";
16 vec[1] = file;
17 vec[2] = 0;
18 signal(SIGINT, (int (*)()) intr);
19 execv(showproc, vec);
20 perror("Can't exec showproc");
21 goto badleave;
22 } else if(pid == -1) {
23 fprintf(stderr, "No forks!\n");
24 goto badleave;
25 } else
26 while((wpid = wait(&status)) != -1 && wpid != pid) ;
27 signal(SIGINT, (int (*)()) intr);
28 if(status & 0377)
29 goto badleave;
30 return(0);
31
32 badleave:
33 fflush(stdout);
34 return(1);
35
36 }
37