82 |
int show_config; |
int show_config; |
83 |
int do_convert; |
int do_convert; |
84 |
int do_find; |
int do_find; |
85 |
|
int do_sed; |
86 |
int do_sort; |
int do_sort; |
87 |
int do_relative; |
int do_relative; |
88 |
int do_absolute; |
int do_absolute; |
96 |
int secure_mode; |
int secure_mode; |
97 |
char *extra_options; |
char *extra_options; |
98 |
char *info_string; |
char *info_string; |
99 |
|
char *sed_string; |
100 |
|
|
101 |
int extractmethod; |
int extractmethod; |
102 |
int total; |
int total; |
140 |
{"postgres", optional_argument, NULL, 'P'}, |
{"postgres", optional_argument, NULL, 'P'}, |
141 |
{"relative", no_argument, &do_relative, 1}, |
{"relative", no_argument, &do_relative, 1}, |
142 |
{"secure", no_argument, &secure_mode, 1}, |
{"secure", no_argument, &secure_mode, 1}, |
143 |
|
{"sed", required_argument, &do_sed, 1}, |
144 |
{"sort", no_argument, &do_sort, 1}, |
{"sort", no_argument, &do_sort, 1}, |
145 |
{"version", no_argument, &show_version, 1}, |
{"version", no_argument, &show_version, 1}, |
146 |
{"help", no_argument, &show_help, 1}, |
{"help", no_argument, &show_help, 1}, |
213 |
} else if (!strcmp(p, "config")) { |
} else if (!strcmp(p, "config")) { |
214 |
if (optarg) |
if (optarg) |
215 |
info_string = optarg; |
info_string = optarg; |
216 |
|
} else if (!strcmp(p, "sed")) { |
217 |
|
if (optarg) |
218 |
|
sed_string = optarg; |
219 |
} else if (gtagsconf || gtagslabel) { |
} else if (gtagsconf || gtagslabel) { |
220 |
char value[MAXPATHLEN+1]; |
char value[MAXPATHLEN+1]; |
221 |
char *name = (gtagsconf) ? "GTAGSCONF" : "GTAGSLABEL"; |
char *name = (gtagsconf) ? "GTAGSCONF" : "GTAGSLABEL"; |
427 |
} |
} |
428 |
vfind_close(); |
vfind_close(); |
429 |
exit(0); |
exit(0); |
430 |
|
} else if (do_sed) { |
431 |
|
/* |
432 |
|
* This code is used by gtags(1) to convert from path to |
433 |
|
* file id. The 'gtags --sed fid' is equivalent with |
434 |
|
* 'sed "s@<path>@fid@"'. |
435 |
|
*/ |
436 |
|
STRBUF *ib = strbuf_open(MAXBUFLEN); |
437 |
|
char *ctags_x, *p; |
438 |
|
|
439 |
|
while (ctags_x = strbuf_fgets(ib, stdin, 0)) { |
440 |
|
char *p = locatestring(ctags_x, "./", MATCH_FIRST); |
441 |
|
if (p == NULL) |
442 |
|
die("gtags --sed: path name not found."); |
443 |
|
*p++ = '\0'; |
444 |
|
fputs(ctags_x, stdout); |
445 |
|
while (*p && !isspace(*p)) |
446 |
|
p++; |
447 |
|
fputs(sed_string, stdout); |
448 |
|
fputs(p, stdout); |
449 |
|
} |
450 |
|
exit(0); |
451 |
} else if (do_sort) { |
} else if (do_sort) { |
452 |
/* |
/* |
453 |
* This code and the makedupindex() in htags(1) compose |
* This code and the makedupindex() in htags(1) compose |