|
|
1.1 root 1: #include <stdio.h>
2:
3: int dbg;
4: int jpflag;
5:
6: main(argc, argv)
7: char *argv[];
8: {
9: FILE *pfp, *f, *popen();
10: int c;
11: char buf[100], fname[100], *whichjerq, cmd[100];
12: char *getenv();
13:
14: whichjerq = getenv("JERQ");
15: while (argc > 1 && argv[1][0] == '-') {
16: switch (argv[1][1]) {
17: case 'd':
18: dbg = 1;
19: break;
20: case 'j':
21: jpflag = 1;
22: break;
23: }
24: argc--;
25: argv++;
26: }
27: if (argc > 1)
28: strcpy(fname, argv[1]);
29: if (jpflag == 0)
30: system("run /usr/bwk/pic/jp");
31: sprintf(cmd, "/usr/bwk/pic/pic >/dev/%s", whichjerq);
32: if ((pfp = popen(cmd, "w")) == NULL) {
33: fprintf(stderr, "epic: can't open pic\n");
34: exit(2);
35: }
36: while (fgets(buf, sizeof buf, stdin) != NULL) {
37: switch (buf[0]) {
38: case 'q':
39: exit(0);
40: break;
41: case '\n':
42: case 'p':
43: f = fopen(fname, "r");
44: while ((c = getc(f)) != EOF)
45: putc(c, pfp);
46: fflush(pfp);
47: fclose(f);
48: break;
49: case 'e':
50: if (sscanf(buf, "%*s %s", fname) > 0)
51: printf("editing file %s\n", fname);
52: else
53: sprintf(buf, "e %s", fname);
54: system(buf);
55: break;
56: case 'f':
57: sscanf(buf, "%*s %s", fname);
58: printf("%s\n", fname);
59: break;
60: case '!':
61: system(buf+1);
62: printf("!\n");
63: break;
64: default:
65: printf("eh?\n");
66: break;
67: }
68: }
69: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.