date and time created 80/10/30 00:35:27 by mckusick
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Thu, 30 Oct 1980 16:35:27 +0000 (08:35 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Thu, 30 Oct 1980 16:35:27 +0000 (08:35 -0800)
SCCS-vsn: usr.bin/pascal/libpc/REWRITE.c 1.1

usr/src/usr.bin/pascal/libpc/REWRITE.c [new file with mode: 0644]

diff --git a/usr/src/usr.bin/pascal/libpc/REWRITE.c b/usr/src/usr.bin/pascal/libpc/REWRITE.c
new file mode 100644 (file)
index 0000000..2db9639
--- /dev/null
@@ -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]);
+       }
+}