From fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 8 Jul 2015 20:46:52 -0400 Subject: Initial commit --- unix/gdev/m70vms/zwtm70.x | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 unix/gdev/m70vms/zwtm70.x (limited to 'unix/gdev/m70vms/zwtm70.x') diff --git a/unix/gdev/m70vms/zwtm70.x b/unix/gdev/m70vms/zwtm70.x new file mode 100644 index 00000000..69ab39da --- /dev/null +++ b/unix/gdev/m70vms/zwtm70.x @@ -0,0 +1,44 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include +include +include "m70.h" + +# ZWTM70 -- Wait for i/o completion and return the number of bytes read or +# written or ERR. Repetitive calls return the same value. + +procedure zwtm70 (chan, status) + +int chan # FCB pointer for device +int status # nbytes transferred or ERR + +pointer fcb +short bfnum, bufcnt, ier + +begin + fcb = chan + + if (FCB_KCHAN(fcb) == NULL) { + switch (FCB_STATUS(fcb)) { + case ERR: + status = ERR + case IIS_INACTIVE: + status = FCB_NBYTES(fcb) + + default: + bfcnt = -1 # m70wt is a nop if we don't do this + bfnum = FCB_EFN(fcb) + + call m70wt (Mems[fcb], bfnum, bfcnt, FCB_IOSB(fcb,1), ier) + + if (ier != 0) + status = ERR + else + status = FCB_NBYTES(fcb) + + FCB_STATUS(fcb) = IIS_INACTIVE + } + + } else + call zawtbf (FCB_KCHAN(fcb), status) +end -- cgit