diff --git a/lib/eventlog/regress/logwrap/check_wrap.c b/lib/eventlog/regress/logwrap/check_wrap.c index c5066bef2..bcd520e3c 100644 --- a/lib/eventlog/regress/logwrap/check_wrap.c +++ b/lib/eventlog/regress/logwrap/check_wrap.c @@ -109,7 +109,7 @@ main(int argc, char *argv[]) } while (len <= maxlen) { if (len == 0) - printf("# word wrap disabled\n"); + puts("# word wrap disabled"); else printf("# word wrap at %zu characters\n", len); eventlog_writeln(stdout, lines[0], strlen(lines[0]), len); diff --git a/lib/util/glob.c b/lib/util/glob.c index 5ed419a46..d546837b6 100644 --- a/lib/util/glob.c +++ b/lib/util/glob.c @@ -940,14 +940,14 @@ qprintf(const char *str, Char *s) (void)printf("%s:\n", str); for (p = s; *p; p++) - (void)printf("%c", CHAR(*p)); - (void)printf("\n"); + (void)fputc(CHAR(*p), stdout); + (void)fputc('\n', stdout); for (p = s; *p; p++) - (void)printf("%c", *p & M_PROTECT ? '"' : ' '); - (void)printf("\n"); + (void)fputc(*p & M_PROTECT ? '"' : ' ', stdout); + (void)fputc('\n', stdout); for (p = s; *p; p++) - (void)printf("%c", ismeta(*p) ? '_' : ' '); - (void)printf("\n"); + (void)fputc(ismeta(*p) ? '_' : ' ', stdout); + (void)fputc('\n', stdout); } #endif /* DEBUG */ #endif /* HAVE_GLOB */ diff --git a/lib/util/mksiglist.c b/lib/util/mksiglist.c index bcdfa1da4..813bdef45 100644 --- a/lib/util/mksiglist.c +++ b/lib/util/mksiglist.c @@ -38,7 +38,7 @@ main(int argc, char *argv[]) #include "mksiglist.h" - printf("const char *const sudo_sys_siglist[] = {\n"); + puts("const char *const sudo_sys_siglist[] = {"); for (i = 0; i < nitems(sudo_sys_siglist); i++) { if (sudo_sys_siglist[i] != NULL) { printf(" \"%s\",\n", sudo_sys_siglist[i]); @@ -46,7 +46,7 @@ main(int argc, char *argv[]) printf(" \"Signal %zu\",\n", i); } } - printf("};\n"); + puts("};"); return EXIT_SUCCESS; } diff --git a/lib/util/mksigname.c b/lib/util/mksigname.c index a4ca3dbdf..2e8398115 100644 --- a/lib/util/mksigname.c +++ b/lib/util/mksigname.c @@ -38,7 +38,7 @@ main(int argc, char *argv[]) #include "mksigname.h" - printf("const char *const sudo_sys_signame[] = {\n"); + puts("const char *const sudo_sys_signame[] = {"); for (i = 0; i < nitems(sudo_sys_signame); i++) { if (sudo_sys_signame[i] != NULL) { printf(" \"%s\",\n", sudo_sys_signame[i]); @@ -46,7 +46,7 @@ main(int argc, char *argv[]) printf(" \"Signal %zu\",\n", i); } } - printf("};\n"); + puts("};"); return EXIT_SUCCESS; } diff --git a/lib/util/regress/glob/globtest.c b/lib/util/regress/glob/globtest.c index 7ace43896..f3623a772 100644 --- a/lib/util/regress/glob/globtest.c +++ b/lib/util/regress/glob/globtest.c @@ -80,8 +80,7 @@ main(int argc, char **argv) len = strlen(buf); if (len > 0) { if (buf[len - 1] != '\n') { - fprintf(stderr, - "globtest: missing newline at EOF\n"); + fputs("globtest: missing newline at EOF\n", stderr); return EXIT_FAILURE; } buf[--len] = '\0'; diff --git a/logsrvd/sendlog.c b/logsrvd/sendlog.c index 888f46d21..5e33b301c 100644 --- a/logsrvd/sendlog.c +++ b/logsrvd/sendlog.c @@ -1861,7 +1861,7 @@ main(int argc, char *argv[]) } if (testrun) - printf("sending logs...\n"); + puts("sending logs..."); struct timespec t_start, t_end, t_result; sudo_gettime_real(&t_start); diff --git a/plugins/group_file/plugin_test.c b/plugins/group_file/plugin_test.c index cb1ef636e..ec47f732a 100644 --- a/plugins/group_file/plugin_test.c +++ b/plugins/group_file/plugin_test.c @@ -109,7 +109,7 @@ group_plugin_load(char *plugin_info) if (SUDO_API_VERSION_GET_MAJOR(group_plugin->version) != GROUP_API_VERSION_MAJOR) { fprintf(stderr, - "%s: incompatible group plugin major version %u, expected %d\n", + "%s: incompatible group plugin major version %u, expected %u\n", path, SUDO_API_VERSION_GET_MAJOR(group_plugin->version), GROUP_API_VERSION_MAJOR); return -1; @@ -171,15 +171,16 @@ group_plugin_query(const char *user, const char *group, static void usage(void) { - fprintf(stderr, - "usage: plugin_test [-p \"plugin.so plugin_args ...\"] user:group ...\n"); + fputs("usage: plugin_test [-p \"plugin.so plugin_args ...\"] user:group ...\n", + stderr); exit(EXIT_FAILURE); } int main(int argc, char *argv[]) { - int ch, i, found; + int ch, found; + size_t i; char *plugin = "group_file.so"; char *user, *group; struct passwd *pwd; diff --git a/plugins/python/regress/check_python_examples.c b/plugins/python/regress/check_python_examples.c index 3143d82ce..108d85d8a 100644 --- a/plugins/python/regress/check_python_examples.c +++ b/plugins/python/regress/check_python_examples.c @@ -474,7 +474,7 @@ create_debug_config(const char *debug_spec) if (asprintf(&content, "Debug %s %s/debug.log %s\n", "python_plugin.so", data.tmp_dir, debug_spec) < 0) { - printf("Failed to allocate string\n"); + puts("Failed to allocate string"); goto cleanup; } diff --git a/plugins/sudoers/getdate.c b/plugins/sudoers/getdate.c index 8c86148de..23a424b5c 100644 --- a/plugins/sudoers/getdate.c +++ b/plugins/sudoers/getdate.c @@ -2440,15 +2440,14 @@ main(int argc, char *argv[]) char buff[128]; time_t d; - (void)printf("Enter date, or blank line to exit.\n\t> "); + (void)fputs("Enter date, or blank line to exit.\n\t> ", stdout); (void)fflush(stdout); while (fgets(buff, sizeof(buff), stdin) && buff[0]) { d = get_date(buff); if (d == -1) - (void)printf("Bad format - couldn't convert.\n"); + (void)fputs("Bad format - couldn't convert.\n\t> ", stdout); else - (void)printf("%s", ctime(&d)); - (void)printf("\t> "); + (void)printf("%s\t> ", ctime(&d)); (void)fflush(stdout); } return 0; diff --git a/plugins/sudoers/getdate.y b/plugins/sudoers/getdate.y index 6b17eae1f..b7737636c 100644 --- a/plugins/sudoers/getdate.y +++ b/plugins/sudoers/getdate.y @@ -906,15 +906,14 @@ main(int argc, char *argv[]) char buff[128]; time_t d; - (void)printf("Enter date, or blank line to exit.\n\t> "); + (void)fputs("Enter date, or blank line to exit.\n\t> ", stdout); (void)fflush(stdout); while (fgets(buff, sizeof(buff), stdin) && buff[0]) { d = get_date(buff); if (d == -1) - (void)printf("Bad format - couldn't convert.\n"); + (void)fputs("Bad format - couldn't convert.\n\t> ", stdout); else - (void)printf("%s", ctime(&d)); - (void)printf("\t> "); + (void)printf("%s\t> ", ctime(&d)); (void)fflush(stdout); } return 0; diff --git a/plugins/sudoers/sudoreplay.c b/plugins/sudoers/sudoreplay.c index f6e8cbc22..874901656 100644 --- a/plugins/sudoers/sudoreplay.c +++ b/plugins/sudoers/sudoreplay.c @@ -682,7 +682,7 @@ setup_terminal(struct eventlog *evlog, bool interactive, bool resize) } if (evlog->lines > terminal_lines || evlog->columns > terminal_cols) { - fputs(_("Warning: your terminal is too small to properly replay the log.\n"), stdout); + puts(_("Warning: your terminal is too small to properly replay the log.")); printf(_("Log geometry is %d x %d, your terminal's geometry is %d x %d."), evlog->lines, evlog->columns, terminal_lines, terminal_cols); } debug_return; diff --git a/plugins/sudoers/tsdump.c b/plugins/sudoers/tsdump.c index d38ffc4f3..d41dd9626 100644 --- a/plugins/sudoers/tsdump.c +++ b/plugins/sudoers/tsdump.c @@ -297,7 +297,7 @@ dump_entry(struct timestamp_entry *entry, off_t pos) } else if (entry->type == TS_PPID) { printf("parent pid: %d\n", (int)entry->u.ppid); } - printf("\n"); + fputc('\n', stdout); debug_return; }