Subversion Repositories Kolibri OS

Rev

Rev 9278 | Details | Compare with Previous | 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 		/* tolower() */
9
#include 		/* strlen() */
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
 */
9280 turbocat 16
//static int relat_html_style = 0;
9278 navichok26 17
 
18
/*
19
 * The default is to use cgibase. With current html style
20
 * we generate URLs of the form "./page.html".
21
 */
9280 turbocat 22
static int current_html_style = 1;
9278 navichok26 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
 
9280 turbocat 30
#if 0
31
 
9278 navichok26 32
static char *man2htmlpath = "/cgi-bin/man/man2html"; 	/* default */
33
static char *cgibase_format = "http://%s"; 		/* host.domain:port */
34
static char *cgibase_ll_format = "lynxcgi:%s"; 		/* directory */
35
static char *cgibase = "http://localhost";		/* default */
36
 
9280 turbocat 37
#endif
38
 
9278 navichok26 39
/*
40
 * Separator between URL and argument string.
41
 *
42
 * With http:/a/b?c+d+e the script is called
43
 * with PATH_INFO=/a/b and QUERY_STRING=c+d+e and args $1=c, $2=d, $3=e.
44
 * With lynxcgi:?c+d+e no PATH_INFO is possible.
45
 */
46
static char sep = '?';					/* or '/' */
47
 
48
/* What shall we say in case of relat_html_style? */
49
static char *signature = "
\n"
50
"This document was created by\n"
51
"man2html,\n"
52
"using the manual pages.
\n"
53
"%s\n";
54
 
55
#define TIMEFORMAT "%T GMT, %B %d, %Y"
56
#define TIMEBUFSZ	500
57
 
58
void print_sig()
59
{
60
    char timebuf[TIMEBUFSZ];
61
    struct tm *timetm;
62
    time_t clock;
63
 
64
    timebuf[0] = 0;
65
#ifdef TIMEFORMAT
66
    sprintf(timebuf, "Time: ");
67
    clock=time(NULL);
68
    timetm=localtime(&clock);
69
    snprintf(timebuf, TIMEBUFSZ, "%s%s", timebuf, asctime(timetm));
70
    timebuf[TIMEBUFSZ-1] = 0;
71
#endif
72
    fprintf(out, signature, timebuf);
73
}
74
 
75
void
76
include_file_html(char *g) {
77
     fprintf(out, "%s>", g,g);
78
}
79
 
80
void
81
man_page_html(char *sec, char *h) {
82
	if (current_html_style) {
83
		if (!h)
84
			fprintf(out, ""
85
			       "Return to Main Contents");
86
		else
87
			fprintf(out, "%s",
88
			       h, h);
9280 turbocat 89
#if 0
9278 navichok26 90
	} else if (relat_html_style) {
91
		if (!h)
92
			fprintf(out, ""
93
			       "Return to Main Contents");
94
		else
95
			fprintf(out, "%s",
96
			       sec, h, sec, h);
97
	} else {
98
		if (!h)
99
			fprintf(out, "Return to Main Contents",
100
			       cgibase, man2htmlpath);
101
		else if (!sec)
102
			fprintf(out, "%s",
103
			       cgibase, man2htmlpath, sep, h, h);
104
		else
105
			fprintf(out, "%s",
106
			       cgibase, man2htmlpath, sep, sec, h, h);
9280 turbocat 107
#endif
9278 navichok26 108
	}
109
}
110
 
9280 turbocat 111
 
9278 navichok26 112
void
113
ftp_html(char *f) {
114
     fprintf(out, "%s", f, f);
115
}
116
 
117
void
118
www_html(char *f) {
119
     fprintf(out, "%s", f, f);
120
}
121
 
122
void
123
mailto_html(char *g) {
124
     fprintf(out, "%s", g, g);
125
}
126
 
127
void
128
url_html(char *g) {
129
     fprintf(out, "%s", g, g);
130
}