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

Diff of /global/htags/htags.c

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

revision 1.76 by shigio, Mon Oct 31 12:44:14 2005 UTC revision 1.77 by shigio, Mon Nov 7 12:17:49 2005 UTC
# Line 81  char datadir[MAXPATHLEN]; Line 81  char datadir[MAXPATHLEN];
81  char sort_path[MAXFILLEN];  char sort_path[MAXFILLEN];
82  char gtags_path[MAXFILLEN];  char gtags_path[MAXFILLEN];
83  char global_path[MAXFILLEN];  char global_path[MAXFILLEN];
 char findcom[MAXFILLEN];  
84  const char *null_device = NULL_DEVICE;  const char *null_device = NULL_DEVICE;
85  const char *tmpdir = "/tmp";  const char *tmpdir = "/tmp";
86    
# Line 740  makehtaccess(const char *file) Line 739  makehtaccess(const char *file)
739  static void  static void
740  makehtml(int total)  makehtml(int total)
741  {  {
742          char command[MAXFILLEN];          GFIND *gp;
743          FILE *ip, *source_stream, *anchor_stream;          FILE *ip, *source_stream, *anchor_stream;
744          const char *path;          const char *path;
745          int count = 0;          int count = 0;
# Line 751  makehtml(int total) Line 750  makehtml(int total)
750           *      source_stream: for src2html()           *      source_stream: for src2html()
751           *      anchor_stream: for anchor_load().           *      anchor_stream: for anchor_load().
752           */           */
         if (other_files && !dynamic)  
                 snprintf(command, sizeof(command), "%s --other | %s -t / -k 2", findcom, POSIX_SORT);  
         else  
                 strlimcpy(command, findcom, sizeof(command));  
         ip = popen(command, "r");  
         if (!ip)  
                 die("cannot execute command '%s'.", command);  
753          source_stream = tmpfile();          source_stream = tmpfile();
754          anchor_stream = tmpfile();          anchor_stream = tmpfile();
755          while (strbuf_fgets(sb, ip, 0) != NULL) {          gp = gfind_open(dbpath, NULL, other_files && !dynamic);
756                  fputs(strbuf_value(sb), source_stream);          while ((path = gfind_read(gp)) != NULL) {
757                  fputs(strbuf_value(sb), anchor_stream);                  if (gp->type == GPATH_OTHER)
758                            fputc(' ', source_stream);
759                    fputs(path, source_stream);
760                    fputc('\n', source_stream);
761                    if (gp->type == GPATH_OTHER)
762                            fputc(' ', anchor_stream);
763                    fputs(path, anchor_stream);
764                    fputc('\n', anchor_stream);
765          }          }
766          if (pclose(ip) != 0)          gfind_close(gp);
                 die("cannot traverse directory.(%s)", command);  
767          rewind(source_stream);          rewind(source_stream);
768          /*          /*
769           * Prepare anchor stream for anchor_load().           * Prepare anchor stream for anchor_load().
# Line 965  basic_check(void) Line 963  basic_check(void)
963          if (!(p = usable("global")))          if (!(p = usable("global")))
964                  die("global command required but not found.");                  die("global command required but not found.");
965          strlimcpy(global_path, p, sizeof(global_path));          strlimcpy(global_path, p, sizeof(global_path));
   
         snprintf(findcom, sizeof(findcom), "%s --find", gtags_path);  
   
966          /*          /*
967           * Temporary directory.           * Temporary directory.
968           */           */
# Line 1682  main(int argc, char **argv) Line 1677  main(int argc, char **argv)
1677                  strlimcpy(dbpath, buf, sizeof(dbpath));                  strlimcpy(dbpath, buf, sizeof(dbpath));
1678          }          }
1679          /*          /*
1680             * The older version (4.8.7 or former) of GPATH doesn't have files
1681             * other than source file. The oflag requires new version of GPATH.
1682             */
1683            if (other_files) {
1684                    GFIND *gp = gfind_open(dbpath, NULL, 0);
1685                    if (gp->version < 2)
1686                            die("GPATH is old format. Please remake it by invoking gtags(1).");
1687                    gfind_close(gp);
1688            }
1689            /*
1690           * for global(1) and gtags(1).           * for global(1) and gtags(1).
1691           */           */
1692          set_env("GTAGSROOT", cwdpath);          set_env("GTAGSROOT", cwdpath);

Legend:
Removed from v.1.76  
changed lines
  Added in v.1.77

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