- struct stat st;
- extern int errno;
- char *cp;
-
- if (stat (folder, &st) == -1) {
- if (errno != ENOENT)
- adios (folder, "error on folder");
- if (autocreate == 0) {
- /* ask before creating folder */
- cp = concat ("Create folder \"", folder, "\"? ", NULL);
- if (!getanswer (cp))
- done_callback (1);
- free (cp);
- } else if (autocreate == -1) {
- /* do not create, so exit */
- done_callback (1);
- }
- if (!makedir (folder))
- adios (NULL, "unable to create folder %s", folder);
- }
+ struct stat st;
+ extern int errno;
+ char *cp;
+
+ if (stat(folder, &st) == -1) {
+ if (errno != ENOENT) {
+ adios(EX_IOERR, folder, "error on folder");
+ }
+ if (autocreate == 0) {
+ /* ask before creating folder */
+ cp = concat("Create folder \"", folder, "\"? ", NULL);
+ if (!getanswer(cp)) {
+ done_callback(EX_CANTCREAT);
+ }
+ free(cp);
+ } else if (autocreate == -1) {
+ /* do not create, so exit */
+ done_callback(EX_CANTCREAT);
+ }
+ if (!makedir(folder)) {
+ adios(EX_CANTCREAT, NULL, "unable to create folder %s", folder);
+ }
+ }