aboutsummaryrefslogtreecommitdiff
path: root/pkg/system/help/t_lroff.x
blob: 9df65d439c832ad7d304054418774cda3ab80dce (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
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

# LROFF -- Text process a file.

procedure t_lroff()

char	fname[SZ_FNAME]
char	line[SZ_LINE]
char	format[SZ_FNAME]
int	fd, lmargin, rmargin
int	open(), getline(), strmatch(), clgeti()
extern	getline(), putline()

begin
	call clgstr ("input_file", fname, SZ_FNAME)
	fd = open (fname, READ_ONLY, TEXT_FILE)

	lmargin = clgeti ("lmargin")
	rmargin = clgeti ("rmargin")
	call clgstr ("format", format, SZ_FNAME)

	while (getline (fd, line) != EOF) {
	    if (strmatch (line, "^.help") > 0) {
		if (format[1] == 't')
		    call lroff (getline, fd, putline, STDOUT, lmargin, rmargin,
		        YES, NO)
		else if (format[1] == 'h')
		    call lroff2html (fd, STDOUT, fname, "", "", "", "")
		else if (format[1] == 'p')
		    call lroff2ps (fd, STDOUT, NULL, "", "")
	    }
	}
	
	call close (fd)
end