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

Diff of /global/global/global.c

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

revision 1.117 by shigio, Mon Nov 7 02:26:24 2005 UTC revision 1.118 by shigio, Mon Nov 7 12:17:48 2005 UTC
# Line 763  void Line 763  void
763  grep(const char *dbpath, const char *pattern)  grep(const char *dbpath, const char *pattern)
764  {  {
765          FILE *op, *fp;          FILE *op, *fp;
766            GFIND *gp;
767          STRBUF *ib = strbuf_open(MAXBUFLEN);          STRBUF *ib = strbuf_open(MAXBUFLEN);
768          const char *path;          const char *path;
769          char edit[IDENTLEN+1];          char edit[IDENTLEN+1];
# Line 789  grep(const char *dbpath, const char *pat Line 790  grep(const char *dbpath, const char *pat
790           * The older version (4.8.7 or former) of GPATH doesn't have files           * The older version (4.8.7 or former) of GPATH doesn't have files
791           * other than source file. The oflag requires new version of GPATH.           * other than source file. The oflag requires new version of GPATH.
792           */           */
793          if (gfind_open(dbpath, localprefix, oflag) < 2 && oflag)          gp = gfind_open(dbpath, localprefix, oflag);
794            if (gp->version < 2 && oflag)
795                  die("GPATH is old format. Please remake it by invoking gtags(1).");                  die("GPATH is old format. Please remake it by invoking gtags(1).");
796          while ((path = gfind_read()) != NULL) {          while ((path = gfind_read(gp)) != NULL) {
797                  if (!(fp = fopen(path, "r")))                  if (!(fp = fopen(path, "r")))
798                          die("cannot open file '%s'.", path);                          die("cannot open file '%s'.", path);
799                  linenum = 0;                  linenum = 0;
# Line 814  grep(const char *dbpath, const char *pat Line 816  grep(const char *dbpath, const char *pat
816                  }                  }
817                  fclose(fp);                  fclose(fp);
818          }          }
819          gfind_close();          gfind_close(gp);
820          closefilter(op);          closefilter(op);
821          strbuf_close(ib);          strbuf_close(ib);
822          regfree(&preg);          regfree(&preg);
# Line 836  grep(const char *dbpath, const char *pat Line 838  grep(const char *dbpath, const char *pat
838  void  void
839  pathlist(const char *dbpath, const char *av)  pathlist(const char *dbpath, const char *av)
840  {  {
841            GFIND *gp;
842          FILE *op;          FILE *op;
843          const char *path, *p;          const char *path, *p;
844          regex_t preg;          regex_t preg;
# Line 863  pathlist(const char *dbpath, const char Line 866  pathlist(const char *dbpath, const char
866           * The older version (4.8.7 or former) of GPATH doesn't have files           * The older version (4.8.7 or former) of GPATH doesn't have files
867           * other than source file. The oflag requires new version of GPATH.           * other than source file. The oflag requires new version of GPATH.
868           */           */
869          if (gfind_open(dbpath, localprefix, oflag) < 2 && oflag)          gp = gfind_open(dbpath, localprefix, oflag);
870            if (gp->version < 2 && oflag)
871                  die("GPATH is old format. Please remake it by invoking gtags(1).");                  die("GPATH is old format. Please remake it by invoking gtags(1).");
872          while ((path = gfind_read()) != NULL) {          while ((path = gfind_read(gp)) != NULL) {
873                  /*                  /*
874                   * skip localprefix because end-user doesn't see it.                   * skip localprefix because end-user doesn't see it.
875                   */                   */
# Line 882  pathlist(const char *dbpath, const char Line 886  pathlist(const char *dbpath, const char
886                  }                  }
887                  count++;                  count++;
888          }          }
889          gfind_close();          gfind_close(gp);
890          closefilter(op);          closefilter(op);
891          if (av)          if (av)
892                  regfree(&preg);                  regfree(&preg);

Legend:
Removed from v.1.117  
changed lines
  Added in v.1.118

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