In Bug 78, shortkey points out:
[oweals/busybox.git] / findutils / grep.c
index ddc5cea9c25add772e92f555459e2f9b6e8909c8..9b26add9a465df6aa19caa7a7fe2f4a0f1873984 100644 (file)
@@ -98,7 +98,7 @@ static void print_line(const char *line, int linenum, char decoration)
        }
        last_line_printed = linenum;
 #endif
-       if (print_filename)
+       if (print_filename > 0)
                printf("%s%c", cur_file, decoration);
        if (print_line_num)
                printf("%i%c", linenum, decoration);
@@ -219,7 +219,7 @@ static int grep_file(FILE *file)
 
        /* grep -c: print [filename:]count, even if count is zero */
        if (print_match_counts) {
-               if (print_filename)
+               if (print_filename > 0)
                        printf("%s:", cur_file);
                    printf("%d\n", nmatches);
        }
@@ -249,9 +249,9 @@ static void load_regexes_from_file(llist_t *fopt)
                fopt = cur->link;
                free(cur);
                f = bb_xfopen(ffile, "r");
-       while ((line = bb_get_chomped_line_from_file(f)) != NULL) {
-               pattern_head = llist_add_to(pattern_head, line);
-       }
+               while ((line = bb_get_chomped_line_from_file(f)) != NULL) {
+                       pattern_head = llist_add_to(pattern_head, line);
+               }
        }
 }
 
@@ -261,7 +261,7 @@ extern int grep_main(int argc, char **argv)
        FILE *file;
        int matched;
        unsigned long opt;
-       llist_t *fopt;
+       llist_t *fopt = NULL;
 
        /* do normal option parsing */
 #ifdef CONFIG_FEATURE_GREP_CONTEXT