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