diff options
author | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
---|---|---|
committer | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
commit | 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch) | |
tree | 4464880c571602d54f6ae114729bf62a89518057 /sys/tty/ttydevnm.x | |
download | iraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz |
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/tty/ttydevnm.x')
-rw-r--r-- | sys/tty/ttydevnm.x | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/sys/tty/ttydevnm.x b/sys/tty/ttydevnm.x new file mode 100644 index 00000000..76996d69 --- /dev/null +++ b/sys/tty/ttydevnm.x @@ -0,0 +1,41 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <ctype.h> + +# TTYDEVNAME -- Extract the logical device name from a full device specification +# of the form "node ! logical_device ? physical_device". The node prefix, if +# given, specifies the node from which the device is to be accessed (via the +# network), and the physical device field contains particulars about the +# physical device to be accessed. Only the logical device field, used to index +# the termcap file, is of any interest to TTY. The logical device name +# consists of chars chosen from the set [a-zA-Z0-9_+-]. + +procedure ttydevname (device, ldevice, maxch) + +char device[ARB] # full device specification +char ldevice[maxch] # logical device name +int maxch + +pointer sp, nodename +int ip, op, ch +int ki_extnode() + +begin + call smark (sp) + call salloc (nodename, SZ_FNAME, TY_CHAR) + + ip = ki_extnode (device, Memc[nodename], maxch, op) + 1 + + for (op=1; device[ip] != EOS; ip=ip+1) { + ch = device[ip] + if (!(IS_ALNUM(ch) || ch == '_' || ch == '+' || ch == '-')) { + ldevice[op] = EOS + break + } else { + ldevice[op] = ch + op = op + 1 + } + } + + call sfree (sp) +end |