55 |
FILE *DEFINES, *old, *STDOUT, *TAGS, *ALPHA = NULL; |
FILE *DEFINES, *old, *STDOUT, *TAGS, *ALPHA = NULL; |
56 |
STRBUF *sb = strbuf_open(0); |
STRBUF *sb = strbuf_open(0); |
57 |
STRBUF *url = strbuf_open(0); |
STRBUF *url = strbuf_open(0); |
|
char *_; |
|
|
char command[1024], buf[1024], alpha[32], alpha_f[32]; |
|
58 |
/* Index link */ |
/* Index link */ |
59 |
char *target = (Fflag) ? "mains" : "_top"; |
const char *target = (Fflag) ? "mains" : "_top"; |
60 |
char *indexlink; |
const char *indexlink; |
61 |
char *index_string = "Index Page"; |
const char *index_string = "Index Page"; |
62 |
|
char command[1024], buf[1024], alpha[32], alpha_f[32], *_; |
63 |
|
|
64 |
if (!aflag && !Fflag) |
if (!aflag && !Fflag) |
65 |
indexlink = "mains"; |
indexlink = "mains"; |
105 |
die("cannot fork."); |
die("cannot fork."); |
106 |
alpha[0] = '\0'; |
alpha[0] = '\0'; |
107 |
while ((_ = strbuf_fgets(sb, TAGS, STRBUF_NOCRLF)) != NULL) { |
while ((_ = strbuf_fgets(sb, TAGS, STRBUF_NOCRLF)) != NULL) { |
108 |
char *line, *tag; |
const char *tag, *line; |
109 |
char guide[1024], url_for_map[1024]; |
char guide[1024], url_for_map[1024]; |
110 |
|
|
111 |
count++; |
count++; |
112 |
tag = _; |
tag = _; |
113 |
message(" [%d/%d] adding %s", count, total, tag); |
message(" [%d/%d] adding %s", count, total, tag); |
114 |
if (aflag && (alpha[0] == '\0' || strncmp(tag, alpha, strlen(alpha)))) { |
if (aflag && (alpha[0] == '\0' || strncmp(tag, alpha, strlen(alpha)))) { |
115 |
char *msg = (alpha_count == 1) ? "definition is contained." : "definitions are contained."; |
const char *msg = (alpha_count == 1) ? "definition is contained." : "definitions are contained."; |
116 |
int c; |
int c; |
117 |
|
|
118 |
if (alpha[0]) { |
if (alpha[0]) { |
211 |
die("internal error in makedefineindex()."); |
die("internal error in makedefineindex()."); |
212 |
if (*line == ' ') { |
if (*line == ' ') { |
213 |
SPLIT ptable; |
SPLIT ptable; |
214 |
char *fid, *enumber; |
const char *fid, *enumber; |
215 |
|
|
216 |
if (split(line + 1, 2, &ptable) < 2) { |
if (split((char *)line + 1, 2, &ptable) < 2) { |
217 |
recover(&ptable); |
recover(&ptable); |
218 |
die("too small number of parts in makedefineindex().\n'%s'", line); |
die("too small number of parts in makedefineindex().\n'%s'", line); |
219 |
} |
} |
238 |
recover(&ptable); |
recover(&ptable); |
239 |
} else { |
} else { |
240 |
SPLIT ptable; |
SPLIT ptable; |
241 |
char *lno, *fid, *path; |
const char *lno, *fid, *path; |
242 |
|
|
243 |
if (split(line, 3, &ptable) < 3) { |
if (split((char *)line, 3, &ptable) < 3) { |
244 |
recover(&ptable); |
recover(&ptable); |
245 |
die("too small number of parts in makedefineindex().\n'%s'", line); |
die("too small number of parts in makedefineindex().\n'%s'", line); |
246 |
} |
} |
275 |
STDOUT = old; |
STDOUT = old; |
276 |
if (aflag && alpha[0]) { |
if (aflag && alpha[0]) { |
277 |
char tmp[128]; |
char tmp[128]; |
278 |
char *msg = (alpha_count == 1) ? "definition is contained." : "definitions are contained."; |
const char *msg = (alpha_count == 1) ? "definition is contained." : "definitions are contained."; |
279 |
|
|
280 |
snprintf(tmp, sizeof(tmp), "%d %s", alpha_count, msg); |
snprintf(tmp, sizeof(tmp), "%d %s", alpha_count, msg); |
281 |
strbuf_puts(defines, gen_href_begin_with_title("defines", alpha_f, HTML, NULL, tmp)); |
strbuf_puts(defines, gen_href_begin_with_title("defines", alpha_f, HTML, NULL, tmp)); |