logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git/
commit: bf6d020575b1d951a9d6d01104f1ec5ab9221af6
parent bf470569bee7ba1c15a604e143cb76286c8d13af
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sun, 20 Jul 2025 04:05:02 +0200

Use NULL instead of 0 for struct option `flag` field

Diffstat:

Mcmd/chmod.c8++++----
Mcmd/chown.c8++++----
Mcmd/date.c10+++++-----
Mcmd/env.c6+++---
Mcmd/install.c18+++++++++---------
Mcmd/mktemp.c8++++----
Mcmd/rmdir.c6+++---
Mcmd/wc.c8++++----
Mconfigure.d/getopt_long.c4++--
9 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/cmd/chmod.c b/cmd/chmod.c @@ -331,10 +331,10 @@ main(int argc, char *argv[]) OPT_REFERENCE = 1, }; static struct option opts[] = { - {"changes", no_argument, 0, 'c'}, - {"recursive", no_argument, 0, 'R'}, - {"reference", required_argument, 0, OPT_REFERENCE}, - {"verbose", no_argument, 0, 'v'}, + {"changes", no_argument, NULL, 'c'}, + {"recursive", no_argument, NULL, 'R'}, + {"reference", required_argument, NULL, OPT_REFERENCE}, + {"verbose", no_argument, NULL, 'v'}, {0, 0, 0, 0}, }; // clang-format on diff --git a/cmd/chown.c b/cmd/chown.c @@ -214,10 +214,10 @@ main(int argc, char *argv[]) OPT_REFERENCE = 1, }; static struct option opts[] = { - {"no-dereference", no_argument, 0, 'h'}, - {"recursive", no_argument, 0, 'R'}, - {"reference", required_argument, 0, OPT_REFERENCE}, - {"verbose", no_argument, 0, 'v'}, + {"no-dereference", no_argument, NULL, 'h'}, + {"recursive", no_argument, NULL, 'R'}, + {"reference", required_argument, NULL, OPT_REFERENCE}, + {"verbose", no_argument, NULL, 'v'}, {0, 0, 0, 0}, }; // clang-format on diff --git a/cmd/date.c b/cmd/date.c @@ -160,11 +160,11 @@ main(int argc, char *argv[]) // Strictly for GNUisms compatibility so no long-only options // clang-format off static struct option opts[] = { - {"date", required_argument, 0, 'd'}, - {"iso-8601", optional_argument, 0, 'I'}, - {"rfc-email", no_argument, 0, 'R'}, - {"universal", no_argument, 0, 'u'}, - {"utc", no_argument, 0, 'u'}, + {"date", required_argument, NULL, 'd'}, + {"iso-8601", optional_argument, NULL, 'I'}, + {"rfc-email", no_argument, NULL, 'R'}, + {"universal", no_argument, NULL, 'u'}, + {"utc", no_argument, NULL, 'u'}, {0, 0, 0, 0}, }; // clang-format on diff --git a/cmd/env.c b/cmd/env.c @@ -66,10 +66,10 @@ main(int argc, char *argv[]) // Strictly for GNUisms compatibility so no long-only options // clang-format off static struct option opts[] = { - {"ignore-environment", no_argument, 0, 'i'}, - {"unset", required_argument, 0, 'u'}, + {"ignore-environment", no_argument, NULL, 'i'}, + {"unset", required_argument, NULL, 'u'}, #ifdef HAS_WORDEXP - {"split-string", required_argument, 0, 'S'}, + {"split-string", required_argument, NULL, 'S'}, #endif {0, 0, 0, 0}, }; diff --git a/cmd/install.c b/cmd/install.c @@ -216,15 +216,15 @@ main(int argc, char *argv[]) // Strictly for GNUisms compatibility so no long-only options // clang-format off static struct option opts[] = { - {"compare", no_argument, 0, 'c'}, - {"directory", no_argument, 0, 'd'}, - {"group", required_argument, 0, 'g'}, - {"mode", required_argument, 0, 'm'}, - {"owner", required_argument, 0, 'o'}, - {"preserve-timestamps", no_argument, 0, 'p'}, - {"target-directory", required_argument, 0, 't'}, - {"no-target-directory", no_argument, 0, 'T'}, - {"verbose", no_argument, 0, 'v'}, + {"compare", no_argument, NULL, 'c'}, + {"directory", no_argument, NULL, 'd'}, + {"group", required_argument, NULL, 'g'}, + {"mode", required_argument, NULL, 'm'}, + {"owner", required_argument, NULL, 'o'}, + {"preserve-timestamps", no_argument, NULL, 'p'}, + {"target-directory", required_argument, NULL, 't'}, + {"no-target-directory", no_argument, NULL, 'T'}, + {"verbose", no_argument, NULL, 'v'}, {0, 0, 0, 0}, }; // clang-format on diff --git a/cmd/mktemp.c b/cmd/mktemp.c @@ -86,10 +86,10 @@ main(int argc, char *argv[]) // Strictly for GNUisms compatibility so no long-only options // clang-format off static struct option opts[] = { - {"directory", no_argument, 0, 'd'}, - {"dry-run", required_argument, 0, 'u'}, - {"quiet", no_argument, 0, 'q'}, - {"tmpdir", required_argument, 0, 'p'}, + {"directory", no_argument, NULL, 'd'}, + {"dry-run", required_argument, NULL, 'u'}, + {"quiet", no_argument, NULL, 'q'}, + {"tmpdir", required_argument, NULL, 'p'}, {0, 0, 0, 0}, }; // clang-format on diff --git a/cmd/rmdir.c b/cmd/rmdir.c @@ -39,9 +39,9 @@ main(int argc, char *argv[]) IGN_ENOTEMPTY = 1 }; static struct option opts[] = { - {"ignore-fail-on-non-empty", no_argument, 0, IGN_ENOTEMPTY}, - {"parents", no_argument, 0, 'p'}, - {"verbose", no_argument, 0, 'v'}, + {"ignore-fail-on-non-empty", no_argument, NULL, IGN_ENOTEMPTY}, + {"parents", no_argument, NULL, 'p'}, + {"verbose", no_argument, NULL, 'v'}, {0, 0, 0, 0}, }; // clang-format on diff --git a/cmd/wc.c b/cmd/wc.c @@ -237,10 +237,10 @@ main(int argc, char *argv[]) // Strictly for GNUisms compatibility so no long-only options // clang-format off static struct option opts[] = { - {"bytes", no_argument, 0, 'c'}, - {"lines", no_argument, 0, 'l'}, - {"chars", no_argument, 0, 'm'}, - {"words", no_argument, 0, 'w'}, + {"bytes", no_argument, NULL, 'c'}, + {"lines", no_argument, NULL, 'l'}, + {"chars", no_argument, NULL, 'm'}, + {"words", no_argument, NULL, 'w'}, {0, 0, 0, 0}, }; // clang-format on diff --git a/configure.d/getopt_long.c b/configure.d/getopt_long.c @@ -16,8 +16,8 @@ main(int argc, char *argv[]) // clang-format off static struct option opts[] = { - {"help", no_argument, 0, 'h'}, - {"file", required_argument, 0, 'f'}, + {"help", no_argument, NULL, 'h'}, + {"file", required_argument, NULL, 'f'}, {0, 0, 0, 0} }; // clang-format on