|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T a
Length: 936 (0x3a8) Types: TextFile Names: »advfio.c«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987 └─⟦this⟧ »EUUGD18/General/Advsys/advfio.c«
/* advfio.c - file i/o routines for the adventure compiler */ /* Copyright (c) 1986, by David Michael Betz All rights reserved */ #define BSIZE 8192 /* global variables */ long ad_foff; /* external routines */ extern long lseek(); /* local variables */ static char buf[BSIZE]; static int boff; static int fd; ad_create(name) char *name; { /* create the file */ if ((fd = creat(name,0666)) < 0) fail("can't create output file"); /* initialize the buffer and file offset */ ad_foff = 0L; boff = 0; } ad_close() { ad_flush(); close(fd); } ad_putc(ch) int ch; { buf[boff++] = ch; ad_foff++; if (boff >= BSIZE) ad_flush(); } ad_seek(pos) long pos; { ad_flush(); if (lseek(fd,pos,0) != pos) fail("error positioning output file"); ad_foff = pos; } ad_flush() { if (boff) { if (write(fd,buf,boff) != boff) fail("error writing to output file"); boff = 0; } }