|
|
1.1 root 1: #include "stdio.h"
2:
3: main(argc,argv)
4: char *argv[];
5: {
6: /* goes from file:begin,l to actual characters */
7: char line[750], *p, name[100];
8: FILE *fa = NULL;
9: long lp;
10: int len;
11:
12: if (argc>1 && argv[1] && argv[1][0])
13: chdir (argv[1]);
14: name[0]='\0';
15: while (gets(line))
16: {
17: if (line[0]=='$' && line[1]=='$')
18: {
19: chdir(line+2);
20: continue;
21: }
22: for(p=line; *p!= ':'; p++)
23: ;
24: *p++ = 0;
25: sscanf(p, "%ld,%d", &lp, &len);
26: if (p==line)
27: fa = stdin;
28: else
29: if (strcmp (name, line) != 0)
30: {
31: if (fa != NULL)
32: fclose(fa);
33: fa = fopen(line, "r");
34: if (fa == NULL)
35: err("Can't open %s", line);
36: strcpy(name, line);
37: }
38: if (fa != NULL)
39: {
40: fseek (fa, lp, 0);
41: fread (line, 1, len, fa);
42: line[len] = 0;
43: fputs(line, stdout);
44: }
45: }
46: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.