scribo

Email-based phlog generator
git clone git://git.z3bra.org/scribo.git
Log | Files | Refs

commit 866b5fcbd5aa5bdd3ea2fecdf3b568be1631ecf0
parent 2be2aca8183d21409e11f0662fe5ce761adeb89a
Author: Willy Goiffon <dev@z3bra.org>
Date:   Wed,  9 Sep 2020 09:15:53 +0200

Optionally accept input from a command (eg. fmt(1))

Diffstat:
Mscribo.c | 9+++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/scribo.c b/scribo.c @@ -47,7 +47,7 @@ int writeindex(FILE *, char *); void usage(char *pgm) { - fprintf(stderr, "usage: %s [-a author] [-b basedir] [-d fmt] [-io file]\n", pgm); + fprintf(stderr, "usage: %s [-a author] [-b basedir] [-d fmt] [-io file] [-x cmd]\n", pgm); } char * @@ -273,7 +273,7 @@ int main(int argc, char *argv[]) { FILE *in = stdin, *out = stdout; - char *argv0, *infile, *outfile; + char *argv0, *cmd, *infile, *outfile; struct headers headers; infile = NULL; @@ -295,6 +295,9 @@ main(int argc, char *argv[]) case 'o': outfile = EARGF(usage(argv0)); break; + case 'x': + cmd = EARGF(usage(argv0)); + break; default: usage(argv0); exit(1); @@ -302,6 +305,8 @@ main(int argc, char *argv[]) if (infile && strcmp(infile, "-")) in = fopen(infile, "r"); + else if (cmd) + in = popen(cmd, "r"); if (!in) { perror(infile);