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/etc/xgdevlist.x | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 sys/etc/xgdevlist.x (limited to 'sys/etc/xgdevlist.x') diff --git a/sys/etc/xgdevlist.x b/sys/etc/xgdevlist.x new file mode 100644 index 00000000..d20b68a9 --- /dev/null +++ b/sys/etc/xgdevlist.x @@ -0,0 +1,49 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include +include + +# XGDEVLIST -- Fetch the allocation string for the named logical device from +# the device table (tapecap file). DV_DEVNOTFOUND is returned there is no +# entry in the device table for the device. An error action is taken if there +# is any problem reading the device entry. +# +# This routine is a bit of an anachronism in the days of tapecap, but is +# left pretty much as it was originally to minimize code modifications. +# In principle the allocation code can be used to allocate any device, not +# just tape drives. This is still the case, given an entry for the device +# in the tapecap file. + +int procedure xgdevlist (device, outstr, maxch, onedev) + +char device[ARB] #I logical device name +char outstr[maxch] #O receives device list +int maxch #I max chars out +int onedev #I return i/o device instead? + +pointer gty +int nchars +pointer mtcap() +int gtygets(), strlen() +errchk syserrs + +begin + # Fetch the tapecap entry for the named device. Do not close the GTY + # descriptor. mtcap always keeps the last one in an internal cache. + + iferr (gty = mtcap (device)) + return (DV_DEVNOTFOUND) + + if (onedev == YES) + nchars = gtygets (gty, "dv", outstr, maxch) + else + nchars = gtygets (gty, "al", outstr, maxch) + + call ki_xnode (device, outstr, maxch) + nchars = strlen (outstr) + + if (nchars <= 0) + call syserrs (SYS_MTTAPECAP, device) + + return (OK) +end -- cgit