Revision 12283,
910 bytes
checked in by ghudson, 26 years ago
(diff) |
Move here from athena/bin/dash/src/xcluster and autoconfiscate.
|
Line | |
---|
1 | #include <string.h> |
---|
2 | #include <stdio.h> |
---|
3 | #include <sys/types.h> |
---|
4 | #include "net.h" |
---|
5 | |
---|
6 | /* |
---|
7 | * MAIN PROGRAM |
---|
8 | */ |
---|
9 | |
---|
10 | void main(argc, argv) |
---|
11 | int argc; |
---|
12 | char **argv; |
---|
13 | { |
---|
14 | FILE *f; /* stream for reading data from cviewd. */ |
---|
15 | int s; /* socket returned from "net". */ |
---|
16 | char buf[1024]; /* Temporary buffer. */ |
---|
17 | char *progname; /* Name of program from command-line. */ |
---|
18 | |
---|
19 | progname = strrchr(argv[0], '/'); |
---|
20 | if(progname == (char *) NULL) |
---|
21 | progname = argv[0]; /* Find out what our name is today. */ |
---|
22 | if(*progname == '/') /* Useful for being able to print error */ |
---|
23 | ++progname; /* messages and the like. */ |
---|
24 | |
---|
25 | argc--; /* decrement number of args to pass */ |
---|
26 | argv++; /* and increment counter into command-line */ |
---|
27 | |
---|
28 | s = net(progname, argc, argv); |
---|
29 | |
---|
30 | if (s > 0) |
---|
31 | { |
---|
32 | f = fdopen(s, "r"); |
---|
33 | |
---|
34 | while(fgets(buf, 1024, f) != NULL) |
---|
35 | printf("%s", buf); |
---|
36 | |
---|
37 | (void) fclose(f); |
---|
38 | } |
---|
39 | |
---|
40 | exit(0); |
---|
41 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.