blob: 966ebc20d2e2d60d166b86b97c11e4e9dd4f6bc8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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
|