/[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.121 by shigio, Wed Jul 6 01:25:04 2005 UTC revision 1.122 by h-iwamoto, Wed Jul 6 12:01:15 2005 UTC
# Line 88  int show_help; Line 88  int show_help;
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;
# Line 102  int secure_mode; Line 101  int secure_mode;
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;
# Line 145  static struct option const long_options[ Line 143  static struct option const long_options[
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},
# Line 218  main(argc, argv) Line 215  main(argc, argv)
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";
# Line 418  main(argc, argv) Line 412  main(argc, argv)
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
# Line 870  updatetags(dbpath, root, deleteset, addl Line 843  updatetags(dbpath, root, deleteset, addl
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];
# Line 994  createtags(dbpath, root, db) Line 963  createtags(dbpath, root, db)
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;

Legend:
Removed from v.1.121  
changed lines
  Added in v.1.122

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