1: #ifndef lint
   2: static char *sccsid = "@(#)deliv1.c	4.1 (Berkeley) 5/6/83";
   3: #endif
   4: 
   5: #include <stdio.h>
   6: 
   7: main(argc, argv)    /* goes from file:begin,l to actual characters */
   8: char *argv[];
   9: {
  10:     FILE *fopen(), *fa = NULL;
  11:     char line[750], *p, name[100], *strcpy();
  12:     long lp;
  13:     int len;
  14: 
  15:     if (argc > 1 && argv[1] && argv[1][0])
  16:         chdir(argv[1]);
  17:     name[0] = NULL;
  18:     while (gets(line))
  19:     {
  20:         if (line[0] == '$' && line[1] == '$')
  21:         {
  22:             chdir(line+2);
  23:             continue;
  24:         }
  25:         for (p = line; *p != ':'; p++)
  26:             ;
  27:         *p++ = 0;
  28:         sscanf(p, "%ld,%d", &lp, &len);
  29:         if (p == line)
  30:             fa = stdin;
  31:         else
  32:             if (strcmp(name, line) != 0)
  33:             {
  34:                 if (fa != NULL)
  35:                     fclose(fa);
  36:                 fa = fopen(line, "r");
  37:                 if (fa == NULL)
  38:                     err("Can't open %s", line);
  39:                 strcpy(name, line);
  40:             }
  41:         if (fa != NULL)
  42:         {
  43:             fseek (fa, lp, 0);
  44:             fread (line, 1, len, fa);
  45:             line[len] = 0;
  46:             fputs(line, stdout);
  47:         }
  48:     }
  49: }

Defined functions

main defined in line 7; never used

Defined variables

sccsid defined in line 2; never used
Last modified: 1987-02-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2300
Valid CSS Valid XHTML 1.0 Strict