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/imio/db/idbfstr.x | |
download | iraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz |
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/imio/db/idbfstr.x')
-rw-r--r-- | sys/imio/db/idbfstr.x | 40 |
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 |