50 |
#include "path2url.h" |
#include "path2url.h" |
51 |
#include "const.h" |
#include "const.h" |
52 |
|
|
53 |
void src2html(char *, char *, int); |
void src2html(const char *, const char *, int); |
54 |
int makedupindex(void); |
int makedupindex(void); |
55 |
int makedefineindex(char *, int, STRBUF *); |
int makedefineindex(const char *, int, STRBUF *); |
56 |
int makefileindex(char *, STRBUF *); |
int makefileindex(const char *, STRBUF *); |
57 |
void makeincludeindex(); |
void makeincludeindex(); |
58 |
|
|
59 |
#if defined(_WIN32) && !defined(__CYGWIN__) |
#if defined(_WIN32) && !defined(__CYGWIN__) |
65 |
* Global data. |
* Global data. |
66 |
*/ |
*/ |
67 |
int w32 = W32; /* Windows32 environment */ |
int w32 = W32; /* Windows32 environment */ |
68 |
char *www = "http://www.gnu.org/software/global/"; |
const char *www = "http://www.gnu.org/software/global/"; |
69 |
char *include_header; |
const char *include_header; |
70 |
int file_count = 0; |
int file_count = 0; |
71 |
int sep = '/'; |
int sep = '/'; |
72 |
char *save_config; |
const char *save_config; |
73 |
char *save_argv; |
const char *save_argv; |
74 |
|
|
75 |
char cwdpath[MAXPATHLEN]; |
char cwdpath[MAXPATHLEN]; |
76 |
char dbpath[MAXPATHLEN]; |
char dbpath[MAXPATHLEN]; |
82 |
char gtags_path[MAXFILLEN]; |
char gtags_path[MAXFILLEN]; |
83 |
char global_path[MAXFILLEN]; |
char global_path[MAXFILLEN]; |
84 |
char findcom[MAXFILLEN]; |
char findcom[MAXFILLEN]; |
85 |
char *null_device = NULL_DEVICE; |
const char *null_device = NULL_DEVICE; |
86 |
char *tmpdir = "/tmp"; |
const char *tmpdir = "/tmp"; |
87 |
|
|
88 |
/* |
/* |
89 |
* options |
* options |
115 |
int enable_idutils; /* 1: enable idutils */ |
int enable_idutils; /* 1: enable idutils */ |
116 |
int enable_xhtml; /* 1: enable XHTML */ |
int enable_xhtml; /* 1: enable XHTML */ |
117 |
|
|
118 |
char *action_value; |
const char *action_value; |
119 |
char *id_value; |
const char *id_value; |
120 |
char *cgidir; |
const char *cgidir; |
121 |
char *main_func = "main"; |
const char *main_func = "main"; |
122 |
char *style_sheet; |
const char *style_sheet; |
123 |
char *cvsweb_url; |
const char *cvsweb_url; |
124 |
char *cvsweb_cvsroot; |
const char *cvsweb_cvsroot; |
125 |
char *gtagslabel; |
const char *gtagslabel; |
126 |
char *title; |
const char *title; |
127 |
|
|
128 |
/* |
/* |
129 |
* Constant values. |
* Constant values. |
130 |
*/ |
*/ |
131 |
char *title_define_index = "DEFINITIONS"; |
const char *title_define_index = "DEFINITIONS"; |
132 |
char *title_file_index = "FILES"; |
const char *title_file_index = "FILES"; |
133 |
char *title_included_from = "INCLUDED FROM"; |
const char *title_included_from = "INCLUDED FROM"; |
134 |
/* |
/* |
135 |
* Function header items. |
* Function header items. |
136 |
*/ |
*/ |
137 |
char *anchor_label[] = { |
const char *anchor_label[] = { |
138 |
"<", |
"<", |
139 |
">", |
">", |
140 |
"^", |
"^", |
144 |
"index", |
"index", |
145 |
"help" |
"help" |
146 |
}; |
}; |
147 |
char *anchor_icons[] = { |
const char *anchor_icons[] = { |
148 |
"left", |
"left", |
149 |
"right", |
"right", |
150 |
"first", |
"first", |
154 |
"index", |
"index", |
155 |
"help" |
"help" |
156 |
}; |
}; |
157 |
char *anchor_comment[] = { |
const char *anchor_comment[] = { |
158 |
"previous", |
"previous", |
159 |
"next", |
"next", |
160 |
"first", |
"first", |
164 |
"index", |
"index", |
165 |
"help" |
"help" |
166 |
}; |
}; |
167 |
char *anchor_msg[] = { |
const char *anchor_msg[] = { |
168 |
"Previous definition.", |
"Previous definition.", |
169 |
"Next definition.", |
"Next definition.", |
170 |
"First definition in this file.", |
"First definition in this file.", |
174 |
"Return to index page.", |
"Return to index page.", |
175 |
"You are seeing now." |
"You are seeing now." |
176 |
}; |
}; |
177 |
char *back_icon = "back"; |
const char *back_icon = "back"; |
178 |
char *dir_icon = "dir"; |
const char *dir_icon = "dir"; |
179 |
char *c_icon = "c"; |
const char *c_icon = "c"; |
180 |
char *file_icon = "text"; |
const char *file_icon = "text"; |
181 |
|
|
182 |
/* |
/* |
183 |
* Configuration parameters. |
* Configuration parameters. |
187 |
char stabs[8]; /* tab skip (string) */ |
char stabs[8]; /* tab skip (string) */ |
188 |
int full_path = 0; /* file index format */ |
int full_path = 0; /* file index format */ |
189 |
int map_file = 1; /* 1: create MAP file */ |
int map_file = 1; /* 1: create MAP file */ |
190 |
char *icon_list = NULL; /* use icon list */ |
const char *icon_list = NULL; /* use icon list */ |
191 |
char *icon_suffix = "png"; /* icon suffix (jpg, png etc) */ |
const char *icon_suffix = "png"; /* icon suffix (jpg, png etc) */ |
192 |
char *icon_spec = "border='0' align='top'";/* parameter in IMG tag */ |
const char *icon_spec = "border='0' align='top'";/* parameter in IMG tag*/ |
193 |
char *prolog_script = NULL; /* include script at first */ |
const char *prolog_script = NULL; /* include script at first */ |
194 |
char *epilog_script = NULL; /* include script at last */ |
const char *epilog_script = NULL; /* include script at last */ |
195 |
int show_position = 0; /* show current position */ |
int show_position = 0; /* show current position */ |
196 |
int table_list = 0; /* tag list using table tag */ |
int table_list = 0; /* tag list using table tag */ |
197 |
int colorize_warned_line = 0; /* colorize warned line */ |
int colorize_warned_line = 0; /* colorize warned line */ |
198 |
char *script_alias = "/cgi-bin"; /* script alias of WWW server */ |
const char *script_alias = "/cgi-bin"; /* script alias of WWW server */ |
199 |
char *gzipped_suffix = "ghtml"; /* suffix of gzipped html file */ |
const char *gzipped_suffix = "ghtml"; /* suffix of gzipped html file */ |
200 |
char *normal_suffix = "html"; /* suffix of normal html file */ |
const char *normal_suffix = "html"; /* suffix of normal html file */ |
201 |
char *HTML; |
const char *HTML; |
202 |
char *action = "cgi-bin/global.cgi"; /* default action */ |
const char *action = "cgi-bin/global.cgi";/* default action */ |
203 |
char *saction; /* safe action */ |
const char *saction; /* safe action */ |
204 |
char *id = NULL; /* id (default non) */ |
const char *id = NULL; /* id (default non) */ |
205 |
int cgi = 1; /* 1: make cgi-bin/ */ |
int cgi = 1; /* 1: make cgi-bin/ */ |
206 |
int definition_header=NO_HEADER; /* (NO|BEFORE|RIGHT|AFTER)_HEADER */ |
int definition_header=NO_HEADER; /* (NO|BEFORE|RIGHT|AFTER)_HEADER */ |
207 |
char *htags_options = NULL; |
const char *htags_options = NULL; |
208 |
char *include_file_suffixes = "h,hxx,hpp,H,inc.php"; |
const char *include_file_suffixes = "h,hxx,hpp,H,inc.php"; |
209 |
static char *langmap = DEFAULTLANGMAP; |
static const char *langmap = DEFAULTLANGMAP; |
210 |
|
|
211 |
static struct option const long_options[] = { |
static struct option const long_options[] = { |
212 |
{"alphabet", no_argument, NULL, 'a'}, |
{"alphabet", no_argument, NULL, 'a'}, |
316 |
char *_; |
char *_; |
317 |
int i; |
int i; |
318 |
struct map { |
struct map { |
319 |
char *name; |
const char *name; |
320 |
char *value; |
const char *value; |
321 |
} tab[] = { |
} tab[] = { |
322 |
{"@page_begin@", NULL}, |
{"@page_begin@", NULL}, |
323 |
{"@page_end@", NULL}, |
{"@page_end@", NULL}, |
375 |
* Read templete file and evaluate macros. |
* Read templete file and evaluate macros. |
376 |
*/ |
*/ |
377 |
while ((_ = strbuf_fgets(sb, ip, STRBUF_NOCRLF)) != NULL) { |
while ((_ = strbuf_fgets(sb, ip, STRBUF_NOCRLF)) != NULL) { |
378 |
char *p; |
const char *p; |
379 |
|
|
380 |
/* Pick up macro name */ |
/* Pick up macro name */ |
381 |
for (p = _; !regexec(&preg, p, 2, pmatch, 0); p += pmatch[0].rm_eo) { |
for (p = _; !regexec(&preg, p, 2, pmatch, 0); p += pmatch[0].rm_eo) { |
382 |
char *start = p + pmatch[0].rm_so; |
const char *start = p + pmatch[0].rm_so; |
383 |
int length = pmatch[0].rm_eo - pmatch[0].rm_so; |
int length = pmatch[0].rm_eo - pmatch[0].rm_so; |
384 |
|
|
385 |
/* print before macro */ |
/* print before macro */ |
392 |
die("something wrong."); |
die("something wrong."); |
393 |
/* print macro value */ |
/* print macro value */ |
394 |
if (i < tabsize) { |
if (i < tabsize) { |
395 |
char *q; |
const char *q; |
396 |
/* |
/* |
397 |
* Double quote should be quoted using '\\'. |
* Double quote should be quoted using '\\'. |
398 |
*/ |
*/ |
431 |
makebless(file) |
makebless(file) |
432 |
const char *file; |
const char *file; |
433 |
{ |
{ |
434 |
char *save = action; |
const char *save = action; |
435 |
action = saction; |
action = saction; |
436 |
generate_file(distpath, file); |
generate_file(distpath, file); |
437 |
action = save; |
action = save; |
487 |
makehelp(file) |
makehelp(file) |
488 |
const char *file; |
const char *file; |
489 |
{ |
{ |
490 |
char **label = icon_list ? anchor_comment : anchor_label; |
const char **label = icon_list ? anchor_comment : anchor_label; |
491 |
char **icons = anchor_icons; |
const char **icons = anchor_icons; |
492 |
char **msg = anchor_msg; |
const char **msg = anchor_msg; |
493 |
int n, last = 7; |
int n, last = 7; |
494 |
FILE *op; |
FILE *op; |
495 |
|
|
740 |
int total; |
int total; |
741 |
{ |
{ |
742 |
FILE *ip; |
FILE *ip; |
743 |
char *_, *p; |
const char *_; |
744 |
int count = 0; |
int count = 0; |
745 |
char command[MAXFILLEN]; |
char command[MAXFILLEN], path[MAXPATHLEN]; |
|
char path[MAXPATHLEN]; |
|
746 |
STRBUF *sb = strbuf_open(0); |
STRBUF *sb = strbuf_open(0); |
747 |
|
|
748 |
if (other_files && !dynamic) |
if (other_files && !dynamic) |
754 |
die("cannot execute command '%s'.", command); |
die("cannot execute command '%s'.", command); |
755 |
while ((_ = strbuf_fgets(sb, ip, STRBUF_NOCRLF)) != NULL) { |
while ((_ = strbuf_fgets(sb, ip, STRBUF_NOCRLF)) != NULL) { |
756 |
int notsource = 0; |
int notsource = 0; |
757 |
|
const char *p; |
758 |
|
|
759 |
if (*_ == ' ') { |
if (*_ == ' ') { |
760 |
if (!other_files) |
if (!other_files) |
845 |
STRBUF *sb = strbuf_open(0); |
STRBUF *sb = strbuf_open(0); |
846 |
STRBUF *ib = strbuf_open(0); |
STRBUF *ib = strbuf_open(0); |
847 |
char command[MAXFILLEN]; |
char command[MAXFILLEN]; |
848 |
char *_; |
const char *_; |
849 |
|
|
850 |
if (include_header) { |
if (include_header) { |
851 |
strbuf_puts_nl(sb, include_header); |
strbuf_puts_nl(sb, include_header); |
939 |
static void |
static void |
940 |
basic_check(void) |
basic_check(void) |
941 |
{ |
{ |
942 |
char *p; |
const char *p; |
943 |
|
|
944 |
/* |
/* |
945 |
* COMMAND EXISTENCE CHECK |
* COMMAND EXISTENCE CHECK |
1129 |
p = strdup(strbuf_value(sb)); |
p = strdup(strbuf_value(sb)); |
1130 |
if (p == NULL) |
if (p == NULL) |
1131 |
die("short of memory."); |
die("short of memory."); |
|
script_alias = p; |
|
1132 |
/* remove the last '/' */ |
/* remove the last '/' */ |
1133 |
p = script_alias + strlen(script_alias) - 1; |
q = p + strlen(p) - 1; |
1134 |
if (*p == '/') |
if (*q == '/') |
1135 |
*p = '\0'; |
*q = '\0'; |
1136 |
|
script_alias = p; |
1137 |
} |
} |
1138 |
if (getconfb("symbols")) /* for backward compatibility */ |
if (getconfb("symbols")) /* for backward compatibility */ |
1139 |
symbol = 1; |
symbol = 1; |
1322 |
STRBUF *save_c = strbuf_open(0); |
STRBUF *save_c = strbuf_open(0); |
1323 |
STRBUF *save_a = strbuf_open(0); |
STRBUF *save_a = strbuf_open(0); |
1324 |
int i; |
int i; |
1325 |
char *p; |
const char *p; |
1326 |
FILE *ip; |
FILE *ip; |
1327 |
|
|
1328 |
/* |
/* |
1390 |
{ |
{ |
1391 |
|
|
1392 |
STRBUF *sb = strbuf_open(0); |
STRBUF *sb = strbuf_open(0); |
1393 |
char *p, *opt = strdup(htags_options); |
const char *p, *opt = strdup(htags_options); |
1394 |
int count = 1; |
int count = 1; |
1395 |
int quote = 0; |
int quote = 0; |
1396 |
char **newargv; |
const char **newargv; |
1397 |
int i = 0, j = 1; |
int i = 0, j = 1; |
1398 |
|
|
1399 |
if (!opt) |
if (!opt) |
1422 |
strbuf_putc(sb, *p); |
strbuf_putc(sb, *p); |
1423 |
} |
} |
1424 |
} |
} |
1425 |
newargv = (char **)malloc(sizeof(char *) * (*argc + count + 1)); |
newargv = (const char **)malloc(sizeof(char *) * (*argc + count + 1)); |
1426 |
if (!newargv) |
if (!newargv) |
1427 |
die("Short of memory."); |
die("Short of memory."); |
1428 |
newargv[i++] = argv[0]; |
newargv[i++] = argv[0]; |
1434 |
while (j < *argc) |
while (j < *argc) |
1435 |
newargv[i++] = argv[j++]; |
newargv[i++] = argv[j++]; |
1436 |
newargv[i] = NULL; |
newargv[i] = NULL; |
1437 |
argv = newargv; |
argv = (char **)newargv; |
1438 |
*argc = i; |
*argc = i; |
1439 |
#ifdef DEBUG |
#ifdef DEBUG |
1440 |
for (i = 0; i < *argc; i++) |
for (i = 0; i < *argc; i++) |
1449 |
int argc; |
int argc; |
1450 |
char *argv[]; |
char *argv[]; |
1451 |
{ |
{ |
1452 |
char *path, *av = NULL; |
const char *path, *av = NULL; |
1453 |
int func_total, file_total; |
int func_total, file_total; |
1454 |
char arg_dbpath[MAXPATHLEN]; |
char arg_dbpath[MAXPATHLEN]; |
1455 |
char *index = NULL; |
const char *index = NULL; |
1456 |
int optchar; |
int optchar; |
1457 |
int option_index = 0; |
int option_index = 0; |
1458 |
time_t start_time, end_time, start_all_time, end_all_time, |
time_t start_time, end_time, start_all_time, end_all_time, |
1946 |
message(" gzipped files. (Please see 'HTML/.htaccess')\n"); |
message(" gzipped files. (Please see 'HTML/.htaccess')\n"); |
1947 |
} |
} |
1948 |
if (fflag || dynamic) { |
if (fflag || dynamic) { |
1949 |
char *path = (*action == '/') ? makepath("DOCUMENT_ROOT", action, NULL) : makepath("HTML", action, NULL); |
const char *path = (*action == '/') ? makepath("DOCUMENT_ROOT", action, NULL) : makepath("HTML", action, NULL); |
1950 |
|
|
1951 |
message(" You need to setup http server so that %s", path); |
message(" You need to setup http server so that %s", path); |
1952 |
message(" is executed as a CGI script. (DOCUMENT_ROOT means WWW server's data root.)\n"); |
message(" is executed as a CGI script. (DOCUMENT_ROOT means WWW server's data root.)\n"); |