summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Jones <admin@danieljon.es>2020-01-17 23:59:27 +1030
committerDaniel Jones <admin@danieljon.es>2020-01-17 23:59:27 +1030
commit73954921146ba51f4a3f7be96261c684ebe89c0e (patch)
tree2792d1a7a300322268d5ce50308ad3ef2a0416a1
parent37e24dd65d800a1e82b53a0e4588630cb6657584 (diff)
downloadwebsitegenerator-73954921146ba51f4a3f7be96261c684ebe89c0e.tar.gz
websitegenerator-73954921146ba51f4a3f7be96261c684ebe89c0e.zip
small clean of unneeded code and some logic
-rw-r--r--pages.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/pages.c b/pages.c
index 0f2e7f6..878c4c8 100644
--- a/pages.c
+++ b/pages.c
@@ -27,7 +27,7 @@ makedirectories(const char *basedir, const char *file)
char buffer[512];
struct stat sb = {0};
- if(!stat(output_dir, &sb) == 0 && !S_ISDIR(sb.st_mode))
+ if(!(stat(output_dir, &sb) == 0) && !S_ISDIR(sb.st_mode))
{
fprintf(stderr, "directory '%s' does not exist, trying to make directory..\n", output_dir);
if (mkdir(output_dir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0)
@@ -60,18 +60,6 @@ createfile(const char *file, const char *template)
fprintf(stderr, "unable to create directories for '%s/%s', unrecoverable failure\n", output_dir, file);
return 0;
}
- struct stat sb = {0};
-
- if(!stat(output_dir, &sb) == 0 && !S_ISDIR(sb.st_mode))
- {
- fprintf(stderr, "directory '%s' does not exist, trying to make directory..\n", output_dir);
- if (mkdir(output_dir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0)
- {
- fprintf(stderr, "unable to mkdir '%s', unrecoverable failure\n", output_dir);
- return 0;
- }
- fprintf(stderr, "OK\n");
- }
char filename[512] = {0};
snprintf(filename, 512, "%s%s", output_dir, file);
@@ -812,7 +800,7 @@ writerss(FILE *out, int post)
strncpy(date, line, 512);
}
- if (pos >= 2 && (title == NULL || date == NULL))
+ if (pos >= 2 && (title[0] == 0 || date[0] == 0))
{
fprintf(stderr, "post %s has a broken format, please fix it\n", buff);
fclose(in);