|
|
1.1 ! root 1: /* ! 2: char id_endfile[] = "@(#)endfile.c 1.7"; ! 3: * ! 4: * endfile ! 5: */ ! 6: ! 7: #include "fio.h" ! 8: ! 9: static char endf[] = "endfile"; ! 10: ! 11: f_end (a) ! 12: alist *a; ! 13: { ! 14: unit *b; ! 15: ! 16: lfname = NULL; ! 17: elist = NO; ! 18: errflag = a->aerr; ! 19: lunit = a->aunit; ! 20: if (not_legal(lunit)) ! 21: err (errflag, F_ERUNIT, endf) ! 22: b = &units[lunit]; ! 23: if (!b->ufd) ! 24: err (errflag, F_ERNOPEN, endf) ! 25: if (b->uend) ! 26: return(0); ! 27: lfname = b->ufnm; ! 28: b->uend = YES; ! 29: return ( t_runc (b, errflag, endf) ); ! 30: } ! 31: ! 32: t_runc (b, flag, str) ! 33: unit *b; ! 34: ioflag flag; ! 35: char *str; ! 36: { ! 37: long loc; ! 38: ! 39: if (b->uwrt) ! 40: fflush (b->ufd); ! 41: if (b->url || !b->useek || !b->ufnm) ! 42: return (OK); /* don't truncate direct access files, etc. */ ! 43: loc = ftell (b->ufd); ! 44: if (truncate (b->ufnm, loc) != 0) ! 45: err (flag, errno, str) ! 46: if (b->uwrt && ! nowreading(b)) ! 47: err (flag, errno, str) ! 48: return (OK); ! 49: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.