/[global]/global/gtags/gtags.c
ViewVC logotype

Diff of /global/gtags/gtags.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.92 by shigio, Fri Oct 29 09:47:30 2004 UTC revision 1.93 by shigio, Wed Nov 3 13:31:48 2004 UTC
# Line 82  int show_help; Line 82  int show_help;
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;
# Line 95  int debug; Line 96  int debug;
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;
# Line 138  static struct option const long_options[ Line 140  static struct option const long_options[
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},
# Line 210  main(argc, argv) Line 213  main(argc, argv)
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";
# Line 421  main(argc, argv) Line 427  main(argc, argv)
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

Legend:
Removed from v.1.92  
changed lines
  Added in v.1.93

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26