aboutsummaryrefslogtreecommitdiff
path: root/pkg/system/help/prfnames.x
blob: f4e42205532264886ef5671f9e1c28bf2f9edc45 (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
62
63
64
65
66
67
68
69
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

include	"help.h"
include	"helpdir.h"

# PR_FILENAMES -- Print file names associated with module.

define	NFILES	5

procedure pr_filenames (hp, module, modnum, ctrl)

pointer	hp
char	module[ARB]
int	modnum
pointer	ctrl

int	i, nfiles, ftype[NFILES]
pointer	sp, lbuf, pakname, modname, fname[NFILES]
int	hd_getname()
errchk	hd_getname, houtput
data	ftype /TY_HLP, TY_SYS, TY_SRC, TY_PKG, TY_MEN/
string	fcode "hlpsyssrcpkgmen"


begin
	call smark (sp)
	call salloc (lbuf, SZ_LINE, TY_CHAR)
	call salloc (pakname, SZ_FNAME, TY_CHAR)
	call salloc (modname, SZ_FNAME, TY_CHAR)

	do i = 1, NFILES
	    call salloc (fname[i], SZ_PATHNAME, TY_CHAR)

	nfiles = 0
	do i = 1, NFILES
	    if (hd_getname (hp, modnum, ftype[i], Memc[fname[i]],
	    SZ_PATHNAME) > 0)
		nfiles = nfiles + 1

	if (nfiles > 0) {
	    # Get the package and module names.  If there is no package name
	    # in the help directory, it is root help directory, and the module
	    # name is actually the name of a package.

	    if (HD_PAKNAME(hp) == 0) {
		call strcpy (module, Memc[pakname], SZ_FNAME)
		Memc[modname] = EOS
	    } else {
		call strcpy (Memc[HD_SBUF(hp) + HD_PAKNAME(hp)],
		    Memc[pakname], SZ_FNAME)
		call strcpy (module, Memc[modname], SZ_FNAME)
	    }

	    # Print "pakname.modname".
	    if (H_LENTL(ctrl) > 1)
		call pr_modname (ctrl, Memc[pakname], Memc[modname])

	    # List the names of the help files.
	    do i = 1, NFILES
		if (Memc[fname[i]] != EOS) {
		    call sprintf (Memc[lbuf], SZ_LINE, "\t%0.3s = %s\n")
			call pargstr (fcode[(i-1)*3+1])
			call pargstr (Memc[fname[i]])
		    call houtput (ctrl, Memc[lbuf])
		}
	}

	call sfree (sp)
end