commit 99a61bb4edf95437e24b04b9ec0868e674dd0deb
parent ac07495ae1dcc464e2be94b9667aa4a72378bb13
Author: Paco Esteban <paco@e1e0.net>
Date: Thu, 18 Jun 2020 21:31:47 +0200
generic error messages more explicit
Diffstat:
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/helpers.c b/helpers.c
@@ -81,7 +81,7 @@ copy_file(const char *source_file, const char *dest_file, int force)
}
} while ((rcnt > 0) && (rcnt == wcnt));
if (wcnt)
- return ssnail_error_msg(2, "cp");
+ return ssnail_error_msg(2, "Err: cp");
fclose(src);
fclose(dst);
diff --git a/ssnail.c b/ssnail.c
@@ -194,24 +194,24 @@ generate_index(struct listhead *h, char *head_tpl,
strftime(mytime, sizeof(mytime), "%Y-%m-%d", timeInfo);
if (load_from_file(&header, head_tpl) == 0) {
- error = ssnail_error_msg(2, "load head_tpl");
+ error = ssnail_error_msg(2, "Err: load head_tpl");
goto out;
}
header = str_rep(header, "$title$", "index");
header = str_rep(header, "$author$", getlogin());
header = str_rep(header, "$date$", mytime);
if (load_from_file(&footer, foot_tpl) == 0) {
- error = ssnail_error_msg(2, "load foot_tpl");
+ error = ssnail_error_msg(2, "Err: load foot_tpl");
goto out;
}
footer = str_rep(footer, "$title$", "index");
if ((index_path = build_full_path(dst_dir, "index.html")) == NULL) {
- error = ssnail_error_msg(2, "build_path dst_dir");
+ error = ssnail_error_msg(2, "Err: build_path dst_dir");
goto out;
}
if ((fout = fopen(index_path, "w")) == NULL) {
- error = ssnail_error_msg(2, "fopen index");
+ error = ssnail_error_from_errno("fopen index");
goto out;
}
fwrite(header, 1, strlen(header), fout);
@@ -334,19 +334,19 @@ write_html(struct article *ap, char *head_tpl, char *foot_tpl)
if (strlen(ap->title) == 0
|| strlen(ap->author) == 0
|| strlen(ap->date) == 0) {
- error = ssnail_error_msg(2, "metadata");
+ error = ssnail_error_msg(2, "Err: metadata");
goto out;
}
if (load_from_file(&header, head_tpl) == 0) {
- error = ssnail_error_msg(2, "load header");
+ error = ssnail_error_msg(2, "Err: load header");
goto out;
}
header = str_rep(header, "$title$", ap->title);
header = str_rep(header, "$author$", ap->author);
header = str_rep(header, "$date$", ap->date);
if (load_from_file(&footer, foot_tpl) == 0) {
- error = ssnail_error_msg(2, "load footer");
+ error = ssnail_error_msg(2, "Err: load footer");
goto out;
}
footer = str_rep(footer, "$title$", ap->title);
@@ -395,7 +395,7 @@ populate_article_entry(struct article *ap)
}
if (gen_html(ap) != 0)
- error = ssnail_error_msg(2, "gen_html");
+ error = ssnail_error_msg(2, "Err: gen_html");
out:
return error;
}
@@ -426,11 +426,11 @@ process_dir(char *src, char *dst, int force)
continue;
if ((src_path = build_full_path(src, dp->d_name)) == NULL) {
- error = ssnail_error_msg(2, "buildpath src");
+ error = ssnail_error_msg(2, "Err: buildpath src");
goto out;
}
if ((dst_path = build_full_path(dst, dp->d_name)) == NULL) {
- error = ssnail_error_msg(2, "buildpath src");
+ error = ssnail_error_msg(2, "Err: buildpath src");
goto out;
}