diff options
author | Petter Rodhelind <petter.rodhelind@gmail.com> | 2020-01-14 11:41:08 +0100 |
---|---|---|
committer | Petter Rodhelind <petter.rodhelind@gmail.com> | 2020-01-14 11:41:08 +0100 |
commit | 02d7aa8915f9c3a3288dab01f321eb94ba219e3b (patch) | |
tree | f053238978479e408a2b83571443e132f30586ab /src/cmd/htmlroff | |
parent | c0c9d8f883dfd3a7f5a74499d91bb95884b15873 (diff) | |
parent | 3d1382b98a502d0c34d5ba2c462396acc515016e (diff) | |
download | plan9port-02d7aa8915f9c3a3288dab01f321eb94ba219e3b.tar.gz plan9port-02d7aa8915f9c3a3288dab01f321eb94ba219e3b.tar.bz2 plan9port-02d7aa8915f9c3a3288dab01f321eb94ba219e3b.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/cmd/htmlroff')
-rw-r--r-- | src/cmd/htmlroff/a.h | 4 | ||||
-rw-r--r-- | src/cmd/htmlroff/char.c | 9 | ||||
-rw-r--r-- | src/cmd/htmlroff/html.c | 13 | ||||
-rw-r--r-- | src/cmd/htmlroff/input.c | 14 | ||||
-rw-r--r-- | src/cmd/htmlroff/main.c | 7 | ||||
-rw-r--r-- | src/cmd/htmlroff/roff.c | 26 | ||||
-rw-r--r-- | src/cmd/htmlroff/t1.c | 11 | ||||
-rw-r--r-- | src/cmd/htmlroff/t10.c | 9 | ||||
-rw-r--r-- | src/cmd/htmlroff/t11.c | 1 | ||||
-rw-r--r-- | src/cmd/htmlroff/t13.c | 3 | ||||
-rw-r--r-- | src/cmd/htmlroff/t14.c | 3 | ||||
-rw-r--r-- | src/cmd/htmlroff/t15.c | 1 | ||||
-rw-r--r-- | src/cmd/htmlroff/t16.c | 14 | ||||
-rw-r--r-- | src/cmd/htmlroff/t17.c | 4 | ||||
-rw-r--r-- | src/cmd/htmlroff/t18.c | 6 | ||||
-rw-r--r-- | src/cmd/htmlroff/t19.c | 11 | ||||
-rw-r--r-- | src/cmd/htmlroff/t2.c | 25 | ||||
-rw-r--r-- | src/cmd/htmlroff/t20.c | 9 | ||||
-rw-r--r-- | src/cmd/htmlroff/t3.c | 3 | ||||
-rw-r--r-- | src/cmd/htmlroff/t4.c | 7 | ||||
-rw-r--r-- | src/cmd/htmlroff/t5.c | 5 | ||||
-rw-r--r-- | src/cmd/htmlroff/t6.c | 3 | ||||
-rw-r--r-- | src/cmd/htmlroff/t7.c | 27 | ||||
-rw-r--r-- | src/cmd/htmlroff/t8.c | 27 | ||||
-rw-r--r-- | src/cmd/htmlroff/t9.c | 1 | ||||
-rw-r--r-- | src/cmd/htmlroff/util.c | 13 |
26 files changed, 118 insertions, 138 deletions
diff --git a/src/cmd/htmlroff/a.h b/src/cmd/htmlroff/a.h index 173fdc96..a4209178 100644 --- a/src/cmd/htmlroff/a.h +++ b/src/cmd/htmlroff/a.h @@ -23,13 +23,13 @@ enum UPI = 720, /* units per inch */ UPX = 10, /* units per pixel */ - + /* special input modes */ CopyMode = 1<<1, ExpandMode = 1<<2, ArgMode = 1<<3, HtmlMode = 1<<4, - + MaxLine = 1024 }; diff --git a/src/cmd/htmlroff/char.c b/src/cmd/htmlroff/char.c index 151c9339..9e213e13 100644 --- a/src/cmd/htmlroff/char.c +++ b/src/cmd/htmlroff/char.c @@ -12,7 +12,7 @@ rune2html(Rune r) static Rune **tcscache[256]; int p[2]; char *q; - + if(r == '\n') return L("\n"); @@ -79,7 +79,7 @@ troff2rune(Rune *rs) char *file, *f[10], *p, s[3]; int i, nf; Biobuf *b; - + if(rs[0] >= Runeself || rs[1] >= Runeself) return Runeerror; s[0] = rs[0]; @@ -103,14 +103,13 @@ troff2rune(Rune *rs) } } Bterm(b); - + if(ntrtab >= nelem(trtab)) fprint(2, "%s: trtab too small\n", argv0); } - + for(i=0; i<ntrtab; i++) if(strcmp(s, trtab[i].t) == 0) return trtab[i].r; return Runeerror; } - diff --git a/src/cmd/htmlroff/html.c b/src/cmd/htmlroff/html.c index 81095995..98b123f8 100644 --- a/src/cmd/htmlroff/html.c +++ b/src/cmd/htmlroff/html.c @@ -22,7 +22,7 @@ closingtag(Rune *s) { Rune *t; Rune *p0, *p; - + t = runemalloc(sizeof(Rune)); if(s == nil) return t; @@ -44,7 +44,7 @@ closingtag(Rune *s) runemove(t+2, p0, p-p0); t[2+(p-p0)] = Ugt; } - + if(*p == Ugt && p>s && *(p-1) == '/'){ close: for(p0=t+1; *p0 && *p0 != Ult; p0++) @@ -52,7 +52,7 @@ closingtag(Rune *s) runemove(t, p0, runestrlen(p0)+1); } } - return t; + return t; } void @@ -108,7 +108,7 @@ void closehtml(void) { Tag *t, *next; - + br(); hideihtml(); for(t=tagstack; t; t=next){ @@ -230,7 +230,7 @@ void r_html(Rune *name) { Rune *id, *line, *p; - + id = copyarg(); line = readline(HtmlMode); for(p=line; *p; p++){ @@ -281,7 +281,6 @@ htmlinit(void) addesc('`', e_btick, CopyMode); addesc('-', e_minus, CopyMode); addesc('@', e_at, CopyMode); - + ds(L("font"), L(defaultfont)); } - diff --git a/src/cmd/htmlroff/input.c b/src/cmd/htmlroff/input.c index 99e0d56e..a4c4bc3a 100644 --- a/src/cmd/htmlroff/input.c +++ b/src/cmd/htmlroff/input.c @@ -65,7 +65,7 @@ _inputfile(Rune *s, void (*push)(Istack*)) Istack *is; Biobuf *b; char *t; - + t = esmprint("%S", s); if((b = Bopen(t, OREAD)) == nil){ free(t); @@ -95,7 +95,7 @@ queueinputfile(Rune *s) int _inputstdin(void (*push)(Istack*)) -{ +{ Biobuf *b; Istack *is; @@ -128,7 +128,7 @@ void _inputstring(Rune *s, void (*push)(Istack*)) { Istack *is; - + is = emalloc(sizeof *is); is->s = erunestrdup(s); is->p = is->s; @@ -176,7 +176,7 @@ getrune(void) { Rune r; int c; - + top: if(istack == nil) return -1; @@ -199,7 +199,7 @@ top: sysfatal("getrune - can't happen"); } if(r == '\n') - istack->lineno++; + istack->lineno++; return r; } @@ -215,7 +215,7 @@ int linefmt(Fmt *f) { Istack *is; - + for(is=istack; is && !is->b; is=is->next) ; if(is) @@ -228,7 +228,7 @@ void setlinenumber(Rune *s, int n) { Istack *is; - + for(is=istack; is && !is->name; is=is->next) ; if(is){ diff --git a/src/cmd/htmlroff/main.c b/src/cmd/htmlroff/main.c index b6af1e7b..bd77a225 100644 --- a/src/cmd/htmlroff/main.c +++ b/src/cmd/htmlroff/main.c @@ -23,11 +23,11 @@ main(int argc, char **argv) char *p; Rune *r; Rune buf[2]; - + Binit(&bout, 1, OWRITE); fmtinstall('L', linefmt); quotefmtinstall(); - + tmacdir = unsharp("#9/tmac"); dostdin = 0; ARGBEGIN{ @@ -63,10 +63,9 @@ main(int argc, char **argv) } if(argc == 0 || dostdin) queuestdin(); - + run(); Bprint(&bout, "\n"); Bterm(&bout); exits(nil); } - diff --git a/src/cmd/htmlroff/roff.c b/src/cmd/htmlroff/roff.c index bdc51a3e..34b794be 100644 --- a/src/cmd/htmlroff/roff.c +++ b/src/cmd/htmlroff/roff.c @@ -59,7 +59,7 @@ void addraw(Rune *name, void (*f)(Rune*)) { Raw *r; - + if(nraw >= nelem(raw)){ fprint(2, "too many raw requets\n"); return; @@ -73,7 +73,7 @@ void delraw(Rune *name) { int i; - + for(i=0; i<nraw; i++){ if(runestrcmp(raw[i].name, name) == 0){ if(i != --nraw){ @@ -89,7 +89,7 @@ void renraw(Rune *from, Rune *to) { int i; - + delraw(to); for(i=0; i<nraw; i++) if(runestrcmp(raw[i].name, from) == 0){ @@ -135,7 +135,7 @@ void renreq(Rune *from, Rune *to) { int i; - + delreq(to); for(i=0; i<nreq; i++) if(runestrcmp(req[i].name, from) == 0){ @@ -149,7 +149,7 @@ void addesc(Rune r, int (*f)(void), int mode) { Esc *e; - + if(nesc >= nelem(esc)){ fprint(2, "too many escapes\n"); return; @@ -256,7 +256,7 @@ copyarg(void) static Rune buf[MaxLine]; int c; Rune *r; - + if(_readx(buf, sizeof buf, ArgMode, 0) < 0) return nil; r = runestrstr(buf, L("\\\"")); @@ -266,7 +266,7 @@ copyarg(void) ; ungetrune('\n'); } - r = erunestrdup(buf); + r = erunestrdup(buf); return r; } @@ -322,7 +322,7 @@ parseargs(Rune *p, Rune **argv) *w++ = *p; } *w = 0; - } + } }else{ /* unquoted argument - need to watch out for \" comment */ for(; *p; p++){ @@ -369,7 +369,7 @@ dotline(int dot) raw[i].f(raw[i].name); free(a); return; - } + } } /* @@ -515,7 +515,7 @@ void runinput(void) { int c; - + bol = 1; for(;;){ c = getnext(); @@ -573,7 +573,7 @@ run(void) t20init(); htmlinit(); hideihtml(); - + addreq(L("margin"), r_margin, 1); nr(L(".margin"), 1); nr(L(".paragraph"), 1); @@ -603,7 +603,7 @@ void inroman(Rune r) { int f; - + f = getnr(L(".f")); nr(L(".f"), 1); runmacro1(L("font")); @@ -631,7 +631,7 @@ void outhtml(Rune *s) { Rune r; - + for(; *s; s++){ switch(r = *s){ case '<': diff --git a/src/cmd/htmlroff/t1.c b/src/cmd/htmlroff/t1.c index 8236694d..c68ada77 100644 --- a/src/cmd/htmlroff/t1.c +++ b/src/cmd/htmlroff/t1.c @@ -1,5 +1,5 @@ #include "a.h" - + /* * Section 1 - General Explanation. */ @@ -10,7 +10,7 @@ int scale2units(char c) { int x; - + switch(c){ case 'i': /* inch */ return UPI; @@ -49,7 +49,7 @@ long runestrtol(Rune *a, Rune **p) { long n; - + n = 0; while('0' <= *a && *a <= '9'){ n = n*10 + *a-'0'; @@ -111,7 +111,7 @@ eval0(Rune **pline, int scale, int recur) *pline = p; return x; } - + while(*p){ switch(*p++) { case '+': @@ -176,11 +176,10 @@ void t1init(void) { Tm tm; - + tm = *localtime(time(0)); nr(L("dw"), tm.wday+1); nr(L("dy"), tm.mday); nr(L("mo"), tm.mon); nr(L("yr"), tm.year%100); } - diff --git a/src/cmd/htmlroff/t10.c b/src/cmd/htmlroff/t10.c index 4aa74532..64d63f41 100644 --- a/src/cmd/htmlroff/t10.c +++ b/src/cmd/htmlroff/t10.c @@ -58,7 +58,7 @@ int e_bang(void) { Rune *line; - + line = readline(CopyMode); out(line); outrune('\n'); @@ -70,7 +70,7 @@ int e_X(void) { int c, c1; - + c1 = getrune(); if(c1 < 0 || c1 == '\n') { c = c1; @@ -119,7 +119,7 @@ void r_comment(Rune *name) { int c; - + USED(name); while((c = getrune()) >= 0 && c != '\n') ; @@ -136,11 +136,10 @@ t10init(void) addreq(L("tr"), r_warn, -1); addreq(L("ul"), r_nop, -1); addraw(L("\\\""), r_comment); - + addesc('!', e_bang, 0); addesc('X', e_X, 0); addesc('\"', e_quote, CopyMode|ArgMode); addesc('\n', e_newline, CopyMode|ArgMode|HtmlMode); addesc('e', e_e, 0); } - diff --git a/src/cmd/htmlroff/t11.c b/src/cmd/htmlroff/t11.c index dd1dd75b..2e273ac4 100644 --- a/src/cmd/htmlroff/t11.c +++ b/src/cmd/htmlroff/t11.c @@ -109,4 +109,3 @@ t11init(void) addesc('r', e_r, 0); addesc('k', e_k, 0); } - diff --git a/src/cmd/htmlroff/t13.c b/src/cmd/htmlroff/t13.c index 0fadab3a..b2922f6a 100644 --- a/src/cmd/htmlroff/t13.c +++ b/src/cmd/htmlroff/t13.c @@ -11,7 +11,6 @@ t13init(void) addreq(L("hy"), r_nop, -1); addreq(L("hc"), r_nop, -1); addreq(L("hw"), r_nop, -1); - + addesc('%', e_nop, 0); } - diff --git a/src/cmd/htmlroff/t14.c b/src/cmd/htmlroff/t14.c index 1dab3516..4242dd70 100644 --- a/src/cmd/htmlroff/t14.c +++ b/src/cmd/htmlroff/t14.c @@ -7,7 +7,7 @@ void r_lt(int argc, Rune **argv) { Rune *p; - + if(argc < 2) nr(L(".lt"), evalscale(L("6.5i"), 'm')); else{ @@ -30,4 +30,3 @@ t14init(void) addreq(L("pc"), r_nop, -1); /* page number char */ addreq(L("lt"), r_lt, -1); } - diff --git a/src/cmd/htmlroff/t15.c b/src/cmd/htmlroff/t15.c index fbfd5128..221f642e 100644 --- a/src/cmd/htmlroff/t15.c +++ b/src/cmd/htmlroff/t15.c @@ -10,4 +10,3 @@ t15init(void) addreq(L("nm"), r_warn, -1); addreq(L("nn"), r_warn, -1); } - diff --git a/src/cmd/htmlroff/t16.c b/src/cmd/htmlroff/t16.c index 3a9c427e..9389a59a 100644 --- a/src/cmd/htmlroff/t16.c +++ b/src/cmd/htmlroff/t16.c @@ -24,7 +24,7 @@ void startbody(void) { int c; - + while((c = getrune()) == ' ' || c == '\t') ; ungetrune(c); @@ -52,7 +52,7 @@ ifeval(void) int c, cc, neg, nc; Rune line[MaxLine], *p, *e, *q; Rune *a; - + while((c = getnext()) == ' ' || c == '\t') ; neg = 0; @@ -68,7 +68,7 @@ ifeval(void) free(a); return c; } - + switch(c){ case ' ': case '\n': @@ -111,12 +111,12 @@ ifeval(void) return (q-line == p-(q+1) && memcmp(line, q+1, (q-line)*sizeof(Rune))==0) ^ neg; } - + void r_if(Rune *name) { int n; - + n = ifeval(); if(runestrcmp(name, L("ie")) == 0){ if(niftrue >= nelem(iftrue)) @@ -133,7 +133,7 @@ void r_el(Rune *name) { USED(name); - + if(niftrue <= 0){ warn("%Cel underflow", dot); return; @@ -150,7 +150,7 @@ t16init(void) addraw(L("if"), r_if); addraw(L("ie"), r_if); addraw(L("el"), r_el); - + addesc('{', e_nop, HtmlMode|ArgMode); addesc('}', e_nop, HtmlMode|ArgMode); } diff --git a/src/cmd/htmlroff/t17.c b/src/cmd/htmlroff/t17.c index bbd095d5..74096c5c 100644 --- a/src/cmd/htmlroff/t17.c +++ b/src/cmd/htmlroff/t17.c @@ -97,7 +97,7 @@ r_ev(int argc, Rune **argv) { int i; Env *e; - + if(argc == 1){ if(nevstack <= 0){ if(verbose) warn(".ev stack underflow"); @@ -123,7 +123,7 @@ void t17init(void) { int i; - + for(i=0; i<nelem(env); i++) env[i] = defenv; diff --git a/src/cmd/htmlroff/t18.c b/src/cmd/htmlroff/t18.c index f5c74a1f..51f08219 100644 --- a/src/cmd/htmlroff/t18.c +++ b/src/cmd/htmlroff/t18.c @@ -11,7 +11,7 @@ r_rd(int argc, Rune **argv) Fmt fmt; static int didstdin; static Biobuf bstdin; - + /* * print prompt, then read until double newline, * then run the text just read as though it were @@ -23,7 +23,7 @@ r_rd(int argc, Rune **argv) else fprint(2, "%c", 7/*BEL*/); } - + if(!didstdin){ Binit(&bstdin, 0, OREAD); didstdin = 1; @@ -54,7 +54,7 @@ r_ex(int argc, Rune **argv) { USED(argc); USED(argv); - + while(popinput()) ; } diff --git a/src/cmd/htmlroff/t19.c b/src/cmd/htmlroff/t19.c index a4cc18f4..bd633834 100644 --- a/src/cmd/htmlroff/t19.c +++ b/src/cmd/htmlroff/t19.c @@ -17,7 +17,7 @@ void r_nx(int argc, Rune **argv) { int n; - + if(argc == 1){ while(popinput()) ; @@ -74,7 +74,7 @@ r_inputpipe(Rune *name) Rune *cmd, *stop, *line; int n, pid, p[2], len; Waitmsg *w; - + USED(name); if(pipe(p) < 0){ warn("pipe: %r"); @@ -104,7 +104,7 @@ r_inputpipe(Rune *name) fprint(p[1], ".ll 8i\n"); fprint(p[1], ".pl 30i\n"); while((line = readline(~0)) != nil){ - if(runestrncmp(line, stop, len) == 0 + if(runestrncmp(line, stop, len) == 0 && (line[len]==' ' || line[len]==0 || line[len]=='\t' || (line[len]=='\\' && line[len+1]=='}'))) break; @@ -125,7 +125,7 @@ r_inputpipe(Rune *name) free(cmd); free(w); } -} +} void t19init(void) @@ -136,7 +136,6 @@ t19init(void) addraw(L("inputpipe"), r_inputpipe); addraw(L("pi"), r_pi); addreq(L("cf"), r_cf, 1); - + nr(L("$$"), getpid()); } - diff --git a/src/cmd/htmlroff/t2.c b/src/cmd/htmlroff/t2.c index 54481d0a..1831660e 100644 --- a/src/cmd/htmlroff/t2.c +++ b/src/cmd/htmlroff/t2.c @@ -3,14 +3,14 @@ /* * Section 2 - Font and character size control. */ - + /* 2.1 - Character set */ /* XXX * * \C'name' - character named name * \N'n' - character number * \(xx - two-letter character - * \- + * \- * \` * \' * ` @@ -24,10 +24,10 @@ getqarg(void) static Rune buf[MaxLine]; int c; Rune *p, *e; - + p = buf; - e = p+sizeof buf-1; - + e = p + nelem(buf) - 1; + if(getrune() != '\'') return nil; while(p < e){ @@ -60,7 +60,7 @@ e_paren(void) { int c, cc; Rune buf[2], r; - + if((c = getrune()) < 0 || c == '\n') goto error; if((cc = getrune()) < 0 || cc == '\n') @@ -71,7 +71,7 @@ e_paren(void) if(r == Runeerror) warn("unknown char %C(%C%C", backslash, c, cc); return r; - + error: warn("malformed %C(xx", backslash); return 0; @@ -92,7 +92,7 @@ ft(Rune *f) { int i; int fn; - + if(f && runestrcmp(f, L("P")) == 0) f = nil; if(f == nil) @@ -131,7 +131,7 @@ fp(int i, Rune *f) } runestrecpy(fonttab[i], fonttab[i]+sizeof fonttab[i], f); } - + int e_f(void) { @@ -177,7 +177,7 @@ void r_ps(int argc, Rune **argv) { Rune *p; - + if(argc == 1 || argv[1][0] == 0) ps(0); else{ @@ -195,7 +195,7 @@ int e_s(void) { int c, cc, ccc, n, twodigit; - + c = getnext(); if(c < 0) return 0; @@ -253,7 +253,7 @@ t2init(void) fp(3, L("B")); fp(4, L("BI")); fp(5, L("CW")); - + nr(L(".s"), 10); nr(L(".s0"), 10); @@ -271,4 +271,3 @@ t2init(void) addesc('N', e_N, 0); /* \- \' \` are handled in html.c */ } - diff --git a/src/cmd/htmlroff/t20.c b/src/cmd/htmlroff/t20.c index 62ea914f..00e31455 100644 --- a/src/cmd/htmlroff/t20.c +++ b/src/cmd/htmlroff/t20.c @@ -13,7 +13,7 @@ void r_pm(int argc, Rune **argv) { int i; - + if(argc == 1){ printds(0); return; @@ -30,9 +30,9 @@ void r_tm(Rune *name) { Rune *line; - + USED(name); - + line = readline(CopyMode); fprint(2, "%S\n", line); free(line); @@ -42,7 +42,7 @@ void r_ab(Rune *name) { USED(name); - + r_tm(L("ab")); exits(".ab"); } @@ -76,4 +76,3 @@ t20init(void) addreq(L("pm"), r_pm, -1); addreq(L("fl"), r_fl, 0); } - diff --git a/src/cmd/htmlroff/t3.c b/src/cmd/htmlroff/t3.c index e54573c1..354ffc2a 100644 --- a/src/cmd/htmlroff/t3.c +++ b/src/cmd/htmlroff/t3.c @@ -37,7 +37,7 @@ t3init(void) nr(L(".o"), eval(L("1i"))); nr(L(".o0"), eval(L("1i"))); nr(L(".p"), eval(L("11i"))); - + addreq(L("pl"), r_warn, -1); addreq(L("bp"), r_nop, -1); addreq(L("pn"), r_warn, -1); @@ -46,4 +46,3 @@ t3init(void) addreq(L("mk"), r_nop, -1); addreq(L("rt"), r_warn, -1); } - diff --git a/src/cmd/htmlroff/t4.c b/src/cmd/htmlroff/t4.c index 157169de..8a301321 100644 --- a/src/cmd/htmlroff/t4.c +++ b/src/cmd/htmlroff/t4.c @@ -1,7 +1,7 @@ #include "a.h" /* - * 4 - Text filling, centering, and adjusting. + * 4 - Text filling, centering, and adjusting. * "\ " - unbreakable space * .n register - length of last line * nl register - text baseline position on this page @@ -66,7 +66,7 @@ void r_ad(int argc, Rune **argv) { int c, n; - + nr(L(".j"), getnr(L(".j"))|1); if(argc < 2) return; @@ -133,10 +133,9 @@ t4init(void) addreq(L("ad"), r_ad, -1); addreq(L("na"), r_na, 0); addreq(L("ce"), r_ce, -1); - + addesc(' ', e_space, 0); addesc('p', e_warn, 0); addesc('&', e_amp, 0); addesc('c', e_c, 0); } - diff --git a/src/cmd/htmlroff/t5.c b/src/cmd/htmlroff/t5.c index cb951951..226da09b 100644 --- a/src/cmd/htmlroff/t5.c +++ b/src/cmd/htmlroff/t5.c @@ -49,7 +49,7 @@ sp(int v) { Rune buf[100]; double fv; - + br(); fv = v * 1.0/UPI; if(fv > 5) @@ -93,7 +93,7 @@ r_rs(int argc, Rune **argv) void t5init(void) -{ +{ addreq(L("vs"), r_vs, -1); addreq(L("ls"), r_ls, -1); addreq(L("sp"), r_sp, -1); @@ -107,4 +107,3 @@ t5init(void) nr(L(".ls"), 1); nr(L(".ls0"), 1); } - diff --git a/src/cmd/htmlroff/t6.c b/src/cmd/htmlroff/t6.c index 130f535f..3090cd26 100644 --- a/src/cmd/htmlroff/t6.c +++ b/src/cmd/htmlroff/t6.c @@ -71,7 +71,6 @@ t6init(void) addreq(L("ll"), r_ll, -1); addreq(L("in"), r_in, -1); addreq(L("ti"), r_ti, 1); - + nr(L(".l"), eval(L("6.5i"))); } - diff --git a/src/cmd/htmlroff/t7.c b/src/cmd/htmlroff/t7.c index 9936a44c..cee43927 100644 --- a/src/cmd/htmlroff/t7.c +++ b/src/cmd/htmlroff/t7.c @@ -36,7 +36,7 @@ runmacro(int dot, int argc, Rune **argv) Rune *p; int i; Mac *m; - + if(verbose && isupperrune(argv[0][0])) fprint(2, "run: %S\n", argv[0]); p = getds(argv[0]); if(p == nil){ @@ -71,7 +71,7 @@ popmacro(void) { int i; Mac *m; - + if(--nmstack < 0){ fprint(2, "%L: macro stack underflow\n"); return; @@ -94,7 +94,7 @@ runmacro1(Rune *name) { Rune *argv[2]; int obol; - + if(verbose) fprint(2, "outcb %p\n", outcb); obol = bol; argv[0] = name; @@ -134,7 +134,7 @@ popmacro1(void) /* * diversions * - * processed output diverted + * processed output diverted * dn dl registers vertical and horizontal size of last diversion * .z - current diversion name */ @@ -195,7 +195,7 @@ void r_ch(int argc, Rune **argv) { int i; - + if(argc == 2){ if(trap0 && runestrcmp(argv[1], trap0) == 0){ free(trap0); @@ -244,7 +244,7 @@ r_de(int argc, Rune **argv) fmtrunestrcpy(&fmt, p); len = runestrlen(end); while((p = readline(CopyMode)) != nil){ - if(runestrncmp(p, end, len) == 0 + if(runestrncmp(p, end, len) == 0 && (p[len]==' ' || p[len]==0 || p[len]=='\t' || (p[len]=='\\' && p[len+1]=='}'))){ free(p); @@ -270,7 +270,7 @@ void r_ds(Rune *cmd) { Rune *name, *line, *p; - + name = copyarg(); line = readline(CopyMode); if(name == nil || line == nil){ @@ -335,7 +335,7 @@ flushdi(void) { int n; Rune *p; - + if(ndi == 0 || difmtinit == 0) return; fmtrune(&difmt, Uunformatted); @@ -448,7 +448,7 @@ void r_em(int argc, Rune **argv) { Rune buf[20]; - + USED(argc); runesnprint(buf, nelem(buf), ".%S\n", argv[1]); as(L("eof"), buf); @@ -458,7 +458,7 @@ int e_star(void) { Rune *p; - + p = getds(getname()); if(p) pushinputstring(p); @@ -514,7 +514,7 @@ e_dollar(void) void t7init(void) -{ +{ addreq(L("de"), r_de, -1); addreq(L("am"), r_de, -1); addreq(L("ig"), r_de, -1); @@ -529,15 +529,14 @@ t7init(void) addreq(L("wh"), r_wh, -1); addreq(L("ch"), r_ch, -1); addreq(L("dt"), r_dt, -1); - + addesc('$', e_dollar, CopyMode|ArgMode|HtmlMode); addesc('*', e_star, CopyMode|ArgMode|HtmlMode); addesc('t', e_t, CopyMode|ArgMode); addesc('a', e_a, CopyMode|ArgMode); addesc('\\', e_backslash, ArgMode|CopyMode); addesc('.', e_dot, CopyMode|ArgMode); - + ds(L("eof"), L(".sp 0.5i\n")); ds(L(".."), L("")); } - diff --git a/src/cmd/htmlroff/t8.c b/src/cmd/htmlroff/t8.c index ead5a020..511737ce 100644 --- a/src/cmd/htmlroff/t8.c +++ b/src/cmd/htmlroff/t8.c @@ -74,7 +74,7 @@ Rune* getdsnr(Rune *name, Reg *list) { Reg *s; - + for(s=list; s; s=s->next) if(runestrcmp(name, s->name) == 0) return s->val; @@ -91,7 +91,7 @@ void as(Rune *name, Rune *val) { Rune *p, *q; - + p = getds(name); if(p == nil) p = L(""); @@ -113,7 +113,7 @@ printds(int t) { int n, total; Reg *s; - + total = 0; for(s=dslist; s; s=s->next){ if(s->val) @@ -131,7 +131,7 @@ void nr(Rune *name, int val) { Rune buf[20]; - + runesnprint(buf, nelem(buf), "%d", val); _nr(name, buf); } @@ -152,7 +152,7 @@ Rune* getaf(Rune *name) { Reg *s; - + for(s=nrlist; s; s=s->next) if(runestrcmp(s->name, name) == 0) return s->fmt; @@ -163,7 +163,7 @@ void printnr(void) { Reg *r; - + for(r=nrlist; r; r=r->next) fprint(2, "%S %S %d\n", r->name, r->val, r->inc); } @@ -225,7 +225,7 @@ void r_af(int argc, Rune **argv) { USED(argc); - + af(argv[1], argv[2]); } @@ -234,7 +234,7 @@ void r_rr(int argc, Rune **argv) { int i; - + for(i=1; i<argc; i++) _nr(argv[i], nil); } @@ -244,7 +244,7 @@ void alpha(Rune *buf, int n, int a) { int i, v; - + i = 1; for(v=n; v>0; v/=26) i++; @@ -284,7 +284,7 @@ roman(Rune *buf, int n, int upper) Rune *p; char *q; struct romanv *r; - + if(upper) upper = 'A' - 'a'; if(n >= 5000 || n <= 0){ @@ -309,7 +309,7 @@ getname(void) { int i, c, cc; static Rune buf[100]; - + /* XXX add [name] syntax as in groff */ c = getnext(); if(c < 0) @@ -359,7 +359,7 @@ e_n(void) int inc, v, l; Rune *name, *fmt, buf[100]; Reg *s; - + inc = getnext(); if(inc < 0) return -1; @@ -442,8 +442,7 @@ t8init(void) addreq(L("af"), r_af, 2); addreq(L("rr"), r_rr, -1); addreq(L("pnr"), r_pnr, 0); - + addesc('n', e_n, CopyMode|ArgMode|HtmlMode); addesc('g', e_g, 0); } - diff --git a/src/cmd/htmlroff/t9.c b/src/cmd/htmlroff/t9.c index c9e04564..6f4c4d6c 100644 --- a/src/cmd/htmlroff/t9.c +++ b/src/cmd/htmlroff/t9.c @@ -3,4 +3,3 @@ */ XXX - diff --git a/src/cmd/htmlroff/util.c b/src/cmd/htmlroff/util.c index 99e99543..15dd4c74 100644 --- a/src/cmd/htmlroff/util.c +++ b/src/cmd/htmlroff/util.c @@ -4,7 +4,7 @@ void* emalloc(uint n) { void *v; - + v = mallocz(n, 1); if(v == nil) sysfatal("out of memory"); @@ -15,7 +15,7 @@ char* estrdup(char *s) { char *t; - + t = strdup(s); if(t == nil) sysfatal("out of memory"); @@ -38,7 +38,7 @@ void* erealloc(void *ov, uint n) { void *v; - + v = realloc(ov, n); if(v == nil) sysfatal("out of memory"); @@ -50,7 +50,7 @@ erunesmprint(char *fmt, ...) { Rune *s; va_list arg; - + va_start(arg, fmt); s = runevsmprint(fmt, arg); va_end(arg); @@ -64,7 +64,7 @@ esmprint(char *fmt, ...) { char *s; va_list arg; - + va_start(arg, fmt); s = vsmprint(fmt, arg); va_end(arg); @@ -77,7 +77,7 @@ void warn(char *fmt, ...) { va_list arg; - + fprint(2, "htmlroff: %L: "); va_start(arg, fmt); vfprint(2, fmt, arg); @@ -120,4 +120,3 @@ L(char *s) hash[h] = l; return l->r; } - |