logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git
commit: be352dc128667288947beda05adbe20f7d847cbe
parent 8c671ed80f4a0c320670962c1fa5efe423996f03
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sun,  8 Sep 2024 09:40:31 +0200

Put (void) on argument-less functions

Diffstat:

Mcmd/arch.c2+-
Mcmd/cat.c2+-
Mcmd/chmod.c2+-
Mcmd/chown.c2+-
Mcmd/cmp.c2+-
Mcmd/date.c2+-
Mcmd/env.c4++--
Mcmd/head.c2+-
Mcmd/id.c2+-
Mcmd/install.c2+-
Mcmd/ln.c2+-
Mcmd/mkdir.c2+-
Mcmd/mkfifo.c2+-
Mcmd/mknod.c2+-
Mcmd/mv.c2+-
Mcmd/nice.c2+-
Mcmd/nohup.c2+-
Mcmd/nproc.c2+-
Mcmd/pathchk.c2+-
Mcmd/realpath.c4++--
Mcmd/rm.c2+-
Mcmd/rmdir.c2+-
Mcmd/split.c4++--
Mcmd/strings.c2+-
Mcmd/time.c2+-
Mcmd/timeout.c2+-
Mcmd/truncate.c2+-
Mcmd/uname.c2+-
Mcmd/wc.c2+-
Mconfigure.d/reallocarray.c2+-
Mlib/consent.c4++--
Mlib/consent.h4++--
Mtest-lib/mode.c16++++++++--------
Mtest-lib/sha1.c2+-
Mtest-lib/strtodur.c2+-
Mtest-lib/symbolize_mode.c2+-
Mtest-lib/truncation.c8++++----
37 files changed, 52 insertions(+), 52 deletions(-)

diff --git a/cmd/arch.c b/cmd/arch.c @@ -10,7 +10,7 @@ #include <sys/utsname.h> // uname int -main() +main(void) { struct utsname name; if(uname(&name) < 0) diff --git a/cmd/cat.c b/cmd/cat.c @@ -78,7 +78,7 @@ fd_copy(int fd, const char *fdname) #endif // HAS_SPLICE static void -usage() +usage(void) { fprintf(stderr, "Usage: cat [-u] [files ...]\n"); } diff --git a/cmd/chmod.c b/cmd/chmod.c @@ -159,7 +159,7 @@ do_fchmodat(int fd, char *mode_arg, char *name, char *acc_path, bool recursive) } static void -usage() +usage(void) { fprintf(stderr, "Usage: chmod [-cRv] <mode> <file ...>\n"); } diff --git a/cmd/chown.c b/cmd/chown.c @@ -182,7 +182,7 @@ do_fchownat(int fd, char *name, char *acc_path, enum chown_follow_symlinks follo } static void -usage() +usage(void) { if(strcmp(argv0, "chown") == 0) fprintf(stderr, "Usage: %s [-h | -R [-H|-L|-P]] owner[:group] file...\n", argv0); diff --git a/cmd/cmp.c b/cmd/cmp.c @@ -78,7 +78,7 @@ do_cmp(FILE *file1, const char *name1, FILE *file2, const char *name2) } static void -usage() +usage(void) { fprintf(stderr, "Usage: cmp [-l|-s] [-n max_bytes] file1 file2\n"); } diff --git a/cmd/date.c b/cmd/date.c @@ -19,7 +19,7 @@ #include <unistd.h> /* getopt(), optarg, optind */ static void -usage() +usage(void) { fprintf(stderr, "\ Usage:\n\ diff --git a/cmd/env.c b/cmd/env.c @@ -21,7 +21,7 @@ extern char **environ; char *envclear[1]; static int -do_export() +do_export(void) { int i = 0; @@ -38,7 +38,7 @@ do_export() } static void -usage() +usage(void) { fprintf(stderr, "env [-i] [-u key] [key=value ...] [command [args]]\n"); } diff --git a/cmd/head.c b/cmd/head.c @@ -147,7 +147,7 @@ copy_lines(const char *filename) } static void -usage() +usage(void) { fprintf(stderr, "Usage: head [-qv] [-c size | -n num | -num] [file...]\n"); } diff --git a/cmd/id.c b/cmd/id.c @@ -151,7 +151,7 @@ enum id_modes }; static void -usage() +usage(void) { fprintf(stderr, "Usage: id [-Ggu] [-nr] [user]\n"); } diff --git a/cmd/install.c b/cmd/install.c @@ -187,7 +187,7 @@ do_install(char *src, char *dest, bool is_dir) } static void -usage() +usage(void) { fprintf(stderr, "\ Usage: install [-CcDpT] [-g group] [-m mode] [-o owner] source... destination\n\ diff --git a/cmd/ln.c b/cmd/ln.c @@ -128,7 +128,7 @@ cleanup: } static void -usage() +usage(void) { fprintf(stderr, "\ Usage: ln [-f] [-L|-P] source... target\n\ diff --git a/cmd/mkdir.c b/cmd/mkdir.c @@ -39,7 +39,7 @@ mkdir_simple(char *path, mode_t mode) } static void -usage() +usage(void) { fprintf(stderr, "Usage: mkdir [-pv] [-m mode] path ...\n"); } diff --git a/cmd/mkfifo.c b/cmd/mkfifo.c @@ -17,7 +17,7 @@ mode_t filemask; static void -usage() +usage(void) { fprintf(stderr, "Usage: mkfifo [-m mode] file\n"); } diff --git a/cmd/mknod.c b/cmd/mknod.c @@ -19,7 +19,7 @@ mode_t filemask; static void -usage() +usage(void) { fprintf(stderr, "Usage: mknod [-m mode] file <b|c|u|p> [major minor]\n"); } diff --git a/cmd/mv.c b/cmd/mv.c @@ -338,7 +338,7 @@ do_renameat(struct named_fd srcdir, } static void -usage() +usage(void) { fprintf(stderr, "Usage: mv [-f|-i|-n] [-v] source dest\n"); fprintf(stderr, " mv [-f|-i|-n] [-v] source... destdir\n"); diff --git a/cmd/nice.c b/cmd/nice.c @@ -13,7 +13,7 @@ #include <unistd.h> // getopt, nice static void -usage() +usage(void) { fprintf(stderr, "Usage: nice [-n increment] command [argument ...]\n"); } diff --git a/cmd/nohup.c b/cmd/nohup.c @@ -17,7 +17,7 @@ #include <unistd.h> // isatty static void -usage() +usage(void) { fprintf(stderr, "Usage: nohup command [args ...]\n"); } diff --git a/cmd/nproc.c b/cmd/nproc.c @@ -9,7 +9,7 @@ #include <unistd.h> // sysconf, getopt, opt* static void -usage() +usage(void) { fprintf(stderr, "Usage: nproc [-a]\n"); } diff --git a/cmd/pathchk.c b/cmd/pathchk.c @@ -31,7 +31,7 @@ str_pcs(char *str) } static void -usage() +usage(void) { fprintf(stderr, "Usage: pathchk [-p] [-P] pathname...\n"); } diff --git a/cmd/realpath.c b/cmd/realpath.c @@ -79,7 +79,7 @@ print_realpath(char *path) } static void -usage_realpath() +usage_realpath(void) { fprintf(stderr, "Usage: realpath [-E|-e] [-n|-z] path...\n"); } @@ -139,7 +139,7 @@ main_realpath(int argc, char *argv[]) } static void -usage_readlink() +usage_readlink(void) { fprintf(stderr, "Usage: readlink [-f|-e] [-n|-z] file...\n"); } diff --git a/cmd/rm.c b/cmd/rm.c @@ -165,7 +165,7 @@ do_unlinkat(int fd, char *name, char *acc_path) } static void -usage() +usage(void) { fprintf(stderr, "Usage: rm [-firRv] [files ...]\n"); } diff --git a/cmd/rmdir.c b/cmd/rmdir.c @@ -14,7 +14,7 @@ #endif static void -usage() +usage(void) { #ifdef HAS_GETOPT_LONG fprintf(stderr, "Usage: rmdir [-pv] [--ignore-fail-on-non-empty] directory...\n"); diff --git a/cmd/split.c b/cmd/split.c @@ -47,7 +47,7 @@ base26(int id, char *str) } static int -split_bytes() +split_bytes(void) { int fd_in = STDIN_FILENO; if(name_in != NULL) @@ -113,7 +113,7 @@ split_bytes() } static int -split_lines() +split_lines(void) { FILE *in = stdin; if(name_in != NULL) diff --git a/cmd/strings.c b/cmd/strings.c @@ -97,7 +97,7 @@ concat(int fd, const char *fdname) } static void -usage() +usage(void) { fprintf(stderr, "strings: [-a] [-t format] [-n number] [file...]\n"); } diff --git a/cmd/time.c b/cmd/time.c @@ -11,7 +11,7 @@ #include <unistd.h> // sysconf, fork, execvp, getopt static void -usage() +usage(void) { fprintf(stderr, "Usage: time command [argument ...]\n"); } diff --git a/cmd/timeout.c b/cmd/timeout.c @@ -39,7 +39,7 @@ handle_sigchld(int sig) } static void -usage() +usage(void) { fprintf(stderr, "Usage: timeout [-fp] [-k duration] [-s SIGNAL] duration command [arguments...]\n"); diff --git a/cmd/truncate.c b/cmd/truncate.c @@ -20,7 +20,7 @@ const char *argv0 = "truncate"; static void -usage() +usage(void) { fprintf(stderr, "Usage: truncate [-co] [-r ref_file] [-s size] file...\n"); } diff --git a/cmd/uname.c b/cmd/uname.c @@ -41,7 +41,7 @@ maybe_print_name(enum uname_names key, char *value) } static void -usage() +usage(void) { fprintf(stderr, "Usage: uname [-amnrsv]\n"); } diff --git a/cmd/wc.c b/cmd/wc.c @@ -153,7 +153,7 @@ wc_file_chars(FILE *file, char *filename) } static void -usage() +usage(void) { fprintf(stderr, "Usage: wc [-c|-m] [-lw] [file...]\n"); } diff --git a/configure.d/reallocarray.c b/configure.d/reallocarray.c @@ -9,7 +9,7 @@ #include <stdlib.h> // reallocarray void -test() +test(void) { char *arr = NULL; (void)reallocarray(&arr, 69, sizeof(*arr)); diff --git a/lib/consent.c b/lib/consent.c @@ -20,7 +20,7 @@ regex_t consent_yesexpr_r; regex_t consent_noexpr_r; void -consent_init() +consent_init(void) { char *yesexpr = nl_langinfo(YESEXPR); int yesexpr_ret = regcomp(&consent_yesexpr_r, yesexpr, REG_EXTENDED | REG_NOSUB); @@ -56,7 +56,7 @@ consent_init() } void -consent_finish() +consent_finish(void) { regfree(&consent_yesexpr_r); regfree(&consent_noexpr_r); diff --git a/lib/consent.h b/lib/consent.h @@ -8,5 +8,5 @@ extern const char *argv0; // Consent therefore defaults to no, including in cases of error bool consentf(const char *restrict fmt, ...); -void consent_finish(); -void consent_init(); +void consent_finish(void); +void consent_init(void); diff --git a/test-lib/mode.c b/test-lib/mode.c @@ -53,7 +53,7 @@ t_mode_errstr(const char *str, mode_t old, const char *expect_errstr) } static void -add_read() +add_read(void) { printf("# => add_read\n"); umask(0044); @@ -84,7 +84,7 @@ add_read() } static void -set_read() +set_read(void) { printf("# => set_read\n"); umask(0044); @@ -118,7 +118,7 @@ set_read() } static void -del_read() +del_read(void) { printf("# => del_read\n"); umask(0044); @@ -149,7 +149,7 @@ del_read() } static void -search() +search(void) { printf("# => search\n"); t_mode("-X", 0, 0); @@ -209,7 +209,7 @@ search() } static void -syntax() +syntax(void) { printf("# => syntax\n"); @@ -232,7 +232,7 @@ syntax() } static void -posix_examples() +posix_examples(void) { // Examples as given by POSIX in chmod(1p) printf("# => posix_examples\n"); @@ -262,7 +262,7 @@ posix_examples() } static void -non_symbolic() +non_symbolic(void) { printf("# => non_symbolic\n"); @@ -286,7 +286,7 @@ non_symbolic() } int -main() +main(void) { int plan = 155; printf("1..%d\n", plan); diff --git a/test-lib/sha1.c b/test-lib/sha1.c @@ -52,7 +52,7 @@ t_sha1(const char *name, } int -main() +main(void) { int plan = 3; printf("1..%d\n", plan); diff --git a/test-lib/strtodur.c b/test-lib/strtodur.c @@ -41,7 +41,7 @@ t_strtodur(char *str, time_t ex_sec, long ex_nsec) } int -main() +main(void) { int plan = 8; printf("1..%d\n", plan); diff --git a/test-lib/symbolize_mode.c b/test-lib/symbolize_mode.c @@ -29,7 +29,7 @@ t_symbolize_mode(mode_t mode, const char *expected) } int -main() +main(void) { int plan = 3; printf("1..%d\n", plan); diff --git a/test-lib/truncation.c b/test-lib/truncation.c @@ -33,7 +33,7 @@ t_parse_size(const char *str, off_t size, enum operation_e op) } static void -set() +set(void) { t_parse_size("0", 0L, OP_SET); t_parse_size("666", 666L, OP_SET); @@ -43,7 +43,7 @@ set() } static void -inc() +inc(void) { t_parse_size("+0", 0L, OP_INC); t_parse_size("+666", 666L, OP_INC); @@ -53,7 +53,7 @@ inc() } static void -dec() +dec(void) { t_parse_size("-0", 0L, OP_DEC); t_parse_size("-666", 666L, OP_DEC); @@ -63,7 +63,7 @@ dec() } int -main() +main(void) { int plan = 15; printf("1..%d\n", plan);