From fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 8 Jul 2015 20:46:52 -0400 Subject: Initial commit --- sys/fio/fmkpbbuf.x | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 sys/fio/fmkpbbuf.x (limited to 'sys/fio/fmkpbbuf.x') diff --git a/sys/fio/fmkpbbuf.x b/sys/fio/fmkpbbuf.x new file mode 100644 index 00000000..ee891949 --- /dev/null +++ b/sys/fio/fmkpbbuf.x @@ -0,0 +1,34 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include +include + +# FMKPBBUF -- Make the push back buffer. Called when the first attempt is +# made to push data back into an input stream. + +procedure fmkpbbuf (fd) + +int fd +int buflen +pointer bp +errchk malloc +include + +begin + fp = fiodes[fd] + if (bufptr[fd] == NULL) + call fmkbfs (fd) + + buflen = FPBBUFSIZE(fp) + if (buflen <= 0) { + buflen = SZ_PBBUF + FPBBUFSIZE(fp) = buflen + } + + call malloc (bp, buflen, TY_CHAR) + + FPBBUF(fp) = bp + FPBTOP(fp) = bp + buflen + FPBIOP(fp) = bp + FPBSP(fp) = (FPBTOP(fp) - 1) / SZ_INT + 1 +end -- cgit