[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Add "ignore case" and "other files" checkboxes to search form
From: |
Hideki IWAMOTO |
Subject: |
[PATCH] Add "ignore case" and "other files" checkboxes to search form |
Date: |
Sat, 07 Jun 2003 14:13:51 +0900 |
* htags/htags.in: Add "Ignore case" and "Other files" checkboxes to search form.
"Other files" checkbox is generated only when all -o, the -D, and enable_grep
are specified.
* gtags/gtags.c: Changed so that the path to a CGI script might be
generated for the file which is not source
Index: htags/htags.in
===================================================================
RCS file: /cvsroot/global/global/htags/htags.in,v
retrieving revision 1.133
diff -u -r1.133 htags.in
--- htags/htags.in 7 Jun 2003 01:16:09 -0000 1.133
+++ htags/htags.in 7 Jun 2003 05:01:26 -0000
@@ -1111,6 +1111,14 @@
$flag = 'I';
$words = 'patterns';
}
+$iflag = '';
+if ($form{'icase'}) {
+ $iflag = 'i';
+}
+$oflag = '';
+if ($form{'other'} && $flag eq 'g') {
+ $oflag = 'o';
+}
if ($form{'id'}) {
chdir("$form{'id'}/cgi-bin");
if ($?) {
@@ -1170,7 +1178,7 @@
#
# fork and exec global(1) to avoid command substitutions in $pattern.
#
-open(PIPE, "-|") || exec '@globalpath@', '-x'.$flag, '-e', $pattern;
+open(PIPE, "-|") || exec '@globalpath@', '-x'.$flag.$iflag.$oflag, '-e',
$pattern;
if ($?) {
print "<H1><FONT COLOR=#cc0000>Error</FONT></H1>\n";
print "<H3>Cannot execute global. <A
HREF=$htmlbase/address@hidden@>[return]</A></H3>\n";
@@ -1920,6 +1928,12 @@
if ($'enable_idutils && -f "$dbpath/ID") {
$index .= "\n<INPUT TYPE=radio NAME=type VALUE=idutils>";
$index .= ($target) ? "Id" : "Id pattern";
+ }
+ $index .= "<BR>\n<INPUT TYPE=checkbox NAME=icase VALUE=1>";
+ $index .= ($target) ? "Icase" : "Ignore case";
+ if ($'enable_grep && $'other_files && $'dynamic) {
+ $index .= "\n<INPUT TYPE=checkbox NAME=other VALUE=1>";
+ $index .= ($target) ? "Other" : "Other files";
}
$index .= "\n</FORM>\n";
$index;
Index: gtags/gtags.c
===================================================================
RCS file: /cvsroot/global/global/gtags/gtags.c,v
retrieving revision 1.76
diff -u -r1.76 gtags.c
--- gtags/gtags.c 7 Jun 2003 01:16:09 -0000 1.76
+++ gtags/gtags.c 7 Jun 2003 05:01:26 -0000
@@ -299,7 +299,7 @@
exit(0);
} else if (do_convert) {
STRBUF *ib = strbuf_open(MAXBUFLEN);
- char *p, *q;
+ char *p, *q, *fid;
/*
* [Job]
@@ -310,8 +310,13 @@
* <A HREF="http://xxx/global/S/ ./main.c .html#110">main</A>\n
* |
* v
- * <A HREF="http://xxx/global/S/39..html#110">main</A>\n
+ * <A HREF="http://xxx/global/S/39.html#110">main</A>\n
*
+ * If the file name is not found in GPATH, change into the path
to CGI script.
+ * <A HREF="http://xxx/global/S/ ./README .html#9">main</A>\n
+ * |
+ * v
+ * <A
HREF="http://xxx/global/cgi-bin/global.cgi?pattern=README&type=source#9">main</A>\n
*/
if (gpath_open(".", 0, 0) < 0)
die("GPATH not found.");
@@ -324,10 +329,28 @@
printf("%s: ERROR(1): %s", progname,
strbuf_value(ib));
continue;
}
+ /*
+ * <A HREF="http://xxx/global/S/ ./main.c
.html#110">main</A>\n
+ * ^ ^
+ * p |
+ * q
+ */
for (; p < q; p++)
putc(*p, stdout);
+ /*
+ * <A HREF="http://xxx/global/S/ ./main.c
.html#110">main</A>\n
+ * ^
+ * p
+ * q
+ */
for (; *p && *p != ' '; p++)
- putc(*p, stdout);
+ ;
+ /*
+ * <A HREF="http://xxx/global/S/ ./main.c
.html#110">main</A>\n
+ * ^ ^
+ * | p
+ * q
+ */
for (q = ++p; *q && *q != ' '; q++)
;
if (*q == '\0') {
@@ -335,7 +358,34 @@
continue;
}
*q++ = '\0';
- fputs(gpath_path2fid(p), stdout);
+ /*
+ * <A HREF="http://xxx/global/S/
./main.c\0.html#110">main</A>\n
+ * ^ ^
+ * p |
+ * q
+ */
+ fid = gpath_path2fid(p);
+ if (fid) {
+ fputs("/S/", stdout);
+ fputs(fid, stdout);
+ fputs(q, stdout);
+ continue;
+ }
+ fputs("/cgi-bin/global.cgi?pattern=", stdout);
+ fputs(p + 2, stdout);
+ fputs("&type=source", stdout);
+ for (; *q && *q != '#'; q++)
+ ;
+ if (*q == '\0') {
+ printf("%s: ERROR(2): %s", progname,
strbuf_value(ib));
+ continue;
+ }
+ /*
+ * <A HREF="http://xxx/global/S/
./main.c\0.html#110">main</A>\n
+ * ^ ^
+ * p |
+ * q
+ */
fputs(q, stdout);
}
gpath_close();
----
Hideki IWAMOTO address@hidden
- [PATCH] Add "ignore case" and "other files" checkboxes to search form,
Hideki IWAMOTO <=