76 |
int qflag; /* quiet mode */ |
int qflag; /* quiet mode */ |
77 |
int wflag; /* warning message */ |
int wflag; /* warning message */ |
78 |
int vflag; /* verbose mode */ |
int vflag; /* verbose mode */ |
79 |
|
int max_args; |
80 |
int show_version; |
int show_version; |
81 |
int show_help; |
int show_help; |
82 |
int show_config; |
int show_config; |
92 |
int other_files; |
int other_files; |
93 |
int debug; |
int debug; |
94 |
int secure_mode; |
int secure_mode; |
|
int noxargs; |
|
95 |
const char *extra_options; |
const char *extra_options; |
96 |
const char *info_string; |
const char *info_string; |
97 |
|
|
132 |
{"gtagsconf", required_argument, >agsconf, 1}, |
{"gtagsconf", required_argument, >agsconf, 1}, |
133 |
{"gtagslabel", required_argument, >agslabel, 1}, |
{"gtagslabel", required_argument, >agslabel, 1}, |
134 |
{"idutils", no_argument, NULL, 'I'}, |
{"idutils", no_argument, NULL, 'I'}, |
135 |
{"noxargs", no_argument, &noxargs, 1}, |
{"max-args", required_argument, NULL, 'n'}, |
136 |
{"other", no_argument, &other_files, 1}, |
{"other", no_argument, &other_files, 1}, |
137 |
{"relative", no_argument, &do_relative, 1}, |
{"relative", no_argument, &do_relative, 1}, |
138 |
{"secure", no_argument, &secure_mode, 1}, |
{"secure", no_argument, &secure_mode, 1}, |
199 |
int optchar; |
int optchar; |
200 |
int option_index = 0; |
int option_index = 0; |
201 |
|
|
202 |
while ((optchar = getopt_long(argc, argv, "cGiIoPqvw", long_options, &option_index)) != EOF) { |
while ((optchar = getopt_long(argc, argv, "cGiIn:oPqvw", long_options, &option_index)) != EOF) { |
203 |
switch (optchar) { |
switch (optchar) { |
204 |
case 0: |
case 0: |
205 |
p = long_options[option_index].name; |
p = long_options[option_index].name; |
231 |
case 'I': |
case 'I': |
232 |
Iflag++; |
Iflag++; |
233 |
break; |
break; |
234 |
|
case 'n': |
235 |
|
max_args = atoi(optarg); |
236 |
|
if (max_args <= 0) |
237 |
|
die("--max-args option requires number > 0."); |
238 |
|
break; |
239 |
case 'o': |
case 'o': |
240 |
oflag++; |
oflag++; |
241 |
break; |
break; |
804 |
STRBUF *comline = strbuf_open(0); |
STRBUF *comline = strbuf_open(0); |
805 |
int gflags; |
int gflags; |
806 |
int path_list_max; |
int path_list_max; |
807 |
|
int arg_count = 0; |
808 |
|
|
809 |
/* |
/* |
810 |
* GTAGS needed to make GRTAGS. |
* GTAGS needed to make GRTAGS. |
852 |
if (debug) |
if (debug) |
853 |
gflags |= GTAGS_DEBUG; |
gflags |= GTAGS_DEBUG; |
854 |
/* |
/* |
855 |
* If the --noxargs option is not specified, we pass the parser |
* If the --max-args option is not specified, we pass the parser |
856 |
* the source file as a lot as possible to decrease the invoking |
* the source file as a lot as possible to decrease the invoking |
857 |
* frequency of the parser. |
* frequency of the parser. |
858 |
*/ |
*/ |
875 |
* with a blank. |
* with a blank. |
876 |
*/ |
*/ |
877 |
if (strbuf_getlen(path_list)) { |
if (strbuf_getlen(path_list)) { |
878 |
if (path_list_max == 0 || strbuf_getlen(path_list) + pathlen > path_list_max) { |
if (path_list_max == 0 || |
879 |
|
(max_args > 0 && arg_count >= max_args) || |
880 |
|
strbuf_getlen(path_list) + pathlen > path_list_max) |
881 |
|
{ |
882 |
gtags_add(gtop, strbuf_value(comline), path_list, gflags); |
gtags_add(gtop, strbuf_value(comline), path_list, gflags); |
883 |
strbuf_reset(path_list); |
strbuf_reset(path_list); |
884 |
|
arg_count = 0; |
885 |
} |
} |
886 |
} |
} |
887 |
if (exitflag) |
if (exitflag) |
891 |
*/ |
*/ |
892 |
strbuf_puts0(path_list, path); |
strbuf_puts0(path_list, path); |
893 |
path += pathlen + 1; |
path += pathlen + 1; |
894 |
|
arg_count++; |
895 |
} |
} |
896 |
if (strbuf_getlen(path_list)) |
if (strbuf_getlen(path_list)) |
897 |
gtags_add(gtop, strbuf_value(comline), path_list, gflags); |
gtags_add(gtop, strbuf_value(comline), path_list, gflags); |
919 |
int flags, gflags; |
int flags, gflags; |
920 |
STRBUF *comline = strbuf_open(0); |
STRBUF *comline = strbuf_open(0); |
921 |
int count = 0; |
int count = 0; |
922 |
|
int arg_count = 0; |
923 |
STRBUF *path_list = strbuf_open(MAXPATHLEN); |
STRBUF *path_list = strbuf_open(MAXPATHLEN); |
924 |
int path_list_max; |
int path_list_max; |
925 |
|
|
966 |
if (debug) |
if (debug) |
967 |
gflags |= GTAGS_DEBUG; |
gflags |= GTAGS_DEBUG; |
968 |
/* |
/* |
969 |
* If the --noxargs option is not specified, we pass the parser |
* If the --max-args option is not specified, we pass the parser |
970 |
* the source file as a lot as possible to decrease the invoking |
* the source file as a lot as possible to decrease the invoking |
971 |
* frequency of the parser. |
* frequency of the parser. |
972 |
*/ |
*/ |
1007 |
* with a blank. |
* with a blank. |
1008 |
*/ |
*/ |
1009 |
if (strbuf_getlen(path_list)) { |
if (strbuf_getlen(path_list)) { |
1010 |
if (path_list_max == 0 || strbuf_getlen(path_list) + strlen(path) > path_list_max) { |
if (path_list_max == 0 || |
1011 |
|
(max_args > 0 && arg_count >= max_args) || |
1012 |
|
strbuf_getlen(path_list) + strlen(path) > path_list_max) |
1013 |
|
{ |
1014 |
gtags_add(gtop, strbuf_value(comline), path_list, gflags); |
gtags_add(gtop, strbuf_value(comline), path_list, gflags); |
1015 |
strbuf_reset(path_list); |
strbuf_reset(path_list); |
1016 |
|
arg_count = 0; |
1017 |
} |
} |
1018 |
} |
} |
1019 |
/* |
/* |
1020 |
* Add a path to path_list. |
* Add a path to path_list. |
1021 |
*/ |
*/ |
1022 |
strbuf_puts0(path_list, path); |
strbuf_puts0(path_list, path); |
1023 |
|
arg_count++; |
1024 |
} |
} |
1025 |
if (strbuf_getlen(path_list)) |
if (strbuf_getlen(path_list)) |
1026 |
gtags_add(gtop, strbuf_value(comline), path_list, gflags); |
gtags_add(gtop, strbuf_value(comline), path_list, gflags); |