summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/grijp.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/grijp.c b/src/grijp.c
index feb92c1..8a939f1 100644
--- a/src/grijp.c
+++ b/src/grijp.c
@@ -23,6 +23,7 @@ static bool icase = false;
static bool binary = false;
static bool list = false;
static bool invert = false;
+static bool quiet = false;
static size_t npat = 0;
static void **patterns = NULL; // can hold `char*` or `regex_t*`
@@ -44,7 +45,7 @@ static void usage(FILE *f) {
// Returns pointer to argument array containing patterns and then the file names
static char** parse_options(int argc, char **argv) {
int opt;
- while ((opt = getopt(argc, argv, "FiEUlLvhV")) != -1) {
+ while ((opt = getopt(argc, argv, "FiEUlLvqhV")) != -1) {
switch (opt) {
case 'F':
fixed = true;
@@ -68,6 +69,9 @@ static char** parse_options(int argc, char **argv) {
case 'v':
invert = true;
break;
+ case 'q':
+ quiet = true;
+ break;
case 'h':
usage(stdout);
@@ -124,6 +128,8 @@ static void compile_regexps() {
}
static void printMatch(char *fname, char *line) {
+ if (quiet) return;
+
if (list) {
printf("%s\n", fname);
return;