aboutsummaryrefslogtreecommitdiff
path: root/pkg/utilities/nttools/stxtools/strjust.x
blob: 5f50f080515d903ab1a91d23a9ae85943a130c46 (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
include	<ctype.h>

# STRJUST -- Remove whitspace from a string and convert to lower case
#
# B.Simon	30-Jan-95	copied from synphot$strfix

procedure strjust (str)

char	str[ARB]	# u: string to convert
#--
int ic, jc

begin
	jc = 1
	for (ic = 1; str[ic] != EOS; ic = ic + 1) {
	    if (IS_WHITE(str[ic]))
		next

	    if (IS_UPPER(str[ic])) {
		str[jc] = TO_LOWER(str[ic])

	    } else if (jc < ic) {
		str[jc] = str[ic]
	    }

	    jc = jc + 1
	}

	str[jc] = EOS
end