187 |
int map_file = 1; /* 1: create MAP file */ |
int map_file = 1; /* 1: create MAP file */ |
188 |
char *icon_list = NULL; /* use icon list */ |
char *icon_list = NULL; /* use icon list */ |
189 |
char *icon_suffix = "png"; /* icon suffix (jpg, png etc) */ |
char *icon_suffix = "png"; /* icon suffix (jpg, png etc) */ |
190 |
char *icon_spec = "BORDER=0 ALIGN=top"; /* parameter in IMG tag */ |
char *icon_spec = "border=0 align=top"; /* parameter in IMG tag */ |
191 |
char *prolog_script = NULL; /* include script at first */ |
char *prolog_script = NULL; /* include script at first */ |
192 |
char *epilog_script = NULL; /* include script at last */ |
char *epilog_script = NULL; /* include script at last */ |
193 |
int show_position = 0; /* show current position */ |
int show_position = 0; /* show current position */ |
486 |
fprintf(op, "%s\n", html_begin); |
fprintf(op, "%s\n", html_begin); |
487 |
fprintf(op, "%s", set_header("HELP")); |
fprintf(op, "%s", set_header("HELP")); |
488 |
fprintf(op, "%s\n", body_begin); |
fprintf(op, "%s\n", body_begin); |
489 |
fprintf(op, "<H2>Usage of Links</H2>\n"); |
fprintf(op, "<h2>Usage of Links</h2>\n"); |
490 |
fprintf(op, "%s/* ", verbatim_begin); |
fprintf(op, "%s/* ", verbatim_begin); |
491 |
for (n = 0; n <= last; n++) { |
for (n = 0; n <= last; n++) { |
492 |
if (icon_list) { |
if (icon_list) { |
493 |
fprintf(op, "<IMG SRC=icons/%s.%s ALT=[%s] %s>", |
fprintf(op, "<img src='icons/%s.%s' alt='[%s]' %s>", |
494 |
icons[n], icon_suffix, label[n], icon_spec); |
icons[n], icon_suffix, label[n], icon_spec); |
495 |
if (n < last) |
if (n < last) |
496 |
fputc(' ', op); |
fputc(' ', op); |
501 |
if (show_position) |
if (show_position) |
502 |
fprintf(op, "[+line file]"); |
fprintf(op, "[+line file]"); |
503 |
fprintf(op, " */%s\n", verbatim_end); |
fprintf(op, " */%s\n", verbatim_end); |
504 |
fprintf(op, "<DL>\n"); |
fprintf(op, "<dl>\n"); |
505 |
for (n = 0; n <= last; n++) { |
for (n = 0; n <= last; n++) { |
506 |
fprintf(op, "<DT>"); |
fprintf(op, "<dt>"); |
507 |
if (icon_list) { |
if (icon_list) { |
508 |
fprintf(op, "<IMG SRC=icons/%s.%s ALT=[%s] %s>", |
fprintf(op, "<img src='icons/%s.%s' alt='[%s]' %s>", |
509 |
icons[n], icon_suffix, label[n], icon_spec); |
icons[n], icon_suffix, label[n], icon_spec); |
510 |
} else { |
} else { |
511 |
fprintf(op, "[%s]", label[n]); |
fprintf(op, "[%s]", label[n]); |
512 |
} |
} |
513 |
fprintf(op, "<DD>%s\n", msg[n]); |
fprintf(op, "<dd>%s\n", msg[n]); |
514 |
} |
} |
515 |
if (show_position) { |
if (show_position) { |
516 |
fprintf(op, "<DT>[+line file]"); |
fprintf(op, "<dt>[+line file]"); |
517 |
fprintf(op, "<DD>Current position (line number and file name).\n"); |
fprintf(op, "<dd>Current position (line number and file name).\n"); |
518 |
} |
} |
519 |
fprintf(op, "</DL>\n"); |
fprintf(op, "</dl>\n"); |
520 |
fprintf(op, "%s\n", body_end); |
fprintf(op, "%s\n", body_end); |
521 |
fprintf(op, "%s\n", html_end); |
fprintf(op, "%s\n", html_end); |
522 |
fclose(op); |
fclose(op); |
538 |
{ |
{ |
539 |
STRBUF *sb = strbuf_open(0); |
STRBUF *sb = strbuf_open(0); |
540 |
|
|
541 |
if (Fflag) { |
if (Fflag) |
542 |
strbuf_puts(sb, "<A HREF=search."); |
strbuf_sprintf(sb, "<a href='search.%s'><h2>SEARCH</h2></a>\n", normal_suffix); |
543 |
strbuf_puts(sb, normal_suffix); |
else |
544 |
strbuf_puts(sb, "><H2>SEARCH</H2></A>\n"); |
strbuf_puts(sb, "<h2>SEARCH</h2>\n"); |
|
} else { |
|
|
strbuf_puts(sb, "<H2>SEARCH</H2>\n"); |
|
|
} |
|
545 |
if (!target) |
if (!target) |
546 |
strbuf_puts(sb, "Please input object name and select [Search]. POSIX's regular expression is allowed.<P>\n"); |
strbuf_puts(sb, "Please input object name and select [Search]. POSIX's regular expression is allowed.<p>\n"); |
547 |
strbuf_puts(sb, "<FORM METHOD=GET ACTION="); |
strbuf_sprintf(sb, "<form method='get' action='%s'", action); |
548 |
strbuf_puts(sb, action); |
if (target) |
549 |
if (target) { |
strbuf_sprintf(sb, " target='%s'", target); |
|
strbuf_puts(sb, " TARGET="); |
|
|
strbuf_puts(sb, target); |
|
|
} |
|
550 |
strbuf_puts(sb, ">\n"); |
strbuf_puts(sb, ">\n"); |
551 |
strbuf_puts(sb, "<INPUT NAME=pattern>\n"); |
strbuf_puts(sb, "<input name='pattern'>\n"); |
552 |
strbuf_puts(sb, "<INPUT TYPE=hidden NAME=id VALUE="); |
strbuf_puts(sb, "<input type='hidden' name='id' value='"); |
553 |
if (id) |
if (id) |
554 |
strbuf_puts(sb, id); |
strbuf_puts(sb, id); |
555 |
strbuf_puts(sb, ">\n"); |
strbuf_puts(sb, "'>\n"); |
556 |
strbuf_puts(sb, "<INPUT TYPE=submit VALUE=Search>\n"); |
strbuf_puts(sb, "<input type='submit' value='Search'>\n"); |
557 |
strbuf_puts(sb, "<INPUT TYPE=reset VALUE=Reset><BR>\n"); |
strbuf_puts(sb, "<input type='reset' value='Reset'><br>\n"); |
558 |
strbuf_puts(sb, "<INPUT TYPE=radio NAME=type VALUE=definition CHECKED TITLE='Retrieve the definition place of the specified symbol.'>"); |
strbuf_puts(sb, "<input type='radio' name='type' value='definition' checked title='Retrieve the definition place of the specified symbol.'>"); |
559 |
strbuf_puts(sb, target ? "Def" : "Definition"); |
strbuf_puts(sb, target ? "Def" : "Definition"); |
560 |
strbuf_puts(sb, "\n<INPUT TYPE=radio NAME=type VALUE=reference TITLE='Retrieve the reference place of the specified symbol.'>"); |
strbuf_puts(sb, "\n<input type='radio' name='type' value='reference' title='Retrieve the reference place of the specified symbol.'>"); |
561 |
strbuf_puts(sb, target ? "Ref" : "Reference"); |
strbuf_puts(sb, target ? "Ref" : "Reference"); |
562 |
if (test("f", makepath(dbpath, dbname(GSYMS), NULL))) { |
if (test("f", makepath(dbpath, dbname(GSYMS), NULL))) { |
563 |
strbuf_puts(sb, "\n<INPUT TYPE=radio NAME=type VALUE=symbol TITLE='Retrieve the place of the specified symbol is used.'>"); |
strbuf_puts(sb, "\n<input type='radio' name='type' value='symbol' title='Retrieve the place of the specified symbol is used.'>"); |
564 |
strbuf_puts(sb, target ? "Sym" : "Other symbol"); |
strbuf_puts(sb, target ? "Sym" : "Other symbol"); |
565 |
} |
} |
566 |
strbuf_puts(sb, "\n<INPUT TYPE=radio NAME=type VALUE=path TITLE='Look for path name which matches to the specified pattern.'>"); |
strbuf_puts(sb, "\n<input type='radio' name='type' value='path' title='Look for path name which matches to the specified pattern.'>"); |
567 |
strbuf_puts(sb, target ? "Path" : "Path name"); |
strbuf_puts(sb, target ? "Path" : "Path name"); |
568 |
if (enable_grep) { |
if (enable_grep) { |
569 |
strbuf_puts(sb, "\n<INPUT TYPE=radio NAME=type VALUE=grep TITLE='Retrieve lines which matches to the specified pattern.'>"); |
strbuf_puts(sb, "\n<input type='radio' name='type' value='grep' title='Retrieve lines which matches to the specified pattern.'>"); |
570 |
strbuf_puts(sb, target ? "Grep" : "Grep pattern"); |
strbuf_puts(sb, target ? "Grep" : "Grep pattern"); |
571 |
} |
} |
572 |
if (enable_idutils && test("f", makepath(dbpath, "ID", NULL))) { |
if (enable_idutils && test("f", makepath(dbpath, "ID", NULL))) { |
573 |
strbuf_puts(sb, "\n<INPUT TYPE=radio NAME=type VALUE=idutils TITLE='Retrieve lines which matches to the specified pattern using idutils(1).'>"); |
strbuf_puts(sb, "\n<input type='radio' name='type' value='idutils' title='Retrieve lines which matches to the specified pattern using idutils(1).'>"); |
574 |
strbuf_puts(sb, target ? "Id" : "Id pattern"); |
strbuf_puts(sb, target ? "Id" : "Id pattern"); |
575 |
} |
} |
576 |
strbuf_puts(sb, "<BR>\n<INPUT TYPE=checkbox NAME=icase VALUE=1 TITLE='Ignore case distinctions in the pattern.'>"); |
strbuf_puts(sb, "<br>\n<input type='checkbox' name='icase' value='1' title='Ignore case distinctions in the pattern.'>"); |
577 |
strbuf_puts(sb, target ? "Icase" : "Ignore case"); |
strbuf_puts(sb, target ? "Icase" : "Ignore case"); |
578 |
if (other_files) { |
if (other_files) { |
579 |
strbuf_puts(sb, "\n<INPUT TYPE=checkbox NAME=other VALUE=1 TITLE='Files other than the source code are also retrieved.'>"); |
strbuf_puts(sb, "\n<input type='checkbox' name='other' value='1' title='Files other than the source code are also retrieved.'>"); |
580 |
strbuf_puts(sb, target ? "Other" : "Other files"); |
strbuf_puts(sb, target ? "Other" : "Other files"); |
581 |
} |
} |
582 |
strbuf_puts(sb, "\n</FORM>\n"); |
strbuf_puts(sb, "\n</form>\n"); |
583 |
|
|
584 |
return strbuf_value(sb); |
return strbuf_value(sb); |
585 |
/* doesn't close string buffer */ |
/* doesn't close string buffer */ |
604 |
die("cannot make file '%s'.", file); |
die("cannot make file '%s'.", file); |
605 |
if (Fflag) { |
if (Fflag) { |
606 |
fprintf(op, "%s\n", html_begin); |
fprintf(op, "%s\n", html_begin); |
607 |
fprintf(op, "<HEAD>\n<TITLE>%s</TITLE>\n", title); |
fprintf(op, "<head>\n<title>%s</title>\n", title); |
608 |
fprintf(op, "%s", meta_record()); |
fprintf(op, "%s", meta_record()); |
609 |
if (style_sheet) |
if (style_sheet) |
610 |
fprintf(op, "%s", style_sheet); |
fprintf(op, "%s", style_sheet); |
611 |
fprintf(op, "</HEAD>\n"); |
fprintf(op, "</head>\n"); |
612 |
fprintf(op, "<FRAMESET COLS='200,*'>\n"); |
fprintf(op, "<frameset cols='200,*'>\n"); |
613 |
if (fflag) { |
if (fflag) { |
614 |
fprintf(op, "<FRAMESET ROWS='33%%,33%%,*'>\n"); |
fprintf(op, "<frameset rows='33%%,33%%,*'>\n"); |
615 |
fprintf(op, "<FRAME NAME=search SRC=search.%s>\n", normal_suffix); |
fprintf(op, "<frame name='search' src='search.%s'>\n", normal_suffix); |
616 |
} else { |
} else { |
617 |
fprintf(op, "<FRAMESET ROWS='50%%,*'>\n"); |
fprintf(op, "<frameset rows='50%%,*'>\n"); |
618 |
} |
} |
619 |
fprintf(op, "<FRAME NAME=defines SRC=defines.%s>\n", normal_suffix); |
fprintf(op, "<frame name='defines' src='defines.%s'>\n", normal_suffix); |
620 |
fprintf(op, "<FRAME NAME=files SRC=files.%s>\n", normal_suffix); |
fprintf(op, "<frame name='files' src='files.%s'>\n", normal_suffix); |
621 |
fprintf(op, "</FRAMESET>\n"); |
fprintf(op, "</frameset>\n"); |
622 |
fprintf(op, "<FRAME NAME=mains SRC=mains.%s>\n", normal_suffix); |
fprintf(op, "<frame name='mains' src='mains.%s'>\n", normal_suffix); |
623 |
fprintf(op, "<NOFRAMES>\n"); |
fprintf(op, "<noframes>\n"); |
624 |
fprintf(op, "%s\n", body_begin); |
fprintf(op, "%s\n", body_begin); |
625 |
fputs(index, op); |
fputs(index, op); |
626 |
fprintf(op, "%s\n", body_end); |
fprintf(op, "%s\n", body_end); |
627 |
fprintf(op, "</NOFRAMES>\n"); |
fprintf(op, "</noframes>\n"); |
628 |
fprintf(op, "</FRAMESET>\n"); |
fprintf(op, "</frameset>\n"); |
629 |
fprintf(op, "%s\n", html_end); |
fprintf(op, "%s\n", html_end); |
630 |
} else { |
} else { |
631 |
fprintf(op, "%s\n", html_begin); |
fprintf(op, "%s\n", html_begin); |
838 |
strbuf_puts(sb, title); |
strbuf_puts(sb, title); |
839 |
strbuf_puts(sb, title_end); |
strbuf_puts(sb, title_end); |
840 |
strbuf_putc(sb, '\n'); |
strbuf_putc(sb, '\n'); |
841 |
strbuf_puts(sb, "<DIV ALIGN=right>\n"); |
strbuf_puts(sb, "<div align='right'>\n"); |
842 |
strbuf_sprintf(sb, "Last updated %s<BR>\n", now()); |
strbuf_sprintf(sb, "Last updated %s<br>\n", now()); |
843 |
strbuf_sprintf(sb, "This hypertext was generated by <A HREF=%s TARGET=_top TITLE='Go to the GLOBAL project page.'>GLOBAL-%s</A>.<BR>\n", www, get_version()); |
strbuf_sprintf(sb, "This hypertext was generated by <a href='%s' target='_top' title='Go to the GLOBAL project page.'>GLOBAL-%s</a>.<br>\n", www, get_version()); |
844 |
strbuf_puts(sb, "</DIV>\n"); |
strbuf_puts(sb, "</div>\n"); |
845 |
strbuf_sprintf(sb, "%s\n", hr); |
strbuf_sprintf(sb, "%s\n", hr); |
846 |
if (caution) { |
if (caution) { |
847 |
strbuf_puts(sb, "<CENTER>\n"); |
strbuf_puts(sb, "<center>\n"); |
848 |
strbuf_puts(sb, "<BLOCKQUOTE>\n"); |
strbuf_puts(sb, "<blockquote>\n"); |
849 |
strbuf_puts(sb, "<FONT SIZE=+2 COLOR=red>CAUTION</FONT><BR>\n"); |
strbuf_puts(sb, "<font size='+2' color='red'>CAUTION</font><br>\n"); |
850 |
strbuf_sprintf(sb, "This hypertext consist of %d files.\n", file_count); |
strbuf_sprintf(sb, "This hypertext consist of %d files.\n", file_count); |
851 |
strbuf_puts(sb, "Please don't download whole hypertext using hypertext copy tools.\n"); |
strbuf_puts(sb, "Please don't download whole hypertext using hypertext copy tools.\n"); |
852 |
strbuf_puts(sb, "Our network cannot afford such traffic.\n"); |
strbuf_puts(sb, "Our network cannot afford such traffic.\n"); |
853 |
strbuf_puts(sb, "Instead, you can generate same thing in your computer using\n"); |
strbuf_puts(sb, "Instead, you can generate same thing in your computer using\n"); |
854 |
strbuf_sprintf(sb, "<A HREF=%s TARGET=_top>GLOBAL source code tag system</A>.\n", www); |
strbuf_sprintf(sb, "<a href='%s' target='_top'>GLOBAL source code tag system</a>.\n", www); |
855 |
strbuf_puts(sb, "Thank you. \n"); |
strbuf_puts(sb, "Thank you. \n"); |
856 |
strbuf_puts(sb, "</BLOCKQUOTE>\n"); |
strbuf_puts(sb, "</blockquote>\n"); |
857 |
strbuf_puts(sb, "</CENTER>\n"); |
strbuf_puts(sb, "</center>\n"); |
858 |
strbuf_sprintf(sb, "\n%s\n", hr); |
strbuf_sprintf(sb, "\n%s\n", hr); |
859 |
} |
} |
860 |
if (fflag) { |
if (fflag) { |
861 |
strbuf_puts(sb, makesearchpart(action, id, NULL)); |
strbuf_puts(sb, makesearchpart(action, id, NULL)); |
862 |
strbuf_sprintf(sb, "%s\n", hr); |
strbuf_sprintf(sb, "%s\n", hr); |
863 |
} |
} |
864 |
strbuf_puts(sb, "<H2>MAINS</H2>\n"); |
strbuf_puts(sb, "<h2>MAINS</h2>\n"); |
865 |
|
|
866 |
snprintf(command, sizeof(command), "%s -nx %s | gnusort -k 1,1 -k 3,3 -k 2,2n", global_path, main_func); |
snprintf(command, sizeof(command), "%s -nx %s | gnusort -k 1,1 -k 3,3 -k 2,2n", global_path, main_func); |
867 |
ip = popen(command, "r"); |
ip = popen(command, "r"); |
879 |
die("cannot execute command '%s'.", command); |
die("cannot execute command '%s'.", command); |
880 |
strbuf_sprintf(sb, "%s\n", hr); |
strbuf_sprintf(sb, "%s\n", hr); |
881 |
if (aflag && !Fflag) { |
if (aflag && !Fflag) { |
882 |
strbuf_sprintf(sb, "<H2>%s</H2>\n", title_define_index); |
strbuf_sprintf(sb, "<h2>%s</h2>\n", title_define_index); |
883 |
strbuf_puts(sb, defines); |
strbuf_puts(sb, defines); |
884 |
} else { |
} else { |
885 |
strbuf_sprintf(sb, "<H2><A HREF=defines.%s>%s</A></H2>\n", normal_suffix, title_define_index); |
strbuf_sprintf(sb, "<h2><a href='defines.%s'>%s</a></h2>\n", normal_suffix, title_define_index); |
886 |
} |
} |
887 |
strbuf_sprintf(sb, "%s\n", hr); |
strbuf_sprintf(sb, "%s\n", hr); |
888 |
if (Fflag) { |
if (Fflag) { |
889 |
strbuf_sprintf(sb, "<H2><A HREF=files.%s>%s</A></H2>\n", normal_suffix, title_file_index); |
strbuf_sprintf(sb, "<h2><a href='files.%s'>%s</a></h2>\n", normal_suffix, title_file_index); |
890 |
} else { |
} else { |
891 |
strbuf_sprintf(sb, "<H2>%s</H2>\n", title_file_index); |
strbuf_sprintf(sb, "<h2>%s</h2>\n", title_file_index); |
892 |
if (!no_order_list) |
if (!no_order_list) |
893 |
strbuf_puts(sb, "<OL>\n"); |
strbuf_puts(sb, "<ol>\n"); |
894 |
strbuf_puts(sb, files); |
strbuf_puts(sb, files); |
895 |
if (!no_order_list) { |
if (!no_order_list) { |
896 |
strbuf_puts(sb, "</OL>\n"); |
strbuf_puts(sb, "</ol>\n"); |
897 |
} else { |
} else { |
898 |
strbuf_puts(sb, "<BR>\n"); |
strbuf_puts(sb, "<br>\n"); |
899 |
} |
} |
900 |
strbuf_sprintf(sb, "%s\n", hr); |
strbuf_sprintf(sb, "%s\n", hr); |
901 |
} |
} |