scribo

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.z3bra.org/scribo.git
Log | Files | Refs

commit 5bc8b7de2cecfaced64273f794f901db2bdbf9b4
parent 2afee9ff157c4e6b7b4a78b91ebb244d4fbeb37d
Author: Willy Goiffon <dev@z3bra.org>
Date:   Sun,  6 Sep 2020 20:59:28 +0200

Add flag to change working directory

Diffstat:
Aconfig.h | 1+
Mscribo.c | 7+++++++
2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/config.h b/config.h @@ -0,0 +1 @@ +char *basedir = "/var/gopher/phlog"; diff --git a/scribo.c b/scribo.c @@ -8,6 +8,7 @@ #include <sys/queue.h> #include "arg.h" +#include "config.h" #include "rfc5322.h" void @@ -29,6 +30,9 @@ main(int argc, char *argv[]) outfile = NULL; ARGBEGIN { + case 'b': + basedir = EARGF(usage(argv0)); + break; /* NOTREACHED */ case 'i': infile = EARGF(usage(argv0)); break; /* NOTREACHED */ @@ -40,6 +44,9 @@ main(int argc, char *argv[]) exit(1); } ARGEND; + if (chdir(basedir) < 0) + return -1; + if (infile) in = fopen(infile, "r");