Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
9278 | navichok26 | 1 | /* |
2 | * Here are the routines of man2html that output a HREF string. |
||
3 | */ |
||
4 | |||
5 | #include |
||
6 | #include |
||
7 | #include |
||
8 | #include |
||
9 | #include |
||
10 | #include "defs.h" |
||
11 | |||
12 | /* |
||
13 | * The default is to use cgibase. With relative html style |
||
14 | * we generate URLs of the form "../manX/page.html". |
||
15 | */ |
||
16 | static int relat_html_style = 0; |
||
17 | |||
18 | /* |
||
19 | * The default is to use cgibase. With current html style |
||
20 | * we generate URLs of the form "./page.html". |
||
21 | */ |
||
22 | static int current_html_style = 0; |
||
23 | |||
24 | /* |
||
25 | * Either the user is non-local (or local, but using httpd), |
||
26 | * in which case we use http:/cgi-bin, or the user is local |
||
27 | * and uses lynx, and we use lynxcgi:/home/httpd/cgi-bin. |
||
28 | */ |
||
29 | |||
30 | static char *man2htmlpath = "/cgi-bin/man/man2html"; /* default */ |
||
31 | static char *cgibase_format = "http://%s"; /* host.domain:port */ |
||
32 | static char *cgibase_ll_format = "lynxcgi:%s"; /* directory */ |
||
33 | static char *cgibase = "http://localhost"; /* default */ |
||
34 | |||
35 | /* |
||
36 | * Separator between URL and argument string. |
||
37 | * |
||
38 | * With http: |
||
39 | * with PATH_INFO=/a/b and QUERY_STRING=c+d+e and args $1=c, $2=d, $3=e. |
||
40 | * With lynxcgi: |
||
41 | */ |
||
42 | static char sep = '?'; /* or '/' */ |
||
43 | |||
44 | /* What shall we say in case of relat_html_style? */ |
||
45 | static char *signature = " |
||
46 | "This document was created by\n" |
||
47 | "man2html,\n" |
||
48 | "using the manual pages. |
||
49 | "%s\n"; |
||
50 | |||
51 | #define TIMEFORMAT "%T GMT, %B %d, %Y" |
||
52 | #define TIMEBUFSZ 500 |
||
53 | |||
54 | void print_sig() |
||
55 | { |
||
56 | char timebuf[TIMEBUFSZ]; |
||
57 | struct tm *timetm; |
||
58 | time_t clock; |
||
59 | |||
60 | timebuf[0] = 0; |
||
61 | #ifdef TIMEFORMAT |
||
62 | sprintf(timebuf, "Time: "); |
||
63 | clock=time(NULL); |
||
64 | timetm=localtime(&clock); |
||
65 | snprintf(timebuf, TIMEBUFSZ, "%s%s", timebuf, asctime(timetm)); |
||
66 | timebuf[TIMEBUFSZ-1] = 0; |
||
67 | #endif |
||
68 | fprintf(out, signature, timebuf); |
||
69 | } |
||
70 | |||
71 | void |
||
72 | include_file_html(char *g) { |
||
73 | fprintf(out, "%s>", g,g); |
||
74 | } |
||
75 | |||
76 | void |
||
77 | man_page_html(char *sec, char *h) { |
||
78 | if (current_html_style) { |
||
79 | if (!h) |
||
80 | fprintf(out, "" |
||
81 | "Return to Main Contents"); |
||
82 | else |
||
83 | fprintf(out, "%s", |
||
84 | h, h); |
||
85 | } else if (relat_html_style) { |
||
86 | if (!h) |
||
87 | fprintf(out, "" |
||
88 | "Return to Main Contents"); |
||
89 | else |
||
90 | fprintf(out, "%s", |
||
91 | sec, h, sec, h); |
||
92 | } else { |
||
93 | if (!h) |
||
94 | fprintf(out, "Return to Main Contents", |
||
95 | cgibase, man2htmlpath); |
||
96 | else if (!sec) |
||
97 | fprintf(out, "%s", |
||
98 | cgibase, man2htmlpath, sep, h, h); |
||
99 | else |
||
100 | fprintf(out, "%s", |
||
101 | cgibase, man2htmlpath, sep, sec, h, h); |
||
102 | } |
||
103 | } |
||
104 | |||
105 | void |
||
106 | ftp_html(char *f) { |
||
107 | fprintf(out, "%s", f, f); |
||
108 | } |
||
109 | |||
110 | void |
||
111 | www_html(char *f) { |
||
112 | fprintf(out, "%s", f, f); |
||
113 | } |
||
114 | |||
115 | void |
||
116 | mailto_html(char *g) { |
||
117 | fprintf(out, "%s", g, g); |
||
118 | } |
||
119 | |||
120 | void |
||
121 | url_html(char *g) { |
||
122 | fprintf(out, "%s", g, g); |
||
123 | } |