aboutsummaryrefslogtreecommitdiff
path: root/pkg/utilities/nttools/tcheck/wrtcheck.x
blob: b14ec542ddeb2e53f069e1f4f8abbf83a03aff05 (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# WRT_CHECK -- Write the table values that pass the check

procedure wrt_check (tp, irow, keylist, command, title)

pointer	tp		#  i: Table descriptor
int	irow		#  i: Table row number
char	keylist[ARB]	#  i: List of keywords to print
char	command[ARB]	# io: Expression used in check
bool	title		# io: Print title?
#--
int	ic
pointer	sp, tabname, ldir, keyword, newcmd, value, root, col

int	fnldir(), gstrcpy(), word_fetch()

begin
	call smark (sp)
	call salloc (tabname, SZ_FNAME, TY_CHAR)
	call salloc (ldir, SZ_FNAME, TY_CHAR)
	call salloc (keyword, SZ_FNAME, TY_CHAR)
	call salloc (newcmd, SZ_FNAME, TY_CHAR)
	call salloc (value, SZ_LINE, TY_CHAR)

	# Print title if this is the first error found in this table

	if (title) {
	    title = false
	    call tbtnam (tp, Memc[tabname], SZ_FNAME)
	    root = tabname + fnldir (Memc[tabname], Memc[ldir], SZ_FNAME)

	    call printf ("#\n#%11t%-60s\n#\n")
	    call pargstr (Memc[root])
	}

	# Truncate command to 60 characters

	if (gstrcpy (command, Memc[newcmd], 60) == 60)
	    call strcat (" ...", Memc[newcmd], SZ_FNAME)

	# Print each keyword name, value, and associated command

	ic = 1
	while (word_fetch (keylist, ic, Memc[keyword], SZ_FNAME) > 0) {
	    call tbcfnd (tp, Memc[keyword], col, 1)
	    if (col != NULL) {
		call tbegtt (tp, col, irow, Memc[value], SZ_LINE)

		call printf ("%-5d%-20s%-20s%-30s\n")
		call pargi (irow)
		call pargstr (Memc[keyword])
		call pargstr (Memc[value])
		call pargstr (Memc[newcmd])

	    } else {
		call printf ("%-5d%-20s missing\n")
		call pargi (irow)
		call pargstr (Memc[keyword])
	    }
	}
	call sfree (sp)
end