88 |
int show_config; |
int show_config; |
89 |
int do_convert; |
int do_convert; |
90 |
int do_find; |
int do_find; |
|
int do_sed; |
|
91 |
int do_sort; |
int do_sort; |
92 |
int do_relative; |
int do_relative; |
93 |
int do_absolute; |
int do_absolute; |
101 |
int noxargs; |
int noxargs; |
102 |
const char *extra_options; |
const char *extra_options; |
103 |
const char *info_string; |
const char *info_string; |
|
const char *sed_string; |
|
104 |
|
|
105 |
int extractmethod; |
int extractmethod; |
106 |
int total; |
int total; |
143 |
{"other", no_argument, &other_files, 1}, |
{"other", no_argument, &other_files, 1}, |
144 |
{"relative", no_argument, &do_relative, 1}, |
{"relative", no_argument, &do_relative, 1}, |
145 |
{"secure", no_argument, &secure_mode, 1}, |
{"secure", no_argument, &secure_mode, 1}, |
|
{"sed", required_argument, &do_sed, 1}, |
|
146 |
{"sort", no_argument, &do_sort, 1}, |
{"sort", no_argument, &do_sort, 1}, |
147 |
{"version", no_argument, &show_version, 1}, |
{"version", no_argument, &show_version, 1}, |
148 |
{"help", no_argument, &show_help, 1}, |
{"help", no_argument, &show_help, 1}, |
215 |
} else if (!strcmp(p, "config")) { |
} else if (!strcmp(p, "config")) { |
216 |
if (optarg) |
if (optarg) |
217 |
info_string = optarg; |
info_string = optarg; |
|
} else if (!strcmp(p, "sed")) { |
|
|
if (optarg) |
|
|
sed_string = optarg; |
|
218 |
} else if (gtagsconf || gtagslabel) { |
} else if (gtagsconf || gtagslabel) { |
219 |
char value[MAXPATHLEN+1]; |
char value[MAXPATHLEN+1]; |
220 |
const char *name = (gtagsconf) ? "GTAGSCONF" : "GTAGSLABEL"; |
const char *name = (gtagsconf) ? "GTAGSCONF" : "GTAGSLABEL"; |
412 |
} |
} |
413 |
vfind_close(); |
vfind_close(); |
414 |
exit(0); |
exit(0); |
|
} else if (do_sed) { |
|
|
/* |
|
|
* This code is used by gtags(1) to convert from path to |
|
|
* file id. The 'gtags --sed fid' is equivalent with |
|
|
* 'sed "s@<path>@fid@"'. |
|
|
*/ |
|
|
STRBUF *ib = strbuf_open(MAXBUFLEN); |
|
|
const char *ctags_x; |
|
|
|
|
|
while ((ctags_x = strbuf_fgets(ib, stdin, 0)) != NULL) { |
|
|
char *p = locatestring(ctags_x, "./", MATCH_FIRST); |
|
|
if (p == NULL) |
|
|
die("gtags --sed: path name not found."); |
|
|
*p++ = '\0'; |
|
|
fputs(ctags_x, stdout); |
|
|
while (*p && !isspace((unsigned char)*p)) |
|
|
p++; |
|
|
fputs(sed_string, stdout); |
|
|
fputs(p, stdout); |
|
|
} |
|
|
exit(0); |
|
415 |
} else if (do_sort) { |
} else if (do_sort) { |
416 |
/* |
/* |
417 |
* This code and the makedupindex() in htags(1) compose |
* This code and the makedupindex() in htags(1) compose |
843 |
#endif |
#endif |
844 |
|
|
845 |
gtop = gtags_open(dbpath, root, db, GTAGS_MODIFY, 0); |
gtop = gtags_open(dbpath, root, db, GTAGS_MODIFY, 0); |
|
if (gtop->format & GTAGS_COMPACT) { |
|
|
/* force processing files individually. */ |
|
|
path_list_max = 0; |
|
|
} |
|
846 |
|
|
847 |
if (vflag) { |
if (vflag) { |
848 |
char fid[32]; |
char fid[32]; |
963 |
if (vflag > 1) |
if (vflag > 1) |
964 |
fprintf(stderr, " using tag command '%s <path>'.\n", comline); |
fprintf(stderr, " using tag command '%s <path>'.\n", comline); |
965 |
gtop = gtags_open(dbpath, root, db, GTAGS_CREATE, flags); |
gtop = gtags_open(dbpath, root, db, GTAGS_CREATE, flags); |
|
if (gtop->format & GTAGS_COMPACT) { |
|
|
/* force processing files individually. */ |
|
|
path_list_max = 0; |
|
|
} |
|
966 |
gflags = 0; |
gflags = 0; |
967 |
if (extractmethod) |
if (extractmethod) |
968 |
gflags |= GTAGS_EXTRACTMETHOD; |
gflags |= GTAGS_EXTRACTMETHOD; |