aboutsummaryrefslogtreecommitdiff
path: root/findutils
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2012-03-22 16:14:13 +0000
committerRon Yorston <rmy@pobox.com>2012-03-22 16:14:13 +0000
commit800c3f176fb21e30fbaa81ef68f50e601ea2f78b (patch)
tree84f4a2bf30d3208a020b25c82c11ac636c7072c6 /findutils
parent9db164d6e39050d09f38288c6045cd2a2cbf6d63 (diff)
parentf99811908419608e3ab81393d0177cc456101e4b (diff)
downloadbusybox-w32-800c3f176fb21e30fbaa81ef68f50e601ea2f78b.tar.gz
busybox-w32-800c3f176fb21e30fbaa81ef68f50e601ea2f78b.tar.bz2
busybox-w32-800c3f176fb21e30fbaa81ef68f50e601ea2f78b.zip
Merge commit '1_19_4' into merge_1_19
Diffstat (limited to 'findutils')
-rw-r--r--findutils/find.c5
-rw-r--r--findutils/grep.c22
2 files changed, 17 insertions, 10 deletions
diff --git a/findutils/find.c b/findutils/find.c
index 05f88d2f0..fc0fc5c9f 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -932,7 +932,10 @@ static action*** parse_params(char **argv)
932 * expression is reached. 932 * expression is reached.
933 */ 933 */
934 /* Options */ 934 /* Options */
935 if (0) { } 935 if (parm == OPT_FOLLOW) {
936 dbg("follow enabled: %d", __LINE__);
937 G.recurse_flags |= ACTION_FOLLOWLINKS | ACTION_DANGLING_OK;
938 }
936#if ENABLE_FEATURE_FIND_XDEV 939#if ENABLE_FEATURE_FIND_XDEV
937 else if (parm == OPT_XDEV) { 940 else if (parm == OPT_XDEV) {
938 dbg("%d", __LINE__); 941 dbg("%d", __LINE__);
diff --git a/findutils/grep.c b/findutils/grep.c
index fa3b8a3a9..f3463f94e 100644
--- a/findutils/grep.c
+++ b/findutils/grep.c
@@ -570,20 +570,20 @@ static char *add_grep_list_data(char *pattern)
570 570
571static void load_regexes_from_file(llist_t *fopt) 571static void load_regexes_from_file(llist_t *fopt)
572{ 572{
573 char *line;
574 FILE *f;
575
576 while (fopt) { 573 while (fopt) {
574 char *line;
575 FILE *fp;
577 llist_t *cur = fopt; 576 llist_t *cur = fopt;
578 char *ffile = cur->data; 577 char *ffile = cur->data;
579 578
580 fopt = cur->link; 579 fopt = cur->link;
581 free(cur); 580 free(cur);
582 f = xfopen_stdin(ffile); 581 fp = xfopen_stdin(ffile);
583 while ((line = xmalloc_fgetline(f)) != NULL) { 582 while ((line = xmalloc_fgetline(fp)) != NULL) {
584 llist_add_to(&pattern_head, 583 llist_add_to(&pattern_head,
585 new_grep_list_data(line, ALLOCATED)); 584 new_grep_list_data(line, ALLOCATED));
586 } 585 }
586 fclose_if_not_stdin(fp);
587 } 587 }
588} 588}
589 589
@@ -667,15 +667,19 @@ int grep_main(int argc UNUSED_PARAM, char **argv)
667#endif 667#endif
668 invert_search = ((option_mask32 & OPT_v) != 0); /* 0 | 1 */ 668 invert_search = ((option_mask32 & OPT_v) != 0); /* 0 | 1 */
669 669
670 if (pattern_head != NULL) { 670 { /* convert char **argv to grep_list_data_t */
671 /* convert char **argv to grep_list_data_t */
672 llist_t *cur; 671 llist_t *cur;
673
674 for (cur = pattern_head; cur; cur = cur->link) 672 for (cur = pattern_head; cur; cur = cur->link)
675 cur->data = new_grep_list_data(cur->data, 0); 673 cur->data = new_grep_list_data(cur->data, 0);
676 } 674 }
677 if (option_mask32 & OPT_f) 675 if (option_mask32 & OPT_f) {
678 load_regexes_from_file(fopt); 676 load_regexes_from_file(fopt);
677 if (!pattern_head) { /* -f EMPTY_FILE? */
678 /* GNU grep treats it as "nothing matches" */
679 llist_add_to(&pattern_head, new_grep_list_data((char*) "", 0));
680 invert_search ^= 1;
681 }
682 }
679 683
680 if (ENABLE_FEATURE_GREP_FGREP_ALIAS && applet_name[0] == 'f') 684 if (ENABLE_FEATURE_GREP_FGREP_ALIAS && applet_name[0] == 'f')
681 option_mask32 |= OPT_F; 685 option_mask32 |= OPT_F;