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/fio/nowhite.x | |
download | iraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz |
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/fio/nowhite.x')
-rw-r--r-- | sys/fio/nowhite.x | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/sys/fio/nowhite.x b/sys/fio/nowhite.x new file mode 100644 index 00000000..966ebc20 --- /dev/null +++ b/sys/fio/nowhite.x @@ -0,0 +1,35 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <ctype.h> + +# NOWHITE -- Return the input string minus any whitespace or newlines, +# returning a count of the number of nonwhite characters as the function value. + +int procedure nowhite (in, out, maxch) + +char in[ARB] # input string +char out[ARB] # output string +int maxch # max chars out + +int ch +int ip, op + +begin + op = 1 + do ip = 1, ARB { + ch = in[ip] + if (ch <= ' ') { + if (ch == EOS) + break + else if (IS_WHITE(ch) || ch == '\n') + next + } + if (op > maxch) + break + out[op] = ch + op = op + 1 + } + + out[op] = EOS + return (op - 1) +end |