History

20090505-1411

Charles.Forsyth committed 17 years ago

Commit aef75d61 parent c76c60b6 files · +38 −6Browse files

Unified · Split

6 files
  1. CHANGES +4 −0
  2. appl/cmd/man2html.b +20 −6
  3. dis/man2html.dis +0 −0
  4. include/version.h +1 −1
  5. lib/mimetype +1 −0
  6. man/1/man +13 −0
CHANGES+4−0
@@ -1,3 +1,7 @@
1+20090505
2+ add -h/-t header/trailer options to man2html
3+20090430
4+ filter-deflate(2), appl/lib/^(inflate.b deflate.b): changes from mjl to support zlib headers for deflate streams as well as gzip's
15 20090417
26 add m4(1) in its initial form (might split the macro processing proper off into a library module)
37 20090409
appl/cmd/man2html.b+20−6
@@ -16,6 +16,8 @@ include "daytime.m"; · 15 unmodified lines
1616 include "string.m";
1717 str: String;
1818
19+include "arg.m";
20+
1921 Man2html: module
2022 {
2123 init: fn(ctxt: ref Draw->Context, args: list of string);
@@ -315,10 +317,12 @@ Global: adt { · 293 unmodified lines
315317 softp: fn(g: self ref Global): string;
316318 };
317319
320+header := "<HTML><HEAD>";
321+trailer := "</BODY></HTML>";
318322
319323 usage()
320324 {
321− sys->fprint(stderr, "Usage: man2html file [section]\n");
325+ sys->fprint(stderr, "Usage: man2html [-h header] [-t trailer] file [section]\n");
322326 raise "fail:usage";
323327 }
324328
@@ -329,11 +333,20 @@ init(nil: ref Draw->Context, args: list of string) · 4 unmodified lines
329333 stderr = sys->fildes(2);
330334 str = load String String->PATH;
331335 dt = load Daytime Daytime->PATH;
332− g := Global_init();
333− if(args != nil)
334− args = tl args;
336+ arg := load Arg Arg->PATH;
337+ arg->init(args);
338+ arg->setusage("man2html [-h header] [-t trailer] file [section]");
339+ while((o := arg->opt()) != 0)
340+ case o {
341+ 'h' => header = arg->earg();
342+ 't' => trailer = arg->earg();
343+ * => arg->usage();
344+ }
345+ args = arg->argv();
335346 if(args == nil)
336− usage();
347+ arg->usage();
348+ arg = nil;
349+ g := Global_init();
337350 page := hd args;
338351 args = tl args;
339352 section := "1";
@@ -341,6 +354,7 @@ init(nil: ref Draw->Context, args: list of string) · 1 unmodified line
341354 section = hd args;
342355 hit := Hit ("", "man", section, page);
343356 domanpage(g, hit);
357+ g.print(trailer+"\n");
344358 g.bufio->g.bout.flush();
345359 }
346360
@@ -1342,7 +1356,7 @@ title(g: ref Global, t: string, search: int) · 995 unmodified lines
13421356 {
13431357 if(search)
13441358 ; # not yet used
1345− g.print("<HTML><HEAD>\n");
1359+ g.print(header+"\n");
13461360 g.print(sprint("<TITLE>Inferno's %s</TITLE>\n", demark(t)));
13471361 g.print("</HEAD>\n");
13481362 g.print("<BODY bgcolor=\"#FFFFFF\">\n");
dis/man2html.dis+0−0

Binary file not shown.

include/version.h+1−1
@@ -1 +1 @@
1−#define VERSION "Fourth Edition (20090430)"
1+#define VERSION "Fourth Edition (20090505)"
lib/mimetype+1−0
@@ -62,6 +62,7 @@ · 61 unmodified lines
6262 .html text html - m
6363 .ico image x-icon - y
6464 .ief image ief - y
65+.iso application octet-stream - y # ISO9660 image
6566 .jad text vnd.sun.j2me.app-descriptor - y
6667 .jar application java-archive - y
6768 .jfif image jpeg - y
man/1/man+13−0
@@ -33,6 +33,11 @@ print or find manual pages · 32 unmodified lines
3333 .I file ...
3434 .br
3535 .B man2html
36+[
37+.BI -h " header"
38+] [
39+.BI -t " trailer"
40+]
3641 .I file
3742 [
3843 .I section
@@ -126,6 +131,14 @@ It is assumed the input · 87 unmodified lines
126131 is a manual page, in the given
127132 .I section
128133 (default: 1).
134+The optional
135+.I header
136+string replaces the default header
137+.B "<HTML><HEAD>"
138+and the optional
139+.I trailer
140+string replaces the default trailer
141+.BR "</BODY></HTML>" .
129142 .PP
130143 .I Man2txt
131144 converts

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t