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/tty/ttygetr.x | |
download | iraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz |
Initial commit
Diffstat (limited to 'sys/tty/ttygetr.x')
-rw-r--r-- | sys/tty/ttygetr.x | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/sys/tty/ttygetr.x b/sys/tty/ttygetr.x new file mode 100644 index 00000000..f4e2a8a8 --- /dev/null +++ b/sys/tty/ttygetr.x @@ -0,0 +1,41 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <mach.h> + +# TTYGETR -- Get a real valued capability. If the capability is not +# found for the device, or cannot be interpreted as a number, zero is +# returned. Real valued capabilities have the format ":xx#num:". + +real procedure ttygetr (tty, cap) + +pointer tty # tty descriptor +char cap[ARB] # two character capability name + +char numstr[MAX_DIGITS] +int np, op +pointer ip +double dval +int tty_find_capability(), ctod() + +begin + if (tty_find_capability (tty, cap, ip) == NO) + return (0.0) + else if (Memc[ip] != '#') + return (0.0) + else { + # Extract the number into numstr. Cannot convert in place in + # the table because the ":" delimiter will by interpreted by + # ctod as for a sexagesimal number. + op = 1 + for (ip=ip+1; op <= MAX_DIGITS && Memc[ip] != ':'; ip=ip+1) { + numstr[op] = Memc[ip] + op = op + 1 + } + numstr[op] = EOS + np = 1 + if (ctod (numstr, np, dval) == 0) + return (0.0) + else + return (dval) + } +end |