aboutsummaryrefslogtreecommitdiff
path: root/sys/fmtio/gargb.x
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
commitfa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch)
treebdda434976bc09c864f2e4fa6f16ba1952b1e555 /sys/fmtio/gargb.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'sys/fmtio/gargb.x')
-rw-r--r--sys/fmtio/gargb.x33
1 files changed, 33 insertions, 0 deletions
diff --git a/sys/fmtio/gargb.x b/sys/fmtio/gargb.x
new file mode 100644
index 00000000..82d9e0cb
--- /dev/null
+++ b/sys/fmtio/gargb.x
@@ -0,0 +1,33 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <ctype.h>
+
+# GARGB -- Interpret the next token in the input as a boolean quantity
+# (token "y...." or "n....").
+
+procedure gargb (bval)
+
+bool bval
+include "scan.com"
+
+begin
+ if (sc_stopscan)
+ return
+
+ while (IS_WHITE (sc_scanbuf[sc_ip]))
+ sc_ip = sc_ip + 1
+
+ switch (sc_scanbuf[sc_ip]) {
+ case 'Y','y':
+ bval = true
+ case 'N','n':
+ bval = false
+ default:
+ sc_stopscan = true
+ return
+ }
+
+ while (IS_ALPHA(sc_scanbuf[sc_ip]) || sc_scanbuf[sc_ip] == '_')
+ sc_ip = sc_ip + 1
+ sc_ntokens = sc_ntokens + 1
+end