64-bit fixes. [jmk] --rw-rw-r-- M 107020 glenda sys 41032 Nov 19 21:00 sys/src/cmd/ms2html.c /n/sourcesdump/2005/1119/plan9/sys/src/cmd/ms2html.c:25,30 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/ms2html.c:25,32 }; char *delim = "$$"; + char *basename; + char *title; int eqnmode; int quiet; /n/sourcesdump/2005/1119/plan9/sys/src/cmd/ms2html.c:38,45 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/ms2html.c:40,48 int ifwastrue[Maxif]; int list, listnum, example; - int hangingau, hangingdt, hanginghead; + int hangingau, hangingdt, hanginghead, hangingcenter; int indirective, paragraph, sol, titleseen, ignore_nl, weBref; + void dohangingcenter(void); typedef struct Goobie Goobie; typedef struct Goobieif Goobieif; /n/sourcesdump/2005/1119/plan9/sys/src/cmd/ms2html.c:1363,1369 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/ms2html.c:1366,1372 static void usage(void) { - sysfatal("Usage: %s\n", argv0); + sysfatal("usage: ms2html [-q] [-b basename] [-d '$$'] [-t title]\n"); } void /n/sourcesdump/2005/1119/plan9/sys/src/cmd/ms2html.c:1371,1376 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/ms2html.c:1374,1385 { quiet = 1; ARGBEGIN { + case 't': + title = EARGF(usage()); + break; + case 'b': + basename = EARGF(usage()); + break; case 'q': quiet = 0; break; /n/sourcesdump/2005/1119/plan9/sys/src/cmd/ms2html.c:1580,1585 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/ms2html.c:1589,1595 g_SH(int, char**) { dohanginghead(); + dohangingcenter(); closel(); closefont(); Bprint(&bout, "", HH); /n/sourcesdump/2005/1119/plan9/sys/src/cmd/ms2html.c:1594,1599 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/ms2html.c:1604,1610 closel(); closefont(); + dohangingcenter(); if(argc == 1) level = 0; else { /n/sourcesdump/2005/1119/plan9/sys/src/cmd/ms2html.c:1624,1655 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/ms2html.c:1635,1679 closefont(); if(!titleseen){ - /* get base part of filename */ - p = strrchr(ssp->filename, '/'); - if(p == nil) - p = ssp->filename; - else - p++; - strncpy(name, p, sizeof(name)); - name[sizeof(name)-1] = 0; - - /* dump any extensions */ - np = strchr(name, '.'); - if(np) - *np = 0; - + if(!title){ + /* get base part of filename */ + p = strrchr(ssp->filename, '/'); + if(p == nil) + p = ssp->filename; + else + p++; + strncpy(name, p, sizeof(name)); + name[sizeof(name)-1] = 0; + + /* dump any extensions */ + np = strchr(name, '.'); + if(np) + *np = 0; + title = p; + } Bprint(&bout, "\n"); - Bprint(&bout, "%s\n", p); + Bprint(&bout, "%s\n", title); Bprint(&bout, "\n"); Bprint(&bout, "\n"); titleseen = 1; } + Bprint(&bout, "
"); + hangingcenter = 1; Bprint(&bout, "", 1); hanginghead = 1; } void + dohangingcenter(void) + { + if(hangingcenter){ + Bprint(&bout, "
"); + hangingcenter = 1; + } + } + + void g_AU(int, char**) { closel(); /n/sourcesdump/2005/1119/plan9/sys/src/cmd/ms2html.c:1895,1901 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/ms2html.c:1919,1926 g_AB(int, char**) { closel(); - Bprint(&bout, "

ABSTRACT

\n"); + dohangingcenter(); + Bprint(&bout, "

ABSTRACT

\n"); } void /n/sourcesdump/2005/1119/plan9/sys/src/cmd/ms2html.c:2071,2082 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/ms2html.c:2096,2111 else return; - p = strrchr(sstack[0].filename, '/'); - if(p != nil) - p++; - else - p = sstack[0].filename; - snprint(name, sizeof(name), "%s.%d%d.gif", p, getpid(), gif++); + if(basename) + p = basename; + else{ + p = strrchr(sstack[0].filename, '/'); + if(p != nil) + p++; + else + p = sstack[0].filename; + } + snprint(name, sizeof(name), "%s.%d.gif", p, gif++); fd = create(name, OWRITE, 0664); if(fd < 0){ fprint(2, "ms2html: can't create %s: %r\n", name); /n/sourcesdump/2005/1119/plan9/sys/src/cmd/ms2html.c:2106,2113 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/ms2html.c:2135,2142 close(fd); close(pfd[0]); fprint(pfd[1], ".ll 7i\n"); - fprint(pfd[1], ".EQ\ndelim %s\n.EN\n", delim); - fprint(pfd[1], ".%s\n", argv[0]); + /* fprint(pfd[1], ".EQ\ndelim %s\n.EN\n", delim); */ + /* fprint(pfd[1], ".%s\n", argv[0]); */ for(;;){ p = Brdline(&ssp->in, '\n'); if(p == nil)