1: /* Copyright (c) 1979 Regents of the University of California */
   2: 
   3: static char sccsid[] = "@(#)RESET.c 1.8 2/19/86";
   4: 
   5: #include "h00vars.h"
   6: 
   7: RESET(filep, name, maxnamlen, datasize)
   8: 
   9:     register struct iorec   *filep;
  10:     char            *name;
  11:     long            maxnamlen;
  12:     long            datasize;
  13: {
  14:     if (name == NULL && filep == INPUT && filep->fname[0] == '\0') {
  15:         if (fseek(filep->fbuf, (long)0, 0) == -1) {
  16:             PERROR("Could not reset ", filep->pfname);
  17:             return;
  18:         }
  19:         filep->funit &= ~EOFF;
  20:         filep->funit |= (SYNC | EOLN);
  21:         return;
  22:     }
  23:     filep = GETNAME(filep, name, maxnamlen, datasize);
  24:     filep->fbuf = fopen(filep->fname, "r");
  25:     if (filep->fbuf == NULL) {
  26:         /*
  27: 		 * This allows unnamed temp files to be opened even if
  28: 		 * they have not been rewritten yet. We decided to remove
  29: 		 * this feature since the standard requires that files be
  30: 		 * defined before being reset.
  31: 		 *
  32: 		if (filep->funit & TEMP) {
  33: 			filep->funit |= (EOFF | SYNC | FREAD);
  34: 			return;
  35: 		}
  36: 		 */
  37:         PERROR("Could not open ", filep->pfname);
  38:         return;
  39:     }
  40:     filep->funit |= (SYNC | FREAD);
  41:     if (filep->funit & FTEXT)
  42:         filep->funit |= EOLN;
  43:     if (filep->fblk > PREDEF) {
  44:         setbuf(filep->fbuf, &filep->buf[0]);
  45:     }
  46: }

Defined functions

RESET defined in line 7; used 2 times

Defined variables

sccsid defined in line 3; never used
Last modified: 1986-02-19
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 966
Valid CSS Valid XHTML 1.0 Strict