aboutsummaryrefslogtreecommitdiff
path: root/sys/imio/db/idbfstr.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/imio/db/idbfstr.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'sys/imio/db/idbfstr.x')
-rw-r--r--sys/imio/db/idbfstr.x40
1 files changed, 40 insertions, 0 deletions
diff --git a/sys/imio/db/idbfstr.x b/sys/imio/db/idbfstr.x
new file mode 100644
index 00000000..1087ca02
--- /dev/null
+++ b/sys/imio/db/idbfstr.x
@@ -0,0 +1,40 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <ctype.h>
+
+
+# IDB_FILSTR -- Filter a string, removing any tabs or control characters.
+# This is used to clean up strings we want to put in image headers. A count
+# of the output, filtered string is returned as the function value. Tabs or
+# newlines in the input are replaced by blanks. Illegal or unprintable
+# control characters in the input are deleted.
+
+int procedure idb_filstr (s1, s2, maxch)
+
+char s1[ARB] #I input string
+char s2[ARB] #O output string
+int maxch #I max chars out
+
+int op, ch, i
+
+begin
+ op = 1
+
+ do i = 1, ARB {
+ ch = s1[i]
+ if (ch == EOS)
+ break
+ else if (ch == '\t' || ch == '\n')
+ ch = ' '
+ else if (!IS_PRINT (ch))
+ next
+
+ s2[op] = ch
+ op = op + 1
+ if (op > maxch)
+ break
+ }
+
+ s2[op] = EOS
+ return (op - 1)
+end