I promised in the docs that the HTML output directory would be
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Mon, 22 Feb 2010 19:59:47 +0000 (19:59 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Mon, 22 Feb 2010 19:59:47 +0000 (19:59 +0000)
created if it didn't exist, so I'd better actually do that.

git-svn-id: svn://svn.tartarus.org/sgt/agedu@8881 cda61777-01e9-0310-a592-d414129be87e

agedu.c

diff --git a/agedu.c b/agedu.c
index 463104f..a8269a9 100644 (file)
--- a/agedu.c
+++ b/agedu.c
@@ -1369,9 +1369,14 @@ int main(int argc, char **argv)
                 */
                int dirlen = outfile ? 2+strlen(outfile) : 3;
                char prefix[dirlen];
-               if (outfile)
+               if (outfile) {
+                   if (mkdir(outfile, 0777) < 0 && errno != EEXIST) {
+                       fprintf(stderr, "%s: %s: mkdir: %s\n", PNAME,
+                               outfile, strerror(errno));
+                       return 1;
+                   }
                    snprintf(prefix, dirlen, "%s/", outfile);
-               else
+               else
                    snprintf(prefix, dirlen, "./");
 
                unsigned long xi2;