405 |
} |
} |
406 |
} |
} |
407 |
} |
} |
408 |
fputs(p, op); |
fputs_nl(p, op); |
|
fputc('\n', op); |
|
409 |
} |
} |
410 |
fclose(op); |
fclose(op); |
411 |
fclose(ip); |
fclose(ip); |
566 |
strbuf_puts(sb, "SEARCH"); |
strbuf_puts(sb, "SEARCH"); |
567 |
if (Fflag) |
if (Fflag) |
568 |
strbuf_puts(sb, gen_href_end()); |
strbuf_puts(sb, gen_href_end()); |
569 |
strbuf_sprintf(sb, "%s\n", header_end); |
strbuf_puts_nl(sb, header_end); |
570 |
if (!target) { |
if (!target) { |
571 |
strbuf_puts(sb, "Please input object name and select [Search]. POSIX's regular expression is allowed."); |
strbuf_puts(sb, "Please input object name and select [Search]. POSIX's regular expression is allowed."); |
572 |
strbuf_puts(sb, br); |
strbuf_puts_nl(sb, br); |
|
strbuf_putc(sb, '\n'); |
|
573 |
} |
} |
574 |
strbuf_sprintf(sb, "%s\n", gen_form_begin(target)); |
strbuf_puts_nl(sb, gen_form_begin(target)); |
575 |
strbuf_sprintf(sb, "%s\n", gen_input("pattern", NULL, NULL)); |
strbuf_puts_nl(sb, gen_input("pattern", NULL, NULL)); |
576 |
if (id == NULL) |
if (id == NULL) |
577 |
id = ""; |
id = ""; |
578 |
strbuf_sprintf(sb, "%s\n", gen_input("id", id, "hidden")); |
strbuf_puts_nl(sb, gen_input("id", id, "hidden")); |
579 |
strbuf_sprintf(sb, "%s\n", gen_input(NULL, "Search", "submit")); |
strbuf_puts_nl(sb, gen_input(NULL, "Search", "submit")); |
580 |
strbuf_sprintf(sb, "%s%s\n", gen_input(NULL, "Reset", "reset"), br); |
strbuf_puts(sb, gen_input(NULL, "Reset", "reset")); |
581 |
strbuf_sprintf(sb, "%s%s\n", gen_input_radio("type", "definition", 1, "Retrieve the definition place of the specified symbol."), target ? "Def" : "Definition"); |
strbuf_puts_nl(sb, br); |
582 |
strbuf_sprintf(sb, "%s%s\n", gen_input_radio("type", "reference", 0, "Retrieve the reference place of the specified symbol."), target ? "Ref" : "Reference"); |
strbuf_puts(sb, gen_input_radio("type", "definition", 1, "Retrieve the definition place of the specified symbol.")); |
583 |
if (test("f", makepath(dbpath, dbname(GSYMS), NULL))) |
strbuf_puts_nl(sb, target ? "Def" : "Definition"); |
584 |
strbuf_sprintf(sb, "%s%s\n", gen_input_radio("type", "symbol", 0, "Retrieve the place of the specified symbol is used."), target ? "Sym" : "Other symbol"); |
strbuf_puts(sb, gen_input_radio("type", "reference", 0, "Retrieve the reference place of the specified symbol.")); |
585 |
strbuf_sprintf(sb, "%s%s%s\n", gen_input_radio("type", "path", 0, "Look for path name which matches to the specified pattern."), target ? "Path" : "Path name", br); |
strbuf_puts_nl(sb, target ? "Ref" : "Reference"); |
586 |
if (enable_grep) |
if (test("f", makepath(dbpath, dbname(GSYMS), NULL))) { |
587 |
strbuf_sprintf(sb, "%s%s\n", gen_input_radio("type", "grep", 0, "Retrieve lines which matches to the specified pattern."), target ? "Grep" : "Grep pattern"); |
strbuf_puts(sb, gen_input_radio("type", "symbol", 0, "Retrieve the place of the specified symbol is used.")); |
588 |
if (enable_idutils && test("f", makepath(dbpath, "ID", NULL))) |
strbuf_puts_nl(sb, target ? "Sym" : "Other symbol"); |
589 |
strbuf_sprintf(sb, "%s%s\n", gen_input_radio("type", "idutils", 0, "Retrieve lines which matches to the specified pattern using idutils(1)."), target ? "Id" : "Id pattern"); |
} |
590 |
strbuf_sprintf(sb, "%s%s\n", gen_input_checkbox("icase", "1", "Ignore case distinctions in the pattern."), target ? "Icase" : "Ignore case"); |
strbuf_puts(sb, gen_input_radio("type", "path", 0, "Look for path name which matches to the specified pattern.")); |
591 |
if (other_files) |
strbuf_puts(sb, target ? "Path" : "Path name"); |
592 |
strbuf_sprintf(sb, "%s%s\n", gen_input_checkbox("other", "1", "Files other than the source code are also retrieved."), target ? "Other" : "Other files"); |
strbuf_puts_nl(sb, br); |
593 |
strbuf_sprintf(sb, "%s\n", gen_form_end()); |
if (enable_grep) { |
594 |
|
strbuf_puts(sb, gen_input_radio("type", "grep", 0, "Retrieve lines which matches to the specified pattern.")); |
595 |
|
strbuf_puts_nl(sb, target ? "Grep" : "Grep pattern"); |
596 |
|
} |
597 |
|
if (enable_idutils && test("f", makepath(dbpath, "ID", NULL))) { |
598 |
|
strbuf_puts(sb, gen_input_radio("type", "idutils", 0, "Retrieve lines which matches to the specified pattern using idutils(1).")); |
599 |
|
strbuf_puts_nl(sb, target ? "Id" : "Id pattern"); |
600 |
|
} |
601 |
|
strbuf_puts(sb, gen_input_checkbox("icase", "1", "Ignore case distinctions in the pattern.")); |
602 |
|
strbuf_puts_nl(sb, target ? "Icase" : "Ignore case"); |
603 |
|
if (other_files) { |
604 |
|
strbuf_puts(sb, gen_input_checkbox("other", "1", "Files other than the source code are also retrieved.")); |
605 |
|
strbuf_puts_nl(sb, target ? "Other" : "Other files"); |
606 |
|
} |
607 |
|
strbuf_puts_nl(sb, gen_form_end()); |
608 |
return strbuf_value(sb); |
return strbuf_value(sb); |
609 |
} |
} |
610 |
/* |
/* |
848 |
char *_; |
char *_; |
849 |
|
|
850 |
if (include_header) { |
if (include_header) { |
851 |
strbuf_puts(sb, include_header); |
strbuf_puts_nl(sb, include_header); |
852 |
strbuf_sprintf(sb, "\n%s\n", hr); |
strbuf_puts_nl(sb, hr); |
853 |
} |
} |
854 |
strbuf_puts(sb, title_begin); |
strbuf_puts(sb, title_begin); |
855 |
strbuf_puts(sb, title); |
strbuf_puts(sb, title); |
856 |
strbuf_puts(sb, title_end); |
strbuf_puts_nl(sb, title_end); |
857 |
strbuf_putc(sb, '\n'); |
strbuf_puts_nl(sb, gen_div_begin("right")); |
|
strbuf_puts(sb, gen_div_begin("right")); |
|
|
strbuf_putc(sb, '\n'); |
|
858 |
strbuf_sprintf(sb, "Last updated %s%s\n", now(), br); |
strbuf_sprintf(sb, "Last updated %s%s\n", now(), br); |
859 |
strbuf_sprintf(sb, "This hypertext was generated by %sGLOBAL-%s%s.%s\n", |
strbuf_sprintf(sb, "This hypertext was generated by %sGLOBAL-%s%s.%s\n", |
860 |
gen_href_begin_with_title_target(NULL, www, NULL, NULL, "Go to the GLOBAL project page.", "_top"), |
gen_href_begin_with_title_target(NULL, www, NULL, NULL, "Go to the GLOBAL project page.", "_top"), |
861 |
get_version(), |
get_version(), |
862 |
gen_href_end(), |
gen_href_end(), |
863 |
br); |
br); |
864 |
strbuf_sprintf(sb, "%s\n", gen_div_end()); |
strbuf_puts_nl(sb, gen_div_end()); |
865 |
strbuf_sprintf(sb, "%s\n", hr); |
strbuf_puts_nl(sb, hr); |
866 |
if (caution) { |
if (caution) { |
867 |
strbuf_sprintf(sb, "%s\n", caution_begin); |
strbuf_puts_nl(sb, caution_begin); |
868 |
strbuf_sprintf(sb, "<font size='+2' color='red'>CAUTION</font>%s\n", br); |
strbuf_sprintf(sb, "<font size='+2' color='red'>CAUTION</font>%s\n", br); |
869 |
strbuf_sprintf(sb, "This hypertext consist of %d files.\n", file_count); |
strbuf_sprintf(sb, "This hypertext consist of %d files.\n", file_count); |
870 |
strbuf_puts(sb, "Please don't download whole hypertext using hypertext copy tools.\n"); |
strbuf_puts_nl(sb, "Please don't download whole hypertext using hypertext copy tools."); |
871 |
strbuf_puts(sb, "Our network cannot afford such traffic.\n"); |
strbuf_puts_nl(sb, "Our network cannot afford such traffic."); |
872 |
strbuf_puts(sb, "Instead, you can generate same thing in your computer using\n"); |
strbuf_puts_nl(sb, "Instead, you can generate same thing in your computer using"); |
873 |
strbuf_sprintf(sb, "%sGLOBAL source code tag system%s.\n", |
strbuf_puts(sb, gen_href_begin_with_title_target(NULL, www, NULL, NULL, NULL, "_top")); |
874 |
gen_href_begin_with_title_target(NULL, www, NULL, NULL, NULL, "_top"), |
strbuf_puts(sb, "GLOBAL source code tag system"); |
875 |
gen_href_end()); |
strbuf_puts_nl(sb, gen_href_end()); |
876 |
strbuf_puts(sb, "Thank you. \n"); |
strbuf_puts_nl(sb, "Thank you."); |
877 |
strbuf_sprintf(sb, "%s\n", caution_end); |
strbuf_puts_nl(sb, caution_end); |
878 |
strbuf_sprintf(sb, "\n%s\n", hr); |
strbuf_sprintf(sb, "\n%s\n", hr); |
879 |
} |
} |
880 |
if (fflag) { |
if (fflag) { |
881 |
strbuf_puts(sb, makesearchpart(action, id, NULL)); |
strbuf_puts(sb, makesearchpart(action, id, NULL)); |
882 |
strbuf_sprintf(sb, "%s\n", hr); |
strbuf_puts_nl(sb, hr); |
883 |
} |
} |
884 |
strbuf_sprintf(sb, "%sMAINS%s\n", header_begin, header_end); |
strbuf_sprintf(sb, "%sMAINS%s\n", header_begin, header_end); |
885 |
|
|
887 |
ip = popen(command, "r"); |
ip = popen(command, "r"); |
888 |
if (!ip) |
if (!ip) |
889 |
die("cannot execute command '%s'.", command); |
die("cannot execute command '%s'.", command); |
890 |
strbuf_puts(sb, gen_list_begin()); |
strbuf_puts_nl(sb, gen_list_begin()); |
|
strbuf_putc(sb, '\n'); |
|
891 |
while ((_ = strbuf_fgets(ib, ip, STRBUF_NOCRLF)) != NULL) { |
while ((_ = strbuf_fgets(ib, ip, STRBUF_NOCRLF)) != NULL) { |
892 |
strbuf_puts(sb, gen_list_body(SRCS, _)); |
strbuf_puts_nl(sb, gen_list_body(SRCS, _)); |
|
strbuf_putc(sb, '\n'); |
|
893 |
} |
} |
894 |
strbuf_puts(sb, gen_list_end()); |
strbuf_puts_nl(sb, gen_list_end()); |
|
strbuf_putc(sb, '\n'); |
|
895 |
if (pclose(ip) != 0) |
if (pclose(ip) != 0) |
896 |
die("cannot execute command '%s'.", command); |
die("cannot execute command '%s'.", command); |
897 |
strbuf_sprintf(sb, "%s\n", hr); |
strbuf_puts_nl(sb, hr); |
898 |
if (aflag && !Fflag) { |
if (aflag && !Fflag) { |
899 |
strbuf_puts(sb, header_begin); |
strbuf_puts(sb, header_begin); |
900 |
strbuf_puts(sb, title_define_index); |
strbuf_puts(sb, title_define_index); |
901 |
strbuf_sprintf(sb, "%s\n", header_end); |
strbuf_puts_nl(sb, header_end); |
902 |
strbuf_puts(sb, defines); |
strbuf_puts(sb, defines); |
903 |
} else { |
} else { |
904 |
strbuf_puts(sb, header_begin); |
strbuf_puts(sb, header_begin); |
905 |
strbuf_puts(sb, gen_href_begin(NULL, "defines", normal_suffix, NULL)); |
strbuf_puts(sb, gen_href_begin(NULL, "defines", normal_suffix, NULL)); |
906 |
strbuf_puts(sb, title_define_index); |
strbuf_puts(sb, title_define_index); |
907 |
strbuf_puts(sb, gen_href_end()); |
strbuf_puts(sb, gen_href_end()); |
908 |
strbuf_sprintf(sb, "%s\n", header_end); |
strbuf_puts_nl(sb, header_end); |
909 |
} |
} |
910 |
strbuf_sprintf(sb, "%s\n", hr); |
strbuf_puts_nl(sb, hr); |
911 |
if (Fflag) { |
if (Fflag) { |
912 |
strbuf_puts(sb, header_begin); |
strbuf_puts(sb, header_begin); |
913 |
strbuf_puts(sb, gen_href_begin(NULL, "files", normal_suffix, NULL)); |
strbuf_puts(sb, gen_href_begin(NULL, "files", normal_suffix, NULL)); |
914 |
strbuf_puts(sb, title_file_index); |
strbuf_puts(sb, title_file_index); |
915 |
strbuf_puts(sb, gen_href_end()); |
strbuf_puts(sb, gen_href_end()); |
916 |
strbuf_sprintf(sb, "%s\n", header_end); |
strbuf_puts_nl(sb, header_end); |
917 |
} else { |
} else { |
918 |
strbuf_puts(sb, header_begin); |
strbuf_puts(sb, header_begin); |
919 |
strbuf_puts(sb, title_file_index); |
strbuf_puts(sb, title_file_index); |
920 |
strbuf_sprintf(sb, "%s\n", header_end); |
strbuf_puts_nl(sb, header_end); |
921 |
if (!no_order_list) |
if (!no_order_list) |
922 |
strbuf_sprintf(sb, "%s\n", list_begin); |
strbuf_puts_nl(sb, list_begin); |
923 |
strbuf_puts(sb, files); |
strbuf_puts(sb, files); |
924 |
if (!no_order_list) { |
if (!no_order_list) { |
925 |
strbuf_sprintf(sb, "%s\n", list_end); |
strbuf_puts_nl(sb, list_end); |
926 |
} else { |
} else { |
927 |
strbuf_sprintf(sb, "%s\n", br); |
strbuf_puts_nl(sb, br); |
928 |
} |
} |
929 |
strbuf_sprintf(sb, "%s\n", hr); |
strbuf_puts_nl(sb, hr); |
930 |
} |
} |
931 |
strbuf_close(ib); |
strbuf_close(ib); |
932 |
|
|