From 160d5bea5420820dd523ceaa44437f6ba1619022 Mon Sep 17 00:00:00 2001
From: ruoshu <bei540296467@yahoo.com>
Date: Mon, 21 Mar 2022 19:42:30 +0800
Subject: [PATCH] add --no-line-number and --no-recursive option

---
 src/grep.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/grep.c b/src/grep.c
index 4109ae4..16bdc7a 100644
--- a/src/grep.c
+++ b/src/grep.c
@@ -498,7 +498,9 @@ enum
   INCLUDE_OPTION,
   LINE_BUFFERED_OPTION,
   LABEL_OPTION,
-  NO_IGNORE_CASE_OPTION
+  NO_IGNORE_CASE_OPTION,
+  NO_LINE_NUMBER_OPTION,
+  NO_RECURSIVE_OPTION
 };
 
 /* Long options equivalences. */
@@ -534,6 +536,7 @@ static struct option const long_options[] =
   {"label", required_argument, NULL, LABEL_OPTION},
   {"line-buffered", no_argument, NULL, LINE_BUFFERED_OPTION},
   {"line-number", no_argument, NULL, 'n'},
+  {"no-line-number", no_argument, NULL, NO_LINE_NUMBER_OPTION},
   {"line-regexp", no_argument, NULL, 'x'},
   {"max-count", required_argument, NULL, 'm'},
 
@@ -545,6 +548,7 @@ static struct option const long_options[] =
   {"only-matching", no_argument, NULL, 'o'},
   {"quiet", no_argument, NULL, 'q'},
   {"recursive", no_argument, NULL, 'r'},
+  {"no-recursive", no_argument, NULL, NO_RECURSIVE_OPTION},
   {"dereference-recursive", no_argument, NULL, 'R'},
   {"regexp", required_argument, NULL, 'e'},
   {"invert-match", no_argument, NULL, 'v'},
@@ -2693,6 +2697,10 @@ main (int argc, char **argv)
       case 'n':
         out_line = true;
         break;
+		
+	  case NO_LINE_NUMBER_OPTION:
+	    out_line = false;
+		break;
 
       case 'o':
         only_matching = true;
@@ -2710,6 +2718,10 @@ main (int argc, char **argv)
         directories = RECURSE_DIRECTORIES;
         last_recursive = prev_optind;
         break;
+		
+	  case NO_RECURSIVE_OPTION:
+	    directories = SKIP_DIRECTORIES;
+		break;
 
       case 's':
         suppress_errors = true;
-- 
2.28.0.windows.1

