aboutsummaryrefslogtreecommitdiff
path: root/noao/digiphot/daophot/daolib/dprmwhite.x
blob: 9c61969c196481acf7489593d2e2617cc227af01 (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>

# DP_RMWHITE -- Remove whitespace from a string.

procedure dp_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