diff options
author | Thomas Voss <mail@thomasvoss.com> | 2023-12-09 22:43:27 +0100 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2023-12-09 22:43:27 +0100 |
commit | feb158c34f8eb5dddf83c9f99ced73c92c70f8d1 (patch) | |
tree | 9b63df50405fd5503e3b1fb87c691e4c9af447ae | |
parent | f9fb0bcb723765d859bc97b41407f72ca584aa40 (diff) |
Replace ‘-d’ with ‘-z’
-rw-r--r-- | grab.1 | 2 | ||||
-rw-r--r-- | grab.c | 10 |
2 files changed, 6 insertions, 6 deletions
@@ -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 @@ -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 |