/[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.103 by shigio, Sun Aug 28 11:05:20 2005 UTC revision 1.104 by shigio, Sun Sep 4 02:00:45 2005 UTC
# Line 900  parsefile(argc, argv, cwd, root, dbpath, Line 900  parsefile(argc, argv, cwd, root, dbpath,
900          const char *dbpath;          const char *dbpath;
901          int db;          int db;
902  {  {
903            char rootdir[MAXPATHLEN+1];
904          char buf[MAXPATHLEN+1], *path;          char buf[MAXPATHLEN+1], *path;
905          FILE *op;          FILE *op;
906          int count;          int count;
907          STRBUF *comline = strbuf_open(0);          STRBUF *comline = strbuf_open(0);
908          STRBUF *path_list = strbuf_open(MAXPATHLEN);          STRBUF *path_list = strbuf_open(MAXPATHLEN);
909          int path_list_max;          int path_list_max;
         size_t rootlen = strlen(root);  
910    
911            snprintf(rootdir, sizeof(rootdir), "%s/", root);
912          /*          /*
913           * teach parser where is dbpath.           * teach parser where is dbpath.
914           */           */
# Line 949  parsefile(argc, argv, cwd, root, dbpath, Line 950  parsefile(argc, argv, cwd, root, dbpath,
950                          die("realpath(%s, buf) failed. (errno=%d).", av, errno);                          die("realpath(%s, buf) failed. (errno=%d).", av, errno);
951                  if (!isabspath(path))                  if (!isabspath(path))
952                          die("realpath(3) is not compatible with BSD version.");                          die("realpath(3) is not compatible with BSD version.");
953                  if (strncmp(path, root, rootlen) || path[rootlen] != '/') {                  /*
954                     * Remove the root part of path and insert './'.
955                     *      rootdir  /a/b/
956                     *      path     /a/b/c/d.c -> c/d.c -> ./c/d.c
957                     */
958                    path = locatestring(path, rootdir, MATCH_AT_FIRST);
959                    if (path == NULL) {
960                          if (!qflag)                          if (!qflag)
961                                  fprintf(stderr, "'%s' is out of source tree.\n", path);                                  fprintf(stderr, "'%s' is out of source tree.\n", path);
962                          continue;                          continue;
963                  }                  }
964                  path += rootlen - 1;                  path -= 2;
965                  *path = '.';                  *path = '.';
966                  if (!gpath_path2fid(path)) {                  if (!gpath_path2fid(path)) {
967                          if (!qflag)                          if (!qflag)

Legend:
Removed from v.1.103  
changed lines
  Added in v.1.104

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