aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/htmlroff/t20.c
blob: 00e3145567b3fff8dac78789b76de4637d26a282 (plain)
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
70
71
72
73
74
75
76
77
78
#include "a.h"

/*
 * 20. Miscellaneous
 */

/* .mc - margin character */
/* .ig - ignore; treated like a macro in t7.c */

/* .pm - print macros and strings */

void
r_pm(int argc, Rune **argv)
{
	int i;

	if(argc == 1){
		printds(0);
		return;
	}
	if(runestrcmp(argv[1], L("t")) == 0){
		printds(1);
		return;
	}
	for(i=1; i<argc; i++)
		fprint(2, "%S: %S\n", argv[i], getds(argv[i]));
}

void
r_tm(Rune *name)
{
	Rune *line;

	USED(name);

	line = readline(CopyMode);
	fprint(2, "%S\n", line);
	free(line);
}

void
r_ab(Rune *name)
{
	USED(name);

	r_tm(L("ab"));
	exits(".ab");
}

void
r_lf(int argc, Rune **argv)
{
	if(argc == 1)
		return;
	if(argc == 2)
		setlinenumber(nil, eval(argv[1]));
	if(argc == 3)
		setlinenumber(argv[2], eval(argv[1]));
}

void
r_fl(int argc, Rune **argv)
{
	USED(argc);
	USED(argv);
	Bflush(&bout);
}

void
t20init(void)
{
	addreq(L("mc"), r_warn, -1);
	addraw(L("tm"), r_tm);
	addraw(L("ab"), r_ab);
	addreq(L("lf"), r_lf, -1);
	addreq(L("pm"), r_pm, -1);
	addreq(L("fl"), r_fl, 0);
}