diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
commit | fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch) | |
tree | bdda434976bc09c864f2e4fa6f16ba1952b1e555 /sys/libc/callocate.c | |
download | iraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz |
Initial commit
Diffstat (limited to 'sys/libc/callocate.c')
-rw-r--r-- | sys/libc/callocate.c | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/sys/libc/callocate.c b/sys/libc/callocate.c new file mode 100644 index 00000000..303896c3 --- /dev/null +++ b/sys/libc/callocate.c @@ -0,0 +1,80 @@ +/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. +*/ + +#define import_spp +#define import_libc +#define import_xnames +#include <iraf.h> + + +/* C_ALLOCATE -- Allocate a device (and mount it, if necessary). +*/ +int +c_allocate ( + char *device /* device to be allocated */ +) +{ + int status; + + iferr (status = XALLOCATE (c_sppstr(device))) + return (ERR); + else + return (status); +} + + +/* C_DEALLOCATE -- Deallocate a device. +*/ +int +c_deallocate ( + char *device, /* device to be allocated */ + int rewind /* rewind flag, if magtape */ +) +{ + int status; + XINT x_rewind = rewind; + + iferr (status = (int) XDEALLOCATE (c_sppstr(device), &x_rewind)) + return (ERR); + else + return (status); +} + + +/* C_DEVSTATUS -- Print the current status of the named device. +*/ +void +c_devstatus ( + char *device, /* device name */ + int out /* output file */ +) +{ + XINT x_out = out; + + XDEVSTATUS (c_sppstr(device), &x_out); +} + + +/* C_DEVOWNER -- Determine if a device is allocated, and if so return +** the name of the owner. +*/ +int +c_devowner ( + char *device, /* device to be allocated */ + char *owner, /* receives owner name string */ + int maxch +) +{ + PKCHAR x_owner[SZ_FNAME+1]; + XINT x_maxch = SZ_FNAME; + int status; + + + iferr (status = (int) XDEVOWNER(c_sppstr(device), x_owner, &x_maxch)) { + owner[0] = EOS; + return (ERR); + } else { + c_strpak (x_owner, owner, maxch); + return (status); + } +} |