From feb158c34f8eb5dddf83c9f99ced73c92c70f8d1 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Sat, 9 Dec 2023 22:43:27 +0100 Subject: Replace ā€˜-dā€™ with ā€˜-zā€™ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- grab.1 | 2 +- grab.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/grab.1 b/grab.1 index 8349fc4..b86f5d2 100644 --- a/grab.1 +++ b/grab.1 @@ -6,7 +6,7 @@ .Nd search for patterns in files .Sh SYNOPSIS .Nm -.Op Fl d Ar string +.Op Fl z .Ar pattern .Op Ar .Sh DESCRIPTION diff --git a/grab.c b/grab.c index 74f7e44..117f466 100644 --- a/grab.c +++ b/grab.c @@ -54,8 +54,8 @@ static struct ops comppat(char *); static bool xisspace(char); static char *xstrchrnul(const char *, char); +static char delim = '\n'; static int rv = EXIT_SUCCESS; -static const char *delim = "\n"; static const cmd_func op_table[UCHAR_MAX] = { ['g'] = cmdg, ['v'] = cmdg, @@ -81,10 +81,10 @@ main(int argc, char **argv) setlocale(LC_ALL, ""); - while ((opt = getopt(argc, argv, "d:")) != -1) { + while ((opt = getopt(argc, argv, "z")) != -1) { switch (opt) { - case 'd': - delim = optarg; + case 'z': + delim = '\0'; break; default: usage(argv[0]); @@ -239,7 +239,7 @@ void putsv(struct sv sv) { fwrite(sv.p, 1, sv.len, stdout); - fputs(delim, stdout); + putchar(delim); } regex_t -- cgit v1.2.3