/[global]/global/htags/path2url.c
ViewVC logotype

Diff of /global/htags/path2url.c

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

revision 1.3 by h-iwamoto, Mon Aug 9 13:09:50 2004 UTC revision 1.4 by shigio, Fri Oct 29 07:07:06 2004 UTC
# Line 46  void Line 46  void
46  load_gpath(dbpath)  load_gpath(dbpath)
47          char *dbpath;          char *dbpath;
48  {  {
49          char command[MAXFILLEN];          DBOP *dbop;
50          STRBUF *sb = strbuf_open(0);          char *path;
51          FILE *gpath;          int n;
         char *_;  
52    
53          assoc = assoc_open('a');          assoc = assoc_open('a');
   
54          nextkey = 0;          nextkey = 0;
55          snprintf(command, sizeof(command), "gtags --scandb=%s/%s ./", dbpath, dbname(GPATH));          dbop = dbop_open(makepath(dbpath, dbname(GPATH), NULL), 0, 0, 0);
56          if (!(gpath = popen(command, "r")))          if (dbop == NULL)
57                  die("cannot execute '%s'.", command);                  die("cannot open '%s'.", makepath(dbpath, dbname(GPATH), NULL));
58          while ((_ = strbuf_fgets(sb, gpath, STRBUF_NOCRLF)) != NULL) {          for (path = dbop_first(dbop, "./", NULL, DBOP_PREFIX | DBOP_KEY); path; path = dbop_next(dbop)) {
59                  SPLIT ptable;                  char *no = dbop_lastdat(dbop);
                 char *path, *no;  
                 int n;  
60    
                 if (split(_, 2, &ptable) < 2) {  
                         recover(&ptable);  
                         die("too small number of parts in load_gpath().\n'%s'", _);  
                 }  
                 path = ptable.part[0].start;  
                 no   = ptable.part[1].start;  
61                  path += 2;                      /* remove './' */                  path += 2;                      /* remove './' */
62                  assoc_put(assoc, path, no);                  assoc_put(assoc, path, no);
63                  n = atoi(no);                  n = atoi(no);
64                  if (n > nextkey)                  if (n > nextkey)
65                          nextkey = n;                          nextkey = n;
                 recover(&ptable);  
66          }          }
67          if (pclose(gpath) < 0)          dbop_close(dbop);
                 die("command '%s' failed.", command);  
         strbuf_close(sb);  
68  }  }
69  /*  /*
70   * unload_gpath: load gpath tag file.   * unload_gpath: load gpath tag file.

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

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