Revision 12459,
708 bytes
checked in by danw, 26 years ago
(diff) |
comment out text after #else and #endif
|
Line | |
---|
1 | /* |
---|
2 | * Pager: Routines to create a "more" running out of a particular file |
---|
3 | * descriptor. |
---|
4 | */ |
---|
5 | #ifndef lint |
---|
6 | static char *rcsid_discuss_c = "$Id: pager.c,v 1.4 1999-02-08 14:46:52 danw Exp $"; |
---|
7 | #endif /* lint */ |
---|
8 | |
---|
9 | #include <stdio.h> |
---|
10 | |
---|
11 | int pager_create() |
---|
12 | { |
---|
13 | int filedes[2]; |
---|
14 | int i; |
---|
15 | if(pipe(filedes) != 0) return(-1); |
---|
16 | |
---|
17 | switch(fork()) { |
---|
18 | case -1: |
---|
19 | return(-1); |
---|
20 | case 0: |
---|
21 | /* |
---|
22 | * Child; dup read half to 0, close all but 0, 1, and 2 |
---|
23 | */ |
---|
24 | (void) dup2(filedes[0], 0); |
---|
25 | for (i=3; i<32; i++) |
---|
26 | (void) close(i); |
---|
27 | (void) execlp("more", "more", (char *) NULL); |
---|
28 | exit(1); |
---|
29 | default: |
---|
30 | /* |
---|
31 | * Parent: close "read" side of pipe, return |
---|
32 | * "write" side. |
---|
33 | */ |
---|
34 | (void) close(filedes[0]); |
---|
35 | return(filedes[1]); |
---|
36 | } |
---|
37 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.