From b184a153d4f526cbdf024290635faa5f5cbbb32d Mon Sep 17 00:00:00 2001 From: Kirk McKusick Date: Thu, 30 Oct 1980 08:35:27 -0800 Subject: [PATCH 1/1] date and time created 80/10/30 00:35:27 by mckusick SCCS-vsn: usr.bin/pascal/libpc/REWRITE.c 1.1 --- usr/src/usr.bin/pascal/libpc/REWRITE.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 usr/src/usr.bin/pascal/libpc/REWRITE.c diff --git a/usr/src/usr.bin/pascal/libpc/REWRITE.c b/usr/src/usr.bin/pascal/libpc/REWRITE.c new file mode 100644 index 0000000000..2db963912d --- /dev/null +++ b/usr/src/usr.bin/pascal/libpc/REWRITE.c @@ -0,0 +1,25 @@ +/* Copyright (c) 1979 Regents of the University of California */ + +static char sccsid[] = "@(#)REWRITE.c 1.1 %G%"; + +#include "h00vars.h" +#include "h01errs.h" + +REWRITE(filep, name, maxnamlen, datasize) + + register struct iorec *filep; + char *name; + int maxnamlen; + int datasize; +{ + filep = GETNAME (filep, name, maxnamlen, datasize); + filep->fbuf = fopen(filep->fname, "w"); + if (filep->fbuf == NULL) { + ERROR(ECREATE, filep->pfname); + return; + } + filep->funit |= (EOFF | FWRITE); + if (filep->fblk > PREDEF) { + setbuf(filep->fbuf, &filep->buf[0]); + } +} -- 2.20.1