aboutsummaryrefslogtreecommitdiff
path: root/pkg/utilities/nttools/stxtools/clgnone.x
blob: b6fde15c5afc2203e539cc9c18492ba48823fce5 (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
36
37
# CLGNONE -- Get a string parameter whose value may be "none"
#
# B.Simon	20-Jun-94	original
# B.Simon	30-Jan-95	moved to stxtools

procedure clgnone (param, value, maxch)

char	param[ARB]	# i: parameter name
char	value[ARB]	# o: parameter value
int	maxch		# i: maximum length of value
#--
pointer	sp, temp1, temp2
bool	streq()

begin
	# Allocate memory for temporary strings

	call smark (sp)
	call salloc (temp1, maxch, TY_CHAR)
	call salloc (temp2, maxch, TY_CHAR)

	# Read parameter and convert to lower case for simpler comparison

	call clgstr (param, Memc[temp1], maxch)
	call strcpy (Memc[temp1], Memc[temp2], maxch)
	call strjust (Memc[temp2])

	# If value is none, set to null string

	if (Memc[temp2] == EOS || streq (Memc[temp2], "none")) {
	    value[1] = EOS
	} else {
	    call strcpy (Memc[temp1], value, maxch)
	}

	call sfree (sp)
end