diff options
-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 |