From: simon Date: Mon, 22 Feb 2010 19:59:47 +0000 (+0000) Subject: I promised in the docs that the HTML output directory would be X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/agedu/commitdiff_plain/144550c6c335df2214a24d42aa49db89091e7e78 I promised in the docs that the HTML output directory would be 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 --- diff --git a/agedu.c b/agedu.c index 463104f..a8269a9 100644 --- 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;