diff options
| author | Joseph Hunkeler <jhunkeler@gmail.com> | 2026-05-11 15:24:53 -0400 |
|---|---|---|
| committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2026-05-11 15:34:45 -0400 |
| commit | b7a60c5bed989a52a53b8b697203f55367f55a89 (patch) | |
| tree | 993173328bdf96eb469c2412241f202cdbc5cf53 /src/cli/stasis_indexer | |
| parent | 58d3ca17dcd3f8b3aeb50b8e4f24afc76d33ff26 (diff) | |
| download | stasis-use-sys-macros.tar.gz | |
Replace msg, perror, and fprintf with SYS message macrosuse-sys-macros
Diffstat (limited to 'src/cli/stasis_indexer')
| -rw-r--r-- | src/cli/stasis_indexer/helpers.c | 8 | ||||
| -rw-r--r-- | src/cli/stasis_indexer/junitxml_report.c | 6 | ||||
| -rw-r--r-- | src/cli/stasis_indexer/readmes.c | 2 | ||||
| -rw-r--r-- | src/cli/stasis_indexer/stasis_indexer_main.c | 20 | ||||
| -rw-r--r-- | src/cli/stasis_indexer/website.c | 6 |
5 files changed, 21 insertions, 21 deletions
diff --git a/src/cli/stasis_indexer/helpers.c b/src/cli/stasis_indexer/helpers.c index 1bb5862..097b0ca 100644 --- a/src/cli/stasis_indexer/helpers.c +++ b/src/cli/stasis_indexer/helpers.c @@ -89,7 +89,7 @@ int get_pandoc_version(size_t *result) { int pandoc_exec(const char *in_file, const char *out_file, const char *css_file, const char *title) { if (!find_program("pandoc")) { - fprintf(stderr, "pandoc is not installed: unable to generate HTML indexes\n"); + SYSWARN("pandoc is not installed: unable to generate HTML indexes"); return 0; } @@ -227,7 +227,7 @@ struct Delivery **get_latest_deliveries(struct Delivery **ctx, size_t nelem, siz struct Delivery **result = calloc(nelem + 1, sizeof(*result)); if (!result) { - fprintf(stderr, "Unable to allocate %zu bytes for result delivery array: %s\n", nelem * sizeof(*result), strerror(errno)); + SYSERROR("Unable to allocate %zu bytes for result delivery array: %s", nelem * sizeof(*result), strerror(errno)); return NULL; } @@ -287,7 +287,7 @@ int get_files(struct StrList **out, const char *path, const char *pattern, ...) } } if (no_match >= strlist_count(list)) { - fprintf(stderr, "no files matching the pattern: %s\n", userpattern); + SYSERROR("no files matching the pattern: %s", userpattern); guard_strlist_free(&list); return -1; } @@ -392,7 +392,7 @@ int write_manifest(const char *path, char **exclude_path, FILE *fp) { struct dirent *rec = NULL; DIR *dp = opendir(path); if (!dp) { - perror(path); + SYSERROR("unable to open directory: %s, %s", path ? path : "NULL", strerror(errno)); return -1; } while ((rec = readdir(dp)) != NULL) { diff --git a/src/cli/stasis_indexer/junitxml_report.c b/src/cli/stasis_indexer/junitxml_report.c index b767179..073bb61 100644 --- a/src/cli/stasis_indexer/junitxml_report.c +++ b/src/cli/stasis_indexer/junitxml_report.c @@ -98,7 +98,7 @@ static int write_report_output(struct Delivery *ctx, FILE *destfp, const char *x junitxml_testsuite_free(&testsuite); fclose(resultfp); } else { - fprintf(stderr, "bad test suite: %s: %s\n", strerror(errno), xmlfilename); + SYSWARN("bad test suite: %s: %s", strerror(errno), xmlfilename); } return 0; } @@ -116,7 +116,7 @@ int indexer_junitxml_report(struct Delivery **ctx, const size_t nelem) { if (!pushd((*ctx)->storage.results_dir)) { FILE *indexfp = fopen(indexfile, "w+"); if (!indexfp) { - fprintf(stderr, "Unable to open %s for writing\n", indexfile); + SYSERROR("Unable to open %s for writing", indexfile); return -1; } printf("Index %s opened for writing\n", indexfile); @@ -157,7 +157,7 @@ int indexer_junitxml_report(struct Delivery **ctx, const size_t nelem) { fclose(indexfp); popd(); } else { - fprintf(stderr, "Unable to enter delivery directory: %s\n", (*ctx)->storage.delivery_dir); + SYSERROR("Unable to enter delivery directory: %s", (*ctx)->storage.delivery_dir); guard_strlist_free(&file_listing); return -1; } diff --git a/src/cli/stasis_indexer/readmes.c b/src/cli/stasis_indexer/readmes.c index d740367..de9e2f2 100644 --- a/src/cli/stasis_indexer/readmes.c +++ b/src/cli/stasis_indexer/readmes.c @@ -16,7 +16,7 @@ int indexer_readmes(struct Delivery **ctx, const size_t nelem) { FILE *indexfp = fopen(indexfile, "w+"); if (!indexfp) { - fprintf(stderr, "Unable to open %s for writing\n", indexfile); + SYSERROR("Unable to open %s for writing", indexfile); return -1; } struct StrList *archs = get_architectures(latest_deliveries, nelem_real); diff --git a/src/cli/stasis_indexer/stasis_indexer_main.c b/src/cli/stasis_indexer/stasis_indexer_main.c index 56be257..2bf72fd 100644 --- a/src/cli/stasis_indexer/stasis_indexer_main.c +++ b/src/cli/stasis_indexer/stasis_indexer_main.c @@ -41,7 +41,7 @@ int indexer_combine_rootdirs(const char *dest, char **rootdirs, const size_t roo srcdir_with_output[sizeof(srcdir_with_output) - 1] = '\0'; if (access(srcdir_bare, F_OK)) { - fprintf(stderr, "%s does not exist\n", srcdir_bare); + SYSWARN("%s does not exist", srcdir_bare); continue; } @@ -98,12 +98,12 @@ int indexer_symlinks(struct Delivery **ctx, const size_t nelem) { if (!access(link_name_spec, F_OK)) { if (unlink(link_name_spec)) { - fprintf(stderr, "Unable to remove spec link: %s\n", link_name_spec); + SYSWARN("Unable to remove spec link: %s", link_name_spec); } } if (!access(link_name_readme, F_OK)) { if (unlink(link_name_readme)) { - fprintf(stderr, "Unable to remove readme link: %s\n", link_name_readme); + SYSWARN("Unable to remove readme link: %s", link_name_readme); } } @@ -111,19 +111,19 @@ int indexer_symlinks(struct Delivery **ctx, const size_t nelem) { printf("%s -> %s\n", file_name_spec, link_name_spec); } if (symlink(file_name_spec, link_name_spec)) { - fprintf(stderr, "Unable to link %s as %s\n", file_name_spec, link_name_spec); + SYSWARN("Unable to link %s as %s", file_name_spec, link_name_spec); } if (globals.verbose) { printf("%s -> %s\n", file_name_readme, link_name_readme); } if (symlink(file_name_readme, link_name_readme)) { - fprintf(stderr, "Unable to link %s as %s\n", file_name_readme, link_name_readme); + SYSWARN("Unable to link %s as %s", file_name_readme, link_name_readme); } } popd(); } else { - fprintf(stderr, "Unable to enter delivery directory: %s\n", (*ctx)->storage.delivery_dir); + SYSERROR("Unable to enter delivery directory: %s", (*ctx)->storage.delivery_dir); guard_free(data); return -1; } @@ -137,7 +137,7 @@ void indexer_init_dirs(struct Delivery *ctx, const char *workdir) { path_store(&ctx->storage.root, PATH_MAX, workdir, ""); path_store(&ctx->storage.tmpdir, PATH_MAX, ctx->storage.root, "tmp"); if (delivery_init_tmpdir(ctx)) { - fprintf(stderr, "Failed to configure temporary storage directory\n"); + SYSERROR("Failed to configure temporary storage directory"); exit(1); } @@ -222,7 +222,7 @@ int main(const int argc, char *argv[]) { while (optind < argc) { if (argv[optind]) { if (access(argv[optind], F_OK) < 0) { - fprintf(stderr, "%s: %s\n", argv[optind], strerror(errno)); + SYSERROR("%s: %s", argv[optind], strerror(errno)); exit(1); } } @@ -248,7 +248,7 @@ int main(const int argc, char *argv[]) { } if (!rootdirs || !rootdirs_total) { - fprintf(stderr, "You must specify at least one STASIS root directory to index\n"); + SYSERROR("You must specify at least one STASIS root directory to index"); exit(1); } @@ -274,7 +274,7 @@ int main(const int argc, char *argv[]) { globals.sysconfdir = realpath(stasis_sysconfdir_tmp, NULL); if (!globals.sysconfdir) { - msg(STASIS_MSG_ERROR | STASIS_MSG_L1, "Unable to resolve path to configuration directory: %s\n", stasis_sysconfdir_tmp); + SYSERROR("Unable to resolve path to configuration directory: %s", stasis_sysconfdir_tmp); exit(1); } diff --git a/src/cli/stasis_indexer/website.c b/src/cli/stasis_indexer/website.c index aa6e2a5..07ad6ad 100644 --- a/src/cli/stasis_indexer/website.c +++ b/src/cli/stasis_indexer/website.c @@ -42,12 +42,12 @@ int indexer_make_website(struct Delivery **ctx) { // Convert markdown to html if (pandoc_exec(fullpath_src, fullpath_dest, have_css ? css_filename : NULL, "STASIS")) { - msg(STASIS_MSG_L2 | STASIS_MSG_WARN, "Unable to convert %s\n", fullpath_src); + SYSWARN("Unable to convert %s", fullpath_src); } if (file_replace_text(fullpath_dest, ".md", ".html", 0)) { // inform-only - SYSERROR("%s: failed to rewrite *.md urls with *.html extension", fullpath_dest); + SYSWARN("%s: failed to rewrite *.md urls with *.html extension", fullpath_dest); } // Link the nearest README.html to index.html @@ -58,7 +58,7 @@ int indexer_make_website(struct Delivery **ctx) { link_dest[sizeof(link_dest) - 1] = '\0'; snprintf(link_dest, sizeof(link_dest), "%s/%s", root, "index.html"); if (symlink(link_from, link_dest)) { - SYSERROR("Warning: symlink(%s, %s) failed: %s", link_from, link_dest, strerror(errno)); + SYSWARN("symlink(%s, %s) failed: %s", link_from, link_dest, strerror(errno)); } } } |
