Lines 80-85
Link Here
|
80 |
char *p; |
80 |
char *p; |
81 |
char do_count, do_regex, do_eclass, do_list; |
81 |
char do_count, do_regex, do_eclass, do_list; |
82 |
char show_filename, skip_comments, invert_list, show_name; |
82 |
char show_filename, skip_comments, invert_list, show_name; |
|
|
83 |
char per_file_output; |
83 |
FILE *fp = NULL; |
84 |
FILE *fp = NULL; |
84 |
DIR *eclass_dir = NULL; |
85 |
DIR *eclass_dir = NULL; |
85 |
struct dirent *dentry; |
86 |
struct dirent *dentry; |
Lines 127-134
Link Here
|
127 |
if (argc == optind) |
128 |
if (argc == optind) |
128 |
qgrep_usage(EXIT_FAILURE); |
129 |
qgrep_usage(EXIT_FAILURE); |
129 |
|
130 |
|
130 |
if (do_list) |
131 |
if (do_list && do_count) { |
|
|
132 |
warnf("%s and --count are incompatible options. The former wins.", |
133 |
(invert_list ? "--invert-list" : "--list")); |
131 |
do_count = 0; |
134 |
do_count = 0; |
|
|
135 |
} |
136 |
|
137 |
if (show_name && show_filename) { |
138 |
warn("--with-name and --with-filename are incompatible options. The former wins."); |
139 |
show_filename = 0; |
140 |
} |
141 |
|
142 |
/* do we report results once per file or per line ? */ |
143 |
per_file_output = do_count || (do_list && (!verbose || invert_list)); |
132 |
|
144 |
|
133 |
if (argc > (optind + 1)) { |
145 |
if (argc > (optind + 1)) { |
134 |
include_atoms = xcalloc(sizeof(depend_atom*), (argc - optind - 1)); |
146 |
include_atoms = xcalloc(sizeof(depend_atom*), (argc - optind - 1)); |
Lines 251-265
Link Here
|
251 |
} |
263 |
} |
252 |
|
264 |
|
253 |
count++; |
265 |
count++; |
254 |
if (do_count || do_list) continue; |
266 |
if (per_file_output) continue; |
255 |
if (verbose || show_filename || show_name) { |
267 |
if (verbose || show_filename || show_name) { |
256 |
printf("%s:", (show_name ? name : ebuild)); |
268 |
printf("%s", (show_name ? name : ebuild)); |
257 |
if (verbose > 1) printf("%d:", lineno); |
269 |
if (verbose > 1) printf(":%d", lineno); |
258 |
printf(" "); |
270 |
if (!do_list) |
|
|
271 |
printf(": "); |
259 |
} |
272 |
} |
260 |
printf("%s\n", buf0); |
273 |
printf("%s\n", (do_list ? "" : buf0)); |
261 |
} |
274 |
} |
262 |
fclose(newfp); |
275 |
fclose(newfp); |
|
|
276 |
if (!per_file_output) continue; |
263 |
if (do_count && count) { |
277 |
if (do_count && count) { |
264 |
if (verbose || show_filename || show_name) |
278 |
if (verbose || show_filename || show_name) |
265 |
printf("%s:", (show_name ? name : ebuild)); |
279 |
printf("%s:", (show_name ? name : ebuild)); |