aboutsummaryrefslogtreecommitdiff
path: root/noao/digiphot/apphot/aputil/aprmwhite.x
blob: 071ea7edd2ea80fa77cb523dff5bccb55839851c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
include <ctype.h>

# AP_RMWHITE -- Remove whitespace from a string.

procedure ap_rmwhite (instr, outstr, maxch)

char	instr[ARB]		# the input string
char	outstr[ARB]		# the output string, may be the same as instr
int	maxch			# maximum number of characters in outstr

int	ip, op

begin
	op = 1
	for (ip = 1; (instr[ip] != EOS) && (op <= maxch); ip = ip + 1) {
	    if (IS_WHITE(instr[ip]))
		next
	    outstr[op] = instr[ip]
	    op = op + 1
	}
	outstr[op] = EOS
end