]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
src/bin/grepc: -x: Simplify implementation
authorAlejandro Colomar <alx@kernel.org>
Sun, 2 Nov 2025 20:29:04 +0000 (21:29 +0100)
committerAlejandro Colomar <alx@kernel.org>
Mon, 3 Nov 2025 10:42:41 +0000 (11:42 +0100)
Signed-off-by: Alejandro Colomar <alx@kernel.org>
src/bin/grepc

index 8e3caa0a5c8a49566036f174564f9e4acd314ef7..62791765200e905aeaafc20720406691f56aa9a9 100755 (executable)
@@ -19,7 +19,7 @@ m='';
 n='';
 r='no';
 t='';
-x=''
+x='c';
 
 
 grepc_err()
@@ -42,22 +42,8 @@ while getopts "A:B:C:chilm:nrt:x:" opt; do
        n)      n='-n';                 ;;
        r)      r='yes';                ;;
        t)      t="$t -t$OPTARG";       ;;
-       x)
-               if test -n "$x"; then
-                       grepc_err "-$opt: This option cannot be repeated.";
-               fi;
-
-               case "$OPTARG" in
-               c)      x='c';          ;;
-               mk)     x='mk';         ;;
-               *)
-                       grepc_err "-$opt: $OPTARG: Unknown argument.";
-                       ;;
-               esac;
-               ;;
-       \? | *)
-               exit 2;
-               ;;
+       x)      x="$OPTARG";            ;;
+       \? | *) exit 2;                 ;;
        esac;
 done;
 shift $((OPTIND-1));
@@ -68,10 +54,6 @@ fi;
 identifier="$1";
 shift;
 
-if test -z "$x"; then
-       x='c';
-fi;
-
 
 patterns="$(mktemp -t grepc.patterns.XXXXXX)";