tAdd flag to change working directory - scribo - Email-based phlog generator
 (HTM) git clone git://git.z3bra.org/scribo.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 5bc8b7de2cecfaced64273f794f901db2bdbf9b4
 (DIR) parent 2afee9ff157c4e6b7b4a78b91ebb244d4fbeb37d
 (HTM) Author: Willy Goiffon <dev@z3bra.org>
       Date:   Sun,  6 Sep 2020 20:59:28 +0200
       
       Add flag to change working directory
       
       Diffstat:
         A config.h                            |       1 +
         M scribo.c                            |       7 +++++++
       
       2 files changed, 8 insertions(+), 0 deletions(-)
       ---
 (DIR) diff --git a/config.h b/config.h
       t@@ -0,0 +1 @@
       +char *basedir = "/var/gopher/phlog";
 (DIR) diff --git a/scribo.c b/scribo.c
       t@@ -8,6 +8,7 @@
        #include <sys/queue.h>
        
        #include "arg.h"
       +#include "config.h"
        #include "rfc5322.h"
        
        void
       t@@ -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 */
       t@@ -40,6 +44,9 @@ main(int argc, char *argv[])
                        exit(1);
                } ARGEND;
        
       +        if (chdir(basedir) < 0)
       +                return -1;
       +
                if (infile)
                        in = fopen(infile, "r");