906 |
STRBUF *comline = strbuf_open(0); |
STRBUF *comline = strbuf_open(0); |
907 |
STRBUF *path_list = strbuf_open(MAXPATHLEN); |
STRBUF *path_list = strbuf_open(MAXPATHLEN); |
908 |
XARGS *xp; |
XARGS *xp; |
909 |
char *p; |
char *ctags_x; |
910 |
|
|
911 |
snprintf(rootdir, sizeof(rootdir), "%s/", root); |
snprintf(rootdir, sizeof(rootdir), "%s/", root); |
912 |
/* |
/* |
975 |
if (chdir(root) < 0) |
if (chdir(root) < 0) |
976 |
die("cannot move to '%s' directory.", root); |
die("cannot move to '%s' directory.", root); |
977 |
xp = xargs_open_with_strbuf(strbuf_value(comline), 0, path_list); |
xp = xargs_open_with_strbuf(strbuf_value(comline), 0, path_list); |
978 |
while ((p = xargs_read(xp)) != NULL) { |
while ((ctags_x = xargs_read(xp)) != NULL) { |
979 |
printtag(op, p); |
printtag(op, ctags_x); |
980 |
count++; |
count++; |
981 |
} |
} |
982 |
xargs_close(xp); |
xargs_close(xp); |
1011 |
int |
int |
1012 |
search(const char *pattern, const char *root, const char *dbpath, int db) |
search(const char *pattern, const char *root, const char *dbpath, int db) |
1013 |
{ |
{ |
1014 |
const char *p; |
const char *ctags_x; |
1015 |
int count = 0; |
int count = 0; |
1016 |
FILE *op; |
FILE *op; |
1017 |
GTOP *gtop; |
GTOP *gtop; |
1041 |
} |
} |
1042 |
if (Gflag) |
if (Gflag) |
1043 |
flags |= GTOP_BASICREGEX; |
flags |= GTOP_BASICREGEX; |
1044 |
for (p = gtags_first(gtop, pattern, flags); p; p = gtags_next(gtop)) { |
for (ctags_x = gtags_first(gtop, pattern, flags); ctags_x; ctags_x = gtags_next(gtop)) { |
1045 |
if (lflag) { |
if (lflag) { |
1046 |
const char *q; |
const char *q; |
1047 |
/* locate start point of a path */ |
/* locate start point of a path */ |
1048 |
q = locatestring(p, "./", MATCH_FIRST); |
q = locatestring(ctags_x, "./", MATCH_FIRST); |
1049 |
if (!locatestring(q, localprefix, MATCH_AT_FIRST)) |
if (!locatestring(q, localprefix, MATCH_AT_FIRST)) |
1050 |
continue; |
continue; |
1051 |
} |
} |
1052 |
printtag(op, p); |
printtag(op, ctags_x); |
1053 |
count++; |
count++; |
1054 |
} |
} |
1055 |
closefilter(op); |
closefilter(op); |