diff options
| author | Charles.Forsyth <devnull@localhost> | 2009-05-05 13:12:23 +0000 |
|---|---|---|
| committer | Charles.Forsyth <devnull@localhost> | 2009-05-05 13:12:23 +0000 |
| commit | 30dcb98c58694ef9d5678fc230695a51910c8314 (patch) | |
| tree | 93995b9bf9bd4f0b98247416019814a6044eac39 | |
| parent | ff44be6888e2b67d8d1f71700b08f24bff067b80 (diff) | |
20090505-1411
| -rw-r--r-- | CHANGES | 4 | ||||
| -rw-r--r-- | appl/cmd/man2html.b | 26 | ||||
| -rw-r--r-- | dis/man2html.dis | bin | 16111 -> 16391 bytes | |||
| -rw-r--r-- | include/version.h | 2 | ||||
| -rw-r--r-- | lib/mimetype | 1 | ||||
| -rw-r--r-- | man/1/man | 13 |
6 files changed, 39 insertions, 7 deletions
@@ -1,3 +1,7 @@ +20090505 + add -h/-t header/trailer options to man2html +20090430 + filter-deflate(2), appl/lib/^(inflate.b deflate.b): changes from mjl to support zlib headers for deflate streams as well as gzip's 20090417 add m4(1) in its initial form (might split the macro processing proper off into a library module) 20090409 diff --git a/appl/cmd/man2html.b b/appl/cmd/man2html.b index 21f83284..f32c4fbd 100644 --- a/appl/cmd/man2html.b +++ b/appl/cmd/man2html.b @@ -16,6 +16,8 @@ include "daytime.m"; include "string.m"; str: String; +include "arg.m"; + Man2html: module { init: fn(ctxt: ref Draw->Context, args: list of string); @@ -315,10 +317,12 @@ Global: adt { softp: fn(g: self ref Global): string; }; +header := "<HTML><HEAD>"; +trailer := "</BODY></HTML>"; usage() { - sys->fprint(stderr, "Usage: man2html file [section]\n"); + sys->fprint(stderr, "Usage: man2html [-h header] [-t trailer] file [section]\n"); raise "fail:usage"; } @@ -329,11 +333,20 @@ init(nil: ref Draw->Context, args: list of string) stderr = sys->fildes(2); str = load String String->PATH; dt = load Daytime Daytime->PATH; - g := Global_init(); - if(args != nil) - args = tl args; + arg := load Arg Arg->PATH; + arg->init(args); + arg->setusage("man2html [-h header] [-t trailer] file [section]"); + while((o := arg->opt()) != 0) + case o { + 'h' => header = arg->earg(); + 't' => trailer = arg->earg(); + * => arg->usage(); + } + args = arg->argv(); if(args == nil) - usage(); + arg->usage(); + arg = nil; + g := Global_init(); page := hd args; args = tl args; section := "1"; @@ -341,6 +354,7 @@ init(nil: ref Draw->Context, args: list of string) section = hd args; hit := Hit ("", "man", section, page); domanpage(g, hit); + g.print(trailer+"\n"); g.bufio->g.bout.flush(); } @@ -1342,7 +1356,7 @@ title(g: ref Global, t: string, search: int) { if(search) ; # not yet used - g.print("<HTML><HEAD>\n"); + g.print(header+"\n"); g.print(sprint("<TITLE>Inferno's %s</TITLE>\n", demark(t))); g.print("</HEAD>\n"); g.print("<BODY bgcolor=\"#FFFFFF\">\n"); diff --git a/dis/man2html.dis b/dis/man2html.dis Binary files differindex 3e520316..edd98ae2 100644 --- a/dis/man2html.dis +++ b/dis/man2html.dis diff --git a/include/version.h b/include/version.h index 61c9db13..a7868e52 100644 --- a/include/version.h +++ b/include/version.h @@ -1 +1 @@ -#define VERSION "Fourth Edition (20090430)" +#define VERSION "Fourth Edition (20090505)" diff --git a/lib/mimetype b/lib/mimetype index 05c52c3c..dc34a6b9 100644 --- a/lib/mimetype +++ b/lib/mimetype @@ -62,6 +62,7 @@ .html text html - m .ico image x-icon - y .ief image ief - y +.iso application octet-stream - y # ISO9660 image .jad text vnd.sun.j2me.app-descriptor - y .jar application java-archive - y .jfif image jpeg - y @@ -33,6 +33,11 @@ print or find manual pages .I file ... .br .B man2html +[ +.BI -h " header" +] [ +.BI -t " trailer" +] .I file [ .I section @@ -126,6 +131,14 @@ It is assumed the input is a manual page, in the given .I section (default: 1). +The optional +.I header +string replaces the default header +.B "<HTML><HEAD>" +and the optional +.I trailer +string replaces the default trailer +.BR "</BODY></HTML>" . .PP .I Man2txt converts |
