summaryrefslogtreecommitdiffstats
path: root/sys-utils
diff options
context:
space:
mode:
authorSami Kerola2017-02-11 21:23:26 +0100
committerKarel Zak2017-02-20 12:58:49 +0100
commit87918040658f2fa9b1bf78f1f8f4f5c065a2e3a3 (patch)
tree513541cfa347d7fc66e50137603489cb195c86de /sys-utils
parentcfdisk: avoid use of VLA in combination with sizeof() [smatch scan] (diff)
downloadkernel-qcow2-util-linux-87918040658f2fa9b1bf78f1f8f4f5c065a2e3a3.tar.gz
kernel-qcow2-util-linux-87918040658f2fa9b1bf78f1f8f4f5c065a2e3a3.tar.xz
kernel-qcow2-util-linux-87918040658f2fa9b1bf78f1f8f4f5c065a2e3a3.zip
misc: do not use plain 0 as NULL [smatch scan]
text-utils/tailf.c:69:21: warning: Using plain integer as NULL pointer Since many 'struct option' has used zero as NULL make them more readable in same go by reindenting, and using named argument requirements. Reference: https://lwn.net/Articles/93577/ Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'sys-utils')
-rw-r--r--sys-utils/blkdiscard.c18
-rw-r--r--sys-utils/chcpu.c18
-rw-r--r--sys-utils/eject.c4
-rw-r--r--sys-utils/fallocate.c26
-rw-r--r--sys-utils/flock.c2
-rw-r--r--sys-utils/fsfreeze.c10
-rw-r--r--sys-utils/fstrim.c16
-rw-r--r--sys-utils/hwclock.c66
-rw-r--r--sys-utils/losetup.c44
-rw-r--r--sys-utils/lscpu.c24
-rw-r--r--sys-utils/lsipc.c42
-rw-r--r--sys-utils/mount.c68
-rw-r--r--sys-utils/mountpoint.c14
-rw-r--r--sys-utils/readprofile.c6
-rw-r--r--sys-utils/rtcwake.c32
-rw-r--r--sys-utils/setpriv.c44
-rw-r--r--sys-utils/swapoff.c10
-rw-r--r--sys-utils/swapon.c32
-rw-r--r--sys-utils/tunelp.c22
-rw-r--r--sys-utils/umount.c34
-rw-r--r--sys-utils/unshare.c34
21 files changed, 283 insertions, 283 deletions
diff --git a/sys-utils/blkdiscard.c b/sys-utils/blkdiscard.c
index 2bfa7f856..7f2db58b1 100644
--- a/sys-utils/blkdiscard.c
+++ b/sys-utils/blkdiscard.c
@@ -113,15 +113,15 @@ int main(int argc, char **argv)
int act = ACT_DISCARD;
static const struct option longopts[] = {
- { "help", 0, 0, 'h' },
- { "version", 0, 0, 'V' },
- { "offset", 1, 0, 'o' },
- { "length", 1, 0, 'l' },
- { "step", 1, 0, 'p' },
- { "secure", 0, 0, 's' },
- { "verbose", 0, 0, 'v' },
- { "zeroout", 0, 0, 'z' },
- { NULL, 0, 0, 0 }
+ { "help", no_argument, NULL, 'h' },
+ { "version", no_argument, NULL, 'V' },
+ { "offset", required_argument, NULL, 'o' },
+ { "length", required_argument, NULL, 'l' },
+ { "step", required_argument, NULL, 'p' },
+ { "secure", no_argument, NULL, 's' },
+ { "verbose", no_argument, NULL, 'v' },
+ { "zeroout", no_argument, NULL, 'z' },
+ { NULL, 0, NULL, 0 }
};
setlocale(LC_ALL, "");
diff --git a/sys-utils/chcpu.c b/sys-utils/chcpu.c
index 003cf59c9..30afa457c 100644
--- a/sys-utils/chcpu.c
+++ b/sys-utils/chcpu.c
@@ -262,15 +262,15 @@ int main(int argc, char *argv[])
int c, rc;
static const struct option longopts[] = {
- { "configure", required_argument, 0, 'c' },
- { "deconfigure",required_argument, 0, 'g' },
- { "disable", required_argument, 0, 'd' },
- { "dispatch", required_argument, 0, 'p' },
- { "enable", required_argument, 0, 'e' },
- { "help", no_argument, 0, 'h' },
- { "rescan", no_argument, 0, 'r' },
- { "version", no_argument, 0, 'V' },
- { NULL, 0, 0, 0 }
+ { "configure", required_argument, NULL, 'c' },
+ { "deconfigure",required_argument, NULL, 'g' },
+ { "disable", required_argument, NULL, 'd' },
+ { "dispatch", required_argument, NULL, 'p' },
+ { "enable", required_argument, NULL, 'e' },
+ { "help", no_argument, NULL, 'h' },
+ { "rescan", no_argument, NULL, 'r' },
+ { "version", no_argument, NULL, 'V' },
+ { NULL, 0, NULL, 0 }
};
static const ul_excl_t excl[] = { /* rows and cols in ASCII order */
diff --git a/sys-utils/eject.c b/sys-utils/eject.c
index 7bc68555a..7cdd2db6e 100644
--- a/sys-utils/eject.c
+++ b/sys-utils/eject.c
@@ -193,7 +193,7 @@ static void parse_args(struct eject_control *ctl, int argc, char **argv)
{"traytoggle", no_argument, NULL, 'T'},
{"verbose", no_argument, NULL, 'v'},
{"version", no_argument, NULL, 'V'},
- {0, 0, 0, 0}
+ {NULL, 0, NULL, 0}
};
int c;
@@ -845,7 +845,7 @@ int main(int argc, char **argv)
char *disk = NULL;
char *mountpoint = NULL;
int worked = 0; /* set to 1 when successfully ejected */
- struct eject_control ctl = { 0 };
+ struct eject_control ctl = { NULL };
setlocale(LC_ALL,"");
bindtextdomain(PACKAGE, LOCALEDIR);
diff --git a/sys-utils/fallocate.c b/sys-utils/fallocate.c
index c8068082f..7bbc36865 100644
--- a/sys-utils/fallocate.c
+++ b/sys-utils/fallocate.c
@@ -294,19 +294,19 @@ int main(int argc, char **argv)
loff_t offset = 0;
static const struct option longopts[] = {
- { "help", 0, 0, 'h' },
- { "version", 0, 0, 'V' },
- { "keep-size", 0, 0, 'n' },
- { "punch-hole", 0, 0, 'p' },
- { "collapse-range", 0, 0, 'c' },
- { "dig-holes", 0, 0, 'd' },
- { "insert-range", 0, 0, 'i' },
- { "zero-range", 0, 0, 'z' },
- { "offset", 1, 0, 'o' },
- { "length", 1, 0, 'l' },
- { "posix", 0, 0, 'x' },
- { "verbose", 0, 0, 'v' },
- { NULL, 0, 0, 0 }
+ { "help", no_argument, NULL, 'h' },
+ { "version", no_argument, NULL, 'V' },
+ { "keep-size", no_argument, NULL, 'n' },
+ { "punch-hole", no_argument, NULL, 'p' },
+ { "collapse-range", no_argument, NULL, 'c' },
+ { "dig-holes", no_argument, NULL, 'd' },
+ { "insert-range", no_argument, NULL, 'i' },
+ { "zero-range", no_argument, NULL, 'z' },
+ { "offset", required_argument, NULL, 'o' },
+ { "length", required_argument, NULL, 'l' },
+ { "posix", no_argument, NULL, 'x' },
+ { "verbose", no_argument, NULL, 'v' },
+ { NULL, 0, NULL, 0 }
};
static const ul_excl_t excl[] = { /* rows and cols in ASCII order */
diff --git a/sys-utils/flock.c b/sys-utils/flock.c
index 08e313e69..8af1e8ade 100644
--- a/sys-utils/flock.c
+++ b/sys-utils/flock.c
@@ -239,7 +239,7 @@ int main(int argc, char *argv[])
cmd_argv[0] = _PATH_BSHELL;
cmd_argv[1] = "-c";
cmd_argv[2] = argv[optind + 2];
- cmd_argv[3] = 0;
+ cmd_argv[3] = NULL;
} else {
cmd_argv = &argv[optind + 1];
}
diff --git a/sys-utils/fsfreeze.c b/sys-utils/fsfreeze.c
index 294c44103..b1fa4fa8c 100644
--- a/sys-utils/fsfreeze.c
+++ b/sys-utils/fsfreeze.c
@@ -61,11 +61,11 @@ int main(int argc, char **argv)
struct stat sb;
static const struct option longopts[] = {
- { "help", 0, 0, 'h' },
- { "freeze", 0, 0, 'f' },
- { "unfreeze", 0, 0, 'u' },
- { "version", 0, 0, 'V' },
- { NULL, 0, 0, 0 }
+ { "help", no_argument, NULL, 'h' },
+ { "freeze", no_argument, NULL, 'f' },
+ { "unfreeze", no_argument, NULL, 'u' },
+ { "version", no_argument, NULL, 'V' },
+ { NULL, 0, NULL, 0 }
};
static const ul_excl_t excl[] = { /* rows and cols in ASCII order */
diff --git a/sys-utils/fstrim.c b/sys-utils/fstrim.c
index f252edba0..f42ebe77a 100644
--- a/sys-utils/fstrim.c
+++ b/sys-utils/fstrim.c
@@ -274,14 +274,14 @@ int main(int argc, char **argv)
struct fstrim_range range;
static const struct option longopts[] = {
- { "all", 0, 0, 'a' },
- { "help", 0, 0, 'h' },
- { "version", 0, 0, 'V' },
- { "offset", 1, 0, 'o' },
- { "length", 1, 0, 'l' },
- { "minimum", 1, 0, 'm' },
- { "verbose", 0, 0, 'v' },
- { NULL, 0, 0, 0 }
+ { "all", no_argument, NULL, 'a' },
+ { "help", no_argument, NULL, 'h' },
+ { "version", no_argument, NULL, 'V' },
+ { "offset", required_argument, NULL, 'o' },
+ { "length", required_argument, NULL, 'l' },
+ { "minimum", required_argument, NULL, 'm' },
+ { "verbose", no_argument, NULL, 'v' },
+ { NULL, 0, NULL, 0 }
};
setlocale(LC_ALL, "");
diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c
index 6de09fda8..9fae9df23 100644
--- a/sys-utils/hwclock.c
+++ b/sys-utils/hwclock.c
@@ -1457,7 +1457,7 @@ static void usage(const struct hwclock_control *ctl, const char *fmt, ...)
*/
int main(int argc, char **argv)
{
- struct hwclock_control ctl = { 0 };
+ struct hwclock_control ctl = { NULL };
struct timeval startup_time;
struct adjtime adjtime = { 0 };
/*
@@ -1487,44 +1487,44 @@ int main(int argc, char **argv)
};
static const struct option longopts[] = {
- {"adjust", 0, 0, 'a'},
- {"help", 0, 0, 'h'},
- {"show", 0, 0, 'r'},
- {"hctosys", 0, 0, 's'},
- {"utc", 0, 0, 'u'},
- {"version", 0, 0, 'v'},
- {"systohc", 0, 0, 'w'},
- {"debug", 0, 0, 'D'},
+ { "adjust", no_argument, NULL, 'a' },
+ { "help", no_argument, NULL, 'h' },
+ { "show", no_argument, NULL, 'r' },
+ { "hctosys", no_argument, NULL, 's' },
+ { "utc", no_argument, NULL, 'u' },
+ { "version", no_argument, NULL, 'v' },
+ { "systohc", no_argument, NULL, 'w' },
+ { "debug", no_argument, NULL, 'D' },
#ifdef __alpha__
- {"ARC", 0, 0, 'A'},
- {"arc", 0, 0, 'A'},
- {"Jensen", 0, 0, 'J'},
- {"jensen", 0, 0, 'J'},
- {"SRM", 0, 0, 'S'},
- {"srm", 0, 0, 'S'},
- {"funky-toy", 0, 0, 'F'},
+ { "ARC", no_argument, NULL, 'A' },
+ { "arc", no_argument, NULL, 'A' },
+ { "Jensen", no_argument, NULL, 'J' },
+ { "jensen", no_argument, NULL, 'J' },
+ { "SRM", no_argument, NULL, 'S' },
+ { "srm", no_argument, NULL, 'S' },
+ { "funky-toy", no_argument, NULL, 'F' },
#endif
- {"set", 0, 0, OPT_SET},
+ { "set", no_argument, NULL, OPT_SET },
#ifdef __linux__
- {"getepoch", 0, 0, OPT_GETEPOCH},
- {"setepoch", 0, 0, OPT_SETEPOCH},
+ { "getepoch", no_argument, NULL, OPT_GETEPOCH },
+ { "setepoch", no_argument, NULL, OPT_SETEPOCH },
#endif
- {"noadjfile", 0, 0, OPT_NOADJFILE},
- {"localtime", 0, 0, OPT_LOCALTIME},
- {"badyear", 0, 0, OPT_BADYEAR},
- {"directisa", 0, 0, OPT_DIRECTISA},
- {"test", 0, 0, OPT_TEST},
- {"date", 1, 0, OPT_DATE},
- {"epoch", 1, 0, OPT_EPOCH},
+ { "noadjfile", no_argument, NULL, OPT_NOADJFILE },
+ { "localtime", no_argument, NULL, OPT_LOCALTIME },
+ { "badyear", no_argument, NULL, OPT_BADYEAR },
+ { "directisa", no_argument, NULL, OPT_DIRECTISA },
+ { "test", no_argument, NULL, OPT_TEST },
+ { "date", required_argument, NULL, OPT_DATE },
+ { "epoch", required_argument, NULL, OPT_EPOCH },
#ifdef __linux__
- {"rtc", 1, 0, 'f'},
+ { "rtc", required_argument, NULL, 'f' },
#endif
- {"adjfile", 1, 0, OPT_ADJFILE},
- {"systz", 0, 0, OPT_SYSTZ},
- {"predict-hc", 0, 0, OPT_PREDICT_HC},
- {"get", 0, 0, OPT_GET},
- {"update-drift",0, 0, OPT_UPDATE},
- {NULL, 0, NULL, 0}
+ { "adjfile", required_argument, NULL, OPT_ADJFILE },
+ { "systz", no_argument, NULL, OPT_SYSTZ },
+ { "predict-hc", no_argument, NULL, OPT_PREDICT_HC },
+ { "get", no_argument, NULL, OPT_GET },
+ { "update-drift", no_argument, NULL, OPT_UPDATE },
+ { NULL, 0, NULL, 0 }
};
static const ul_excl_t excl[] = { /* rows and cols in ASCII order */
diff --git a/sys-utils/losetup.c b/sys-utils/losetup.c
index ad508109d..5f599ead5 100644
--- a/sys-utils/losetup.c
+++ b/sys-utils/losetup.c
@@ -574,28 +574,28 @@ int main(int argc, char **argv)
OPT_DIO
};
static const struct option longopts[] = {
- { "all", 0, 0, 'a' },
- { "set-capacity", 1, 0, 'c' },
- { "detach", 1, 0, 'd' },
- { "detach-all", 0, 0, 'D' },
- { "find", 0, 0, 'f' },
- { "nooverlap", 0, 0, 'L' },
- { "help", 0, 0, 'h' },
- { "associated", 1, 0, 'j' },
- { "json", 0, 0, 'J' },
- { "list", 0, 0, 'l' },
- { "noheadings", 0, 0, 'n' },
- { "offset", 1, 0, 'o' },
- { "output", 1, 0, 'O' },
- { "sizelimit", 1, 0, OPT_SIZELIMIT },
- { "partscan", 0, 0, 'P' },
- { "read-only", 0, 0, 'r' },
- { "direct-io", 2, 0, OPT_DIO },
- { "raw", 0, 0, OPT_RAW },
- { "show", 0, 0, OPT_SHOW },
- { "verbose", 0, 0, 'v' },
- { "version", 0, 0, 'V' },
- { NULL, 0, 0, 0 }
+ { "all", no_argument, NULL, 'a' },
+ { "set-capacity", required_argument, NULL, 'c' },
+ { "detach", required_argument, NULL, 'd' },
+ { "detach-all", no_argument, NULL, 'D' },
+ { "find", no_argument, NULL, 'f' },
+ { "nooverlap", no_argument, NULL, 'L' },
+ { "help", no_argument, NULL, 'h' },
+ { "associated", required_argument, NULL, 'j' },
+ { "json", no_argument, NULL, 'J' },
+ { "list", no_argument, NULL, 'l' },
+ { "noheadings", no_argument, NULL, 'n' },
+ { "offset", required_argument, NULL, 'o' },
+ { "output", required_argument, NULL, 'O' },
+ { "sizelimit", required_argument, NULL, OPT_SIZELIMIT },
+ { "partscan", no_argument, NULL, 'P' },
+ { "read-only", no_argument, NULL, 'r' },
+ { "direct-io", optional_argument, NULL, OPT_DIO },
+ { "raw", no_argument, NULL, OPT_RAW },
+ { "show", no_argument, NULL, OPT_SHOW },
+ { "verbose", no_argument, NULL, 'v' },
+ { "version", no_argument, NULL, 'V' },
+ { NULL, 0, NULL, 0 }
};
static const ul_excl_t excl[] = { /* rows and cols in ASCII order */
diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index f1b0348cf..92ffba44a 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -1988,23 +1988,23 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
int main(int argc, char *argv[])
{
struct lscpu_modifier _mod = { .mode = OUTPUT_SUMMARY }, *mod = &_mod;
- struct lscpu_desc _desc = { .flags = 0 }, *desc = &_desc;
+ struct lscpu_desc _desc = { .flags = NULL }, *desc = &_desc;
int c, i;
int columns[ARRAY_SIZE(coldescs)], ncolumns = 0;
int cpu_modifier_specified = 0;
static const struct option longopts[] = {
- { "all", no_argument, 0, 'a' },
- { "online", no_argument, 0, 'b' },
- { "offline", no_argument, 0, 'c' },
- { "help", no_argument, 0, 'h' },
- { "extended", optional_argument, 0, 'e' },
- { "parse", optional_argument, 0, 'p' },
- { "sysroot", required_argument, 0, 's' },
- { "physical", no_argument, 0, 'y' },
- { "hex", no_argument, 0, 'x' },
- { "version", no_argument, 0, 'V' },
- { NULL, 0, 0, 0 }
+ { "all", no_argument, NULL, 'a' },
+ { "online", no_argument, NULL, 'b' },
+ { "offline", no_argument, NULL, 'c' },
+ { "help", no_argument, NULL, 'h' },
+ { "extended", optional_argument, NULL, 'e' },
+ { "parse", optional_argument, NULL, 'p' },
+ { "sysroot", required_argument, NULL, 's' },
+ { "physical", no_argument, NULL, 'y' },
+ { "hex", no_argument, NULL, 'x' },
+ { "version", no_argument, NULL, 'V' },
+ { NULL, 0, NULL, 0 }
};
static const ul_excl_t excl[] = { /* rows and cols in ASCII order */
diff --git a/sys-utils/lsipc.c b/sys-utils/lsipc.c
index d4e5037ad..ee203e02a 100644
--- a/sys-utils/lsipc.c
+++ b/sys-utils/lsipc.c
@@ -1081,27 +1081,27 @@ int main(int argc, char *argv[])
};
static const struct option longopts[] = {
- { "bytes", no_argument, 0, 'b' },
- { "creator", no_argument, 0, 'c' },
- { "export", no_argument, 0, 'e' },
- { "global", no_argument, 0, 'g' },
- { "help", no_argument, 0, 'h' },
- { "id", required_argument, 0, 'i' },
- { "json", no_argument, 0, 'J' },
- { "list", no_argument, 0, 'l' },
- { "newline", no_argument, 0, 'n' },
- { "noheadings", no_argument, 0, OPT_NOHEAD },
- { "notruncate", no_argument, 0, OPT_NOTRUNC },
- { "numeric-perms", no_argument, 0, 'P' },
- { "output", required_argument, 0, 'o' },
- { "pid", no_argument, 0, 'p' },
- { "queues", no_argument, 0, 'q' },
- { "raw", no_argument, 0, 'r' },
- { "semaphores", no_argument, 0, 's' },
- { "shmems", no_argument, 0, 'm' },
- { "time", no_argument, 0, 't' },
- { "time-format", required_argument, 0, OPT_TIME_FMT },
- { "version", no_argument, 0, 'V' },
+ { "bytes", no_argument, NULL, 'b' },
+ { "creator", no_argument, NULL, 'c' },
+ { "export", no_argument, NULL, 'e' },
+ { "global", no_argument, NULL, 'g' },
+ { "help", no_argument, NULL, 'h' },
+ { "id", required_argument, NULL, 'i' },
+ { "json", no_argument, NULL, 'J' },
+ { "list", no_argument, NULL, 'l' },
+ { "newline", no_argument, NULL, 'n' },
+ { "noheadings", no_argument, NULL, OPT_NOHEAD },
+ { "notruncate", no_argument, NULL, OPT_NOTRUNC },
+ { "numeric-perms", no_argument, NULL, 'P' },
+ { "output", required_argument, NULL, 'o' },
+ { "pid", no_argument, NULL, 'p' },
+ { "queues", no_argument, NULL, 'q' },
+ { "raw", no_argument, NULL, 'r' },
+ { "semaphores", no_argument, NULL, 's' },
+ { "shmems", no_argument, NULL, 'm' },
+ { "time", no_argument, NULL, 't' },
+ { "time-format", required_argument, NULL, OPT_TIME_FMT },
+ { "version", no_argument, NULL, 'V' },
{NULL, 0, NULL, 0}
};
diff --git a/sys-utils/mount.c b/sys-utils/mount.c
index 0b55500f2..b09e77616 100644
--- a/sys-utils/mount.c
+++ b/sys-utils/mount.c
@@ -832,40 +832,40 @@ int main(int argc, char **argv)
};
static const struct option longopts[] = {
- { "all", 0, 0, 'a' },
- { "fake", 0, 0, 'f' },
- { "fstab", 1, 0, 'T' },
- { "fork", 0, 0, 'F' },
- { "help", 0, 0, 'h' },
- { "no-mtab", 0, 0, 'n' },
- { "read-only", 0, 0, 'r' },
- { "ro", 0, 0, 'r' },
- { "verbose", 0, 0, 'v' },
- { "version", 0, 0, 'V' },
- { "read-write", 0, 0, 'w' },
- { "rw", 0, 0, 'w' },
- { "options", 1, 0, 'o' },
- { "test-opts", 1, 0, 'O' },
- { "types", 1, 0, 't' },
- { "uuid", 1, 0, 'U' },
- { "label", 1, 0, 'L'},
- { "bind", 0, 0, 'B' },
- { "move", 0, 0, 'M' },
- { "rbind", 0, 0, 'R' },
- { "make-shared", 0, 0, MOUNT_OPT_SHARED },
- { "make-slave", 0, 0, MOUNT_OPT_SLAVE },
- { "make-private", 0, 0, MOUNT_OPT_PRIVATE },
- { "make-unbindable", 0, 0, MOUNT_OPT_UNBINDABLE },
- { "make-rshared", 0, 0, MOUNT_OPT_RSHARED },
- { "make-rslave", 0, 0, MOUNT_OPT_RSLAVE },
- { "make-rprivate", 0, 0, MOUNT_OPT_RPRIVATE },
- { "make-runbindable", 0, 0, MOUNT_OPT_RUNBINDABLE },
- { "no-canonicalize", 0, 0, 'c' },
- { "internal-only", 0, 0, 'i' },
- { "show-labels", 0, 0, 'l' },
- { "target", 1, 0, MOUNT_OPT_TARGET },
- { "source", 1, 0, MOUNT_OPT_SOURCE },
- { NULL, 0, 0, 0 }
+ { "all", no_argument, NULL, 'a' },
+ { "fake", no_argument, NULL, 'f' },
+ { "fstab", required_argument, NULL, 'T' },
+ { "fork", no_argument, NULL, 'F' },
+ { "help", no_argument, NULL, 'h' },
+ { "no-mtab", no_argument, NULL, 'n' },
+ { "read-only", no_argument, NULL, 'r' },
+ { "ro", no_argument, NULL, 'r' },
+ { "verbose", no_argument, NULL, 'v' },
+ { "version", no_argument, NULL, 'V' },
+ { "read-write", no_argument, NULL, 'w' },
+ { "rw", no_argument, NULL, 'w' },
+ { "options", required_argument, NULL, 'o' },
+ { "test-opts", required_argument, NULL, 'O' },
+ { "types", required_argument, NULL, 't' },
+ { "uuid", required_argument, NULL, 'U' },
+ { "label", required_argument, NULL, 'L' },
+ { "bind", no_argument, NULL, 'B' },
+ { "move", no_argument, NULL, 'M' },
+ { "rbind", no_argument, NULL, 'R' },
+ { "make-shared", no_argument, NULL, MOUNT_OPT_SHARED },
+ { "make-slave", no_argument, NULL, MOUNT_OPT_SLAVE },
+ { "make-private", no_argument, NULL, MOUNT_OPT_PRIVATE },
+ { "make-unbindable", no_argument, NULL, MOUNT_OPT_UNBINDABLE },
+ { "make-rshared", no_argument, NULL, MOUNT_OPT_RSHARED },
+ { "make-rslave", no_argument, NULL, MOUNT_OPT_RSLAVE },
+ { "make-rprivate", no_argument, NULL, MOUNT_OPT_RPRIVATE },
+ { "make-runbindable", no_argument, NULL, MOUNT_OPT_RUNBINDABLE },
+ { "no-canonicalize", no_argument, NULL, 'c' },
+ { "internal-only", no_argument, NULL, 'i' },
+ { "show-labels", no_argument, NULL, 'l' },
+ { "target", required_argument, NULL, MOUNT_OPT_TARGET },
+ { "source", required_argument, NULL, MOUNT_OPT_SOURCE },
+ { NULL, 0, NULL, 0 }
};
static const ul_excl_t excl[] = { /* rows and cols in ASCII order */
diff --git a/sys-utils/mountpoint.c b/sys-utils/mountpoint.c
index f5302937b..ab0951f9b 100644
--- a/sys-utils/mountpoint.c
+++ b/sys-utils/mountpoint.c
@@ -136,15 +136,15 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
int main(int argc, char **argv)
{
int c;
- struct mountpoint_control ctl = { 0 };
+ struct mountpoint_control ctl = { NULL };
static const struct option longopts[] = {
- { "quiet", 0, 0, 'q' },
- { "fs-devno", 0, 0, 'd' },
- { "devno", 0, 0, 'x' },
- { "help", 0, 0, 'h' },
- { "version", 0, 0, 'V' },
- { NULL, 0, 0, 0 }
+ { "quiet", no_argument, NULL, 'q' },
+ { "fs-devno", no_argument, NULL, 'd' },
+ { "devno", no_argument, NULL, 'x' },
+ { "help", no_argument, NULL, 'h' },
+ { "version", no_argument, NULL, 'V' },
+ { NULL, 0, NULL, 0 }
};
setlocale(LC_ALL, "");
diff --git a/sys-utils/readprofile.c b/sys-utils/readprofile.c
index 0170a7240..f18fa9bf2 100644
--- a/sys-utils/readprofile.c
+++ b/sys-utils/readprofile.c
@@ -132,7 +132,7 @@ int main(int argc, char **argv)
{
FILE *map;
int proFd;
- char *mapFile, *proFile, *mult = 0;
+ char *mapFile, *proFile, *mult = NULL;
size_t len = 0, indx = 1;
unsigned long long add0 = 0;
unsigned int step;
@@ -162,7 +162,7 @@ int main(int argc, char **argv)
{"no-auto", no_argument, NULL, 'n'},
{"version", no_argument, NULL, 'V'},
{"help", no_argument, NULL, 'h'},
- {NULL, 0, 0, 0}
+ {NULL, 0, NULL, 0}
};
#define next (current^1)
@@ -224,7 +224,7 @@ int main(int argc, char **argv)
* write is not sizeof(int), the multiplier is not
* changed. */
if (mult) {
- multiplier = strtoul(mult, 0, 10);
+ multiplier = strtoul(mult, NULL, 10);
to_write = sizeof(int);
} else {
multiplier = 0;
diff --git a/sys-utils/rtcwake.c b/sys-utils/rtcwake.c
index 11f75ae9b..de0ac4d85 100644
--- a/sys-utils/rtcwake.c
+++ b/sys-utils/rtcwake.c
@@ -168,7 +168,7 @@ static int get_basetimes(struct rtcwake_control *ctl, int fd)
return -1;
}
- ctl->sys_time = time(0);
+ ctl->sys_time = time(NULL);
if (ctl->sys_time == (time_t)-1) {
warn(_("read system time failed"));
return -1;
@@ -413,21 +413,21 @@ int main(int argc, char **argv)
OPT_LIST
};
static const struct option long_options[] = {
- {"adjfile", required_argument, 0, 'A'},
- {"auto", no_argument, 0, 'a'},
- {"dry-run", no_argument, 0, 'n'},
- {"local", no_argument, 0, 'l'},
- {"utc", no_argument, 0, 'u'},
- {"verbose", no_argument, 0, 'v'},
- {"version", no_argument, 0, 'V'},
- {"help", no_argument, 0, 'h'},
- {"mode", required_argument, 0, 'm'},
- {"device", required_argument, 0, 'd'},
- {"seconds", required_argument, 0, 's'},
- {"time", required_argument, 0, 't'},
- {"date", required_argument, 0, OPT_DATE},
- {"list-modes", no_argument, 0, OPT_LIST},
- {0, 0, 0, 0 }
+ { "adjfile", required_argument, NULL, 'A' },
+ { "auto", no_argument, NULL, 'a' },
+ { "dry-run", no_argument, NULL, 'n' },
+ { "local", no_argument, NULL, 'l' },
+ { "utc", no_argument, NULL, 'u' },
+ { "verbose", no_argument, NULL, 'v' },
+ { "version", no_argument, NULL, 'V' },
+ { "help", no_argument, NULL, 'h' },
+ { "mode", required_argument, NULL, 'm' },
+ { "device", required_argument, NULL, 'd' },
+ { "seconds", required_argument, NULL, 's' },
+ { "time", required_argument, NULL, 't' },
+ { "date", required_argument, NULL, OPT_DATE },
+ { "list-modes", no_argument, NULL, OPT_LIST },
+ { NULL, 0, NULL, 0 }
};
static const ul_excl_t excl[] = {
{ 'a', 'l', 'u' },
diff --git a/sys-utils/setpriv.c b/sys-utils/setpriv.c
index 897be3fd0..2129115a0 100644
--- a/sys-utils/setpriv.c
+++ b/sys-utils/setpriv.c
@@ -252,7 +252,7 @@ static void dump_label(const char *name)
static void dump_groups(void)
{
- int n = getgroups(0, 0);
+ int n = getgroups(0, NULL);
gid_t *groups;
if (n < 0) {
@@ -602,27 +602,27 @@ int main(int argc, char **argv)
};
static const struct option longopts[] = {
- {"dump", no_argument, 0, 'd'},
- {"nnp", no_argument, 0, NNP},
- {"no-new-privs", no_argument, 0, NNP},
- {"inh-caps", required_argument, 0, INHCAPS},
- {"list-caps", no_argument, 0, LISTCAPS},
- {"ruid", required_argument, 0, RUID},
- {"euid", required_argument, 0, EUID},
- {"rgid", required_argument, 0, RGID},
- {"egid", required_argument, 0, EGID},
- {"reuid", required_argument, 0, REUID},
- {"regid", required_argument, 0, REGID},
- {"clear-groups", no_argument, 0, CLEAR_GROUPS},
- {"keep-groups", no_argument, 0, KEEP_GROUPS},
- {"groups", required_argument, 0, GROUPS},
- {"bounding-set", required_argument, 0, CAPBSET},
- {"securebits", required_argument, 0, SECUREBITS},
- {"selinux-label", required_argument, 0, SELINUX_LABEL},
- {"apparmor-profile", required_argument, 0, APPARMOR_PROFILE},
- {"help", no_argument, 0, 'h'},
- {"version", no_argument, 0, 'V'},
- {NULL, 0, 0, 0}
+ { "dump", no_argument, NULL, 'd' },
+ { "nnp", no_argument, NULL, NNP },
+ { "no-new-privs", no_argument, NULL, NNP },
+ { "inh-caps", required_argument, NULL, INHCAPS },
+ { "list-caps", no_argument, NULL, LISTCAPS },
+ { "ruid", required_argument, NULL, RUID },
+ { "euid", required_argument, NULL, EUID },
+ { "rgid", required_argument, NULL, RGID },
+ { "egid", required_argument, NULL, EGID },
+ { "reuid", required_argument, NULL, REUID },
+ { "regid", required_argument, NULL, REGID },
+ { "clear-groups", no_argument, NULL, CLEAR_GROUPS },
+ { "keep-groups", no_argument, NULL, KEEP_GROUPS },
+ { "groups", required_argument, NULL, GROUPS },
+ { "bounding-set", required_argument, NULL, CAPBSET },
+ { "securebits", required_argument, NULL, SECUREBITS },
+ { "selinux-label", required_argument, NULL, SELINUX_LABEL },
+ { "apparmor-profile", required_argument, NULL, APPARMOR_PROFILE },
+ { "help", no_argument, NULL, 'h' },
+ { "version", no_argument, NULL, 'V' },
+ { NULL, 0, NULL, 0 }
};
static const ul_excl_t excl[] = {
diff --git a/sys-utils/swapoff.c b/sys-utils/swapoff.c
index e20c502bd..aab6dfb8d 100644
--- a/sys-utils/swapoff.c
+++ b/sys-utils/swapoff.c
@@ -188,11 +188,11 @@ int main(int argc, char *argv[])
size_t i;
static const struct option long_opts[] = {
- { "all", 0, 0, 'a' },
- { "help", 0, 0, 'h' },
- { "verbose", 0, 0, 'v' },
- { "version", 0, 0, 'V' },
- { NULL, 0, 0, 0 }
+ { "all", no_argument, NULL, 'a' },
+ { "help", no_argument, NULL, 'h' },
+ { "verbose", no_argument, NULL, 'v' },
+ { "version", no_argument, NULL, 'V' },
+ { NULL, 0, NULL, 0 }
};
setlocale(LC_ALL, "");
diff --git a/sys-utils/swapon.c b/sys-utils/swapon.c
index 0982093d5..d0ad6bb6f 100644
--- a/sys-utils/swapon.c
+++ b/sys-utils/swapon.c
@@ -693,7 +693,7 @@ static int parse_options(struct swap_prop *props, const char *options)
assert(props);
assert(options);
- if (mnt_optstr_get_option(options, "nofail", NULL, 0) == 0)
+ if (mnt_optstr_get_option(options, "nofail", NULL, NULL) == 0)
props->no_fail = 1;
if (mnt_optstr_get_option(options, "discard", &arg, &argsz) == 0) {
@@ -845,21 +845,21 @@ int main(int argc, char *argv[])
};
static const struct option long_opts[] = {
- { "priority", 1, 0, 'p' },
- { "discard", 2, 0, 'd' },
- { "ifexists", 0, 0, 'e' },
- { "options", 2, 0, 'o' },
- { "summary", 0, 0, 's' },
- { "fixpgsz", 0, 0, 'f' },
- { "all", 0, 0, 'a' },
- { "help", 0, 0, 'h' },
- { "verbose", 0, 0, 'v' },
- { "version", 0, 0, 'V' },
- { "show", 2, 0, SHOW_OPTION },
- { "noheadings", 0, 0, NOHEADINGS_OPTION },
- { "raw", 0, 0, RAW_OPTION },
- { "bytes", 0, 0, BYTES_OPTION },
- { NULL, 0, 0, 0 }
+ { "priority", required_argument, NULL, 'p' },
+ { "discard", optional_argument, NULL, 'd' },
+ { "ifexists", no_argument, NULL, 'e' },
+ { "options", optional_argument, NULL, 'o' },
+ { "summary", no_argument, NULL, 's' },
+ { "fixpgsz", no_argument, NULL, 'f' },
+ { "all", no_argument, NULL, 'a' },
+ { "help", no_argument, NULL, 'h' },
+ { "verbose", no_argument, NULL, 'v' },
+ { "version", no_argument, NULL, 'V' },
+ { "show", optional_argument, NULL, SHOW_OPTION },
+ { "noheadings", no_argument, NULL, NOHEADINGS_OPTION },
+ { "raw", no_argument, NULL, RAW_OPTION },
+ { "bytes", no_argument, NULL, BYTES_OPTION },
+ { NULL, 0, NULL, 0 }
};
static const ul_excl_t excl[] = { /* rows and cols in ASCII order */
diff --git a/sys-utils/tunelp.c b/sys-utils/tunelp.c
index 7b38255d6..8cfbe80a2 100644
--- a/sys-utils/tunelp.c
+++ b/sys-utils/tunelp.c
@@ -148,7 +148,7 @@ int main(int argc, char **argv)
print_usage(stderr);
cmdst = cmds = xmalloc(sizeof(struct command));
- cmds->next = 0;
+ cmds->next = NULL;
show_irq = 1;
while ((c = getopt_long(argc, argv, "t:c:w:a:i:ho:C:sq:rT:vV", longopts, NULL)) != -1) {
@@ -161,35 +161,35 @@ int main(int argc, char **argv)
cmds->val = strtol_or_err(optarg, _("argument error"));
cmds->next = xmalloc(sizeof(struct command));
cmds = cmds->next;
- cmds->next = 0;
+ cmds->next = NULL;
break;
case 't':
cmds->op = LPTIME;
cmds->val = strtol_or_err(optarg, _("argument error"));
cmds->next = xmalloc(sizeof(struct command));
cmds = cmds->next;
- cmds->next = 0;
+ cmds->next = NULL;
break;
case 'c':
cmds->op = LPCHAR;
cmds->val = strtol_or_err(optarg, _("argument error"));
cmds->next = xmalloc(sizeof(struct command));
cmds = cmds->next;
- cmds->next = 0;
+ cmds->next = NULL;
break;
case 'w':
cmds->op = LPWAIT;
cmds->val = strtol_or_err(optarg, _("argument error"));
cmds->next = xmalloc(sizeof(struct command));
cmds = cmds->next;
- cmds->next = 0;
+ cmds->next = NULL;
break;
case 'a':
cmds->op = LPABORT;
cmds->val = parse_switch(optarg, _("argument error"), "on", "off", NULL);
cmds->next = xmalloc(sizeof(struct command));
cmds = cmds->next;
- cmds->next = 0;
+ cmds->next = NULL;
break;
case 'q':
show_irq = parse_switch(optarg, _("argument error"), "on", "off", NULL);
@@ -199,14 +199,14 @@ int main(int argc, char **argv)
cmds->val = parse_switch(optarg, _("argument error"), "on", "off", NULL);
cmds->next = xmalloc(sizeof(struct command));
cmds = cmds->next;
- cmds->next = 0;
+ cmds->next = NULL;
break;
case 'C':
cmds->op = LPCAREFUL;
cmds->val = parse_switch(optarg, _("argument error"), "on", "off", NULL);
cmds->next = xmalloc(sizeof(struct command));
cmds = cmds->next;
- cmds->next = 0;
+ cmds->next = NULL;
break;
case 's':
show_irq = 0;
@@ -214,14 +214,14 @@ int main(int argc, char **argv)
cmds->val = 0;
cmds->next = xmalloc(sizeof(struct command));
cmds = cmds->next;
- cmds->next = 0;
+ cmds->next = NULL;
break;
case 'r':
cmds->op = LPRESET;
cmds->val = 0;
cmds->next = xmalloc(sizeof(struct command));
cmds = cmds->next;
- cmds->next = 0;
+ cmds->next = NULL;
break;
case 'T':
/* Note: this will do the wrong thing on
@@ -231,7 +231,7 @@ int main(int argc, char **argv)
cmds->val = parse_switch(optarg, _("argument error"), "on", "off", NULL);
cmds->next = xmalloc(sizeof(struct command));
cmds = cmds->next;
- cmds->next = 0;
+ cmds->next = NULL;
break;
case 'v':
case 'V':
diff --git a/sys-utils/umount.c b/sys-utils/umount.c
index 640e2cd0d..21f7edfed 100644
--- a/sys-utils/umount.c
+++ b/sys-utils/umount.c
@@ -508,23 +508,23 @@ int main(int argc, char **argv)
};
static const struct option longopts[] = {
- { "all", 0, 0, 'a' },
- { "all-targets", 0, 0, 'A' },
- { "detach-loop", 0, 0, 'd' },
- { "fake", 0, 0, UMOUNT_OPT_FAKE },
- { "force", 0, 0, 'f' },
- { "help", 0, 0, 'h' },
- { "internal-only", 0, 0, 'i' },
- { "lazy", 0, 0, 'l' },
- { "no-canonicalize", 0, 0, 'c' },
- { "no-mtab", 0, 0, 'n' },
- { "read-only", 0, 0, 'r' },
- { "recursive", 0, 0, 'R' },
- { "test-opts", 1, 0, 'O' },
- { "types", 1, 0, 't' },
- { "verbose", 0, 0, 'v' },
- { "version", 0, 0, 'V' },
- { NULL, 0, 0, 0 }
+ { "all", no_argument, NULL, 'a' },
+ { "all-targets", no_argument, NULL, 'A' },
+ { "detach-loop", no_argument, NULL, 'd' },
+ { "fake", no_argument, NULL, UMOUNT_OPT_FAKE },
+ { "force", no_argument, NULL, 'f' },
+ { "help", no_argument, NULL, 'h' },
+ { "internal-only", no_argument, NULL, 'i' },
+ { "lazy", no_argument, NULL, 'l' },
+ { "no-canonicalize", no_argument, NULL, 'c' },
+ { "no-mtab", no_argument, NULL, 'n' },
+ { "read-only", no_argument, NULL, 'r' },
+ { "recursive", no_argument, NULL, 'R' },
+ { "test-opts", required_argument, NULL, 'O' },
+ { "types", required_argument, NULL, 't' },
+ { "verbose", no_argument, NULL, 'v' },
+ { "version", no_argument, NULL, 'V' },
+ { NULL, 0, NULL, 0 }
};
static const ul_excl_t excl[] = { /* rows and cols in ASCII order */
diff --git a/sys-utils/unshare.c b/sys-utils/unshare.c
index 0d02b70b3..bccd75f3a 100644
--- a/sys-utils/unshare.c
+++ b/sys-utils/unshare.c
@@ -280,23 +280,23 @@ int main(int argc, char *argv[])
OPT_SETGROUPS
};
static const struct option longopts[] = {
- { "help", no_argument, 0, 'h' },
- { "version", no_argument, 0, 'V'},
-
- { "mount", optional_argument, 0, 'm' },
- { "uts", optional_argument, 0, 'u' },
- { "ipc", optional_argument, 0, 'i' },
- { "net", optional_argument, 0, 'n' },
- { "pid", optional_argument, 0, 'p' },
- { "user", optional_argument, 0, 'U' },
- { "cgroup", optional_argument, 0, 'C' },
-
- { "fork", no_argument, 0, 'f' },
- { "mount-proc", optional_argument, 0, OPT_MOUNTPROC },
- { "map-root-user", no_argument, 0, 'r' },
- { "propagation", required_argument, 0, OPT_PROPAGATION },
- { "setgroups", required_argument, 0, OPT_SETGROUPS },
- { NULL, 0, 0, 0 }
+ { "help", no_argument, NULL, 'h' },
+ { "version", no_argument, NULL, 'V' },
+
+ { "mount", optional_argument, NULL, 'm' },
+ { "uts", optional_argument, NULL, 'u' },
+ { "ipc", optional_argument, NULL, 'i' },
+ { "net", optional_argument, NULL, 'n' },
+ { "pid", optional_argument, NULL, 'p' },
+ { "user", optional_argument, NULL, 'U' },
+ { "cgroup", optional_argument, NULL, 'C' },
+
+ { "fork", no_argument, NULL, 'f' },
+ { "mount-proc", optional_argument, NULL, OPT_MOUNTPROC },
+ { "map-root-user", no_argument, NULL, 'r' },
+ { "propagation", required_argument, NULL, OPT_PROPAGATION },
+ { "setgroups", required_argument, NULL, OPT_SETGROUPS },
+ { NULL, 0, NULL, 0 }
};
int setgrpcmd = SETGROUPS_NONE;