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 |
|
|
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; |
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(). |
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 |
*/ |
*/ |
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); |