From 460cc21152843b1fd531bcc600e28a3776d5d8ff Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Sun, 2 Nov 2025 21:29:04 +0100 Subject: [PATCH] src/bin/grepc: -x: Simplify implementation Signed-off-by: Alejandro Colomar --- src/bin/grepc | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/src/bin/grepc b/src/bin/grepc index 8e3caa0a5..627917652 100755 --- a/src/bin/grepc +++ b/src/bin/grepc @@ -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)"; -- 2.47.3