From 87918040658f2fa9b1bf78f1f8f4f5c065a2e3a3 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sat, 11 Feb 2017 20:23:26 +0000 Subject: 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 --- Documentation/boilerplate.c | 18 +++++----- disk-utils/addpart.c | 6 ++-- disk-utils/cfdisk.c | 2 +- disk-utils/delpart.c | 6 ++-- disk-utils/fsck.c | 24 ++++++------- disk-utils/fsck.cramfs.c | 18 +++++----- disk-utils/isosize.c | 10 +++--- disk-utils/mkfs.cramfs.c | 6 ++-- disk-utils/mkswap.c | 18 +++++----- disk-utils/raw.c | 10 +++--- disk-utils/resizepart.c | 6 ++-- disk-utils/sfdisk.c | 2 +- disk-utils/swaplabel.c | 10 +++--- include/pt-mbr-partnames.h | 2 +- lib/randutils.c | 4 +-- lib/timer.c | 2 +- libblkid/src/dev.c | 6 ++-- libblkid/src/devname.c | 12 +++---- libblkid/src/read.c | 6 ++-- libblkid/src/resolve.c | 2 +- libblkid/src/superblocks/vfat.c | 2 +- libblkid/src/tag.c | 12 +++---- libblkid/src/verify.c | 4 +-- libfdisk/src/bsd.c | 2 +- libmount/python/context.c | 46 ++++++++++++------------- libmount/python/fs.c | 46 ++++++++++++------------- libmount/python/pylibmount.c | 2 +- libmount/python/tab.c | 46 ++++++++++++------------- libuuid/src/gen_uuid.c | 10 +++--- login-utils/chfn.c | 14 ++++---- login-utils/chsh.c | 12 +++---- login-utils/nologin.c | 6 ++-- login-utils/su-common.c | 4 +-- login-utils/sulogin.c | 12 +++---- login-utils/utmpdump.c | 12 +++---- misc-utils/cal.c | 4 +-- misc-utils/findmnt.c | 76 ++++++++++++++++++++--------------------- misc-utils/lsblk.c | 58 +++++++++++++++---------------- misc-utils/namei.c | 18 +++++----- misc-utils/wipefs.c | 22 ++++++------ sys-utils/blkdiscard.c | 18 +++++----- sys-utils/chcpu.c | 18 +++++----- sys-utils/eject.c | 4 +-- sys-utils/fallocate.c | 26 +++++++------- sys-utils/flock.c | 2 +- sys-utils/fsfreeze.c | 10 +++--- sys-utils/fstrim.c | 16 ++++----- sys-utils/hwclock.c | 66 +++++++++++++++++------------------ sys-utils/losetup.c | 44 ++++++++++++------------ sys-utils/lscpu.c | 24 ++++++------- sys-utils/lsipc.c | 42 +++++++++++------------ sys-utils/mount.c | 68 ++++++++++++++++++------------------ sys-utils/mountpoint.c | 14 ++++---- sys-utils/readprofile.c | 6 ++-- sys-utils/rtcwake.c | 32 ++++++++--------- sys-utils/setpriv.c | 44 ++++++++++++------------ sys-utils/swapoff.c | 10 +++--- sys-utils/swapon.c | 32 ++++++++--------- sys-utils/tunelp.c | 22 ++++++------ sys-utils/umount.c | 34 +++++++++--------- sys-utils/unshare.c | 34 +++++++++--------- term-utils/agetty.c | 70 ++++++++++++++++++------------------- term-utils/mesg.c | 8 ++--- term-utils/setterm.c | 2 +- term-utils/wall.c | 12 +++---- text-utils/col.c | 18 +++++----- text-utils/colcrt.c | 2 +- text-utils/colrm.c | 6 ++-- text-utils/column.c | 18 +++++----- text-utils/more.c | 4 +-- text-utils/rev.c | 6 ++-- text-utils/tailf.c | 10 +++--- text-utils/ul.c | 10 +++--- 73 files changed, 655 insertions(+), 655 deletions(-) diff --git a/Documentation/boilerplate.c b/Documentation/boilerplate.c index ed2a192e7..b210cc363 100644 --- a/Documentation/boilerplate.c +++ b/Documentation/boilerplate.c @@ -61,15 +61,15 @@ int main(int argc, char **argv) OPT_OPTIONAL /* see howto-man-page.txt about short option */ }; static const struct option longopts[] = { - {"no-argument", no_argument, NULL, 'n'}, - {"required", required_argument, NULL, 'r'}, - {"xyzzy", no_argument, NULL, OPT_XYZZY}, - {"extremely-long-long-option", no_argument, NULL, 'e'}, - {"long-explanation", no_argument, NULL, 'l'}, - {"foobar", no_argument, NULL, 'f'}, - {"version", no_argument, NULL, 'V'}, - {"help", no_argument, NULL, 'h'}, - {NULL, 0, NULL, 0} + { "no-argument", no_argument, NULL, 'n' }, + { "required", required_argument, NULL, 'r' }, + { "extremely-long-long-option", no_argument, NULL, 'e' }, + { "xyzzy", no_argument, NULL, OPT_XYZZY }, + { "long-explanation", no_argument, NULL, 'l' }, + { "foobar", no_argument, NULL, 'f' }, + { "version", no_argument, NULL, 'V' }, + { "help", no_argument, NULL, 'h' }, + { NULL, 0, NULL, 0 } }; setlocale(LC_ALL, ""); diff --git a/disk-utils/addpart.c b/disk-utils/addpart.c index e003b18b5..f99e9bc9c 100644 --- a/disk-utils/addpart.c +++ b/disk-utils/addpart.c @@ -29,9 +29,9 @@ int main(int argc, char **argv) int c, fd; static const struct option longopts[] = { - {"help", no_argument, 0, 'h'}, - {"version", no_argument, 0, 'V'}, - {NULL, no_argument, 0, '0'}, + {"help", no_argument, NULL, 'h'}, + {"version", no_argument, NULL, 'V'}, + {NULL, 0, NULL, 0}, }; setlocale(LC_ALL, ""); diff --git a/disk-utils/cfdisk.c b/disk-utils/cfdisk.c index 19b62f24b..4ad52842c 100644 --- a/disk-utils/cfdisk.c +++ b/disk-utils/cfdisk.c @@ -2573,7 +2573,7 @@ int main(int argc, char *argv[]) { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, 'V' }, { "zero", no_argument, NULL, 'z' }, - { NULL, 0, 0, 0 }, + { NULL, 0, NULL, 0 }, }; setlocale(LC_ALL, ""); diff --git a/disk-utils/delpart.c b/disk-utils/delpart.c index d39401f6f..1f82b58e9 100644 --- a/disk-utils/delpart.c +++ b/disk-utils/delpart.c @@ -29,9 +29,9 @@ int main(int argc, char **argv) int c, fd; static const struct option longopts[] = { - {"help", no_argument, 0, 'h'}, - {"version", no_argument, 0, 'V'}, - {NULL, no_argument, 0, '0'}, + {"help", no_argument, NULL, 'h'}, + {"version", no_argument, NULL, 'V'}, + {NULL, 0, NULL, 0}, }; setlocale(LC_ALL, ""); diff --git a/disk-utils/fsck.c b/disk-utils/fsck.c index 68b768ea1..93296c97d 100644 --- a/disk-utils/fsck.c +++ b/disk-utils/fsck.c @@ -652,7 +652,7 @@ static int execute(const char *progname, const char *progpath, } argv[argc++] = xstrdup(fs_get_device(fs)); - argv[argc] = 0; + argv[argc] = NULL; if (verbose || noexecute) { const char *tgt = mnt_fs_get_target(fs); @@ -742,7 +742,7 @@ static struct fsck_instance *wait_one(int flags) if (noexecute) { inst = instance_list; - prev = 0; + prev = NULL; #ifdef RANDOM_DEBUG while (inst->next && (random() & 1)) { prev = inst; @@ -777,7 +777,7 @@ static struct fsck_instance *wait_one(int flags) warn(_("waitpid failed")); continue; } - for (prev = 0, inst = instance_list; + for (prev = NULL, inst = instance_list; inst; prev = inst, inst = inst->next) { if (inst->pid == pid) @@ -823,7 +823,7 @@ static struct fsck_instance *wait_one(int flags) * bit before sending the kill, to give it * time to set up the signal handler */ - if (inst2->start_time.tv_sec < time(0) + 2) { + if (inst2->start_time.tv_sec < time(NULL) + 2) { if (fork() == 0) { sleep(1); kill(inst2->pid, SIGUSR1); @@ -1029,7 +1029,7 @@ static int fs_match(struct libmnt_fs *fs, struct fs_type_compile *cmp) int n, ret = 0, checked_type = 0; char *cp; - if (cmp->list == 0 || cmp->list[0] == 0) + if (cmp->list == NULL || cmp->list[0] == NULL) return 1; for (n=0; (cp = cmp->list[n]); n++) { @@ -1175,7 +1175,7 @@ static int count_slaves(dev_t disk) if (!(dir = opendir(dirname))) return -1; - while ((dp = readdir(dir)) != 0) { + while ((dp = readdir(dir)) != NULL) { #ifdef _DIRENT_HAVE_D_TYPE if (dp->d_type != DT_UNKNOWN && dp->d_type != DT_LNK) continue; @@ -1217,7 +1217,7 @@ static int disk_already_active(struct libmnt_fs *fs) * Don't check a stacked device with any other disk too. */ if (!disk || fs_is_stacked(fs)) - return (instance_list != 0); + return (instance_list != NULL); for (inst = instance_list; inst; inst = inst->next) { dev_t idisk = fs_get_disk(inst->fs, 0); @@ -1410,7 +1410,7 @@ static void signal_cancel(int sig __attribute__((__unused__))) static void parse_argv(int argc, char *argv[]) { int i, j; - char *arg, *dev, *tmp = 0; + char *arg, *dev, *tmp = NULL; char options[128]; int opt = 0; int opts_for_fsck = 0; @@ -1422,12 +1422,12 @@ static void parse_argv(int argc, char *argv[]) */ memset(&sa, 0, sizeof(struct sigaction)); sa.sa_handler = signal_cancel; - sigaction(SIGINT, &sa, 0); - sigaction(SIGTERM, &sa, 0); + sigaction(SIGINT, &sa, NULL); + sigaction(SIGTERM, &sa, NULL); num_devices = 0; num_args = 0; - instance_list = 0; + instance_list = NULL; for (i=1; i < argc; i++) { arg = argv[i]; @@ -1534,7 +1534,7 @@ static void parse_argv(int argc, char *argv[]) serialize = 1; break; case 't': - tmp = 0; + tmp = NULL; if (fstype) usage(stderr); if (arg[j+1]) diff --git a/disk-utils/fsck.cramfs.c b/disk-utils/fsck.cramfs.c index 9e7bab898..81e17be27 100644 --- a/disk-utils/fsck.cramfs.c +++ b/disk-utils/fsck.cramfs.c @@ -220,7 +220,7 @@ static void test_crc(int start) return; } - crc = crc32(0L, Z_NULL, 0); + crc = crc32(0L, NULL, 0); buf = mmap(NULL, super.size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0); @@ -237,7 +237,7 @@ static void test_crc(int start) } if (buf != MAP_FAILED) { ((struct cramfs_super *)((unsigned char *) buf + start))->fsid.crc = - crc32(0L, Z_NULL, 0); + crc32(0L, NULL, 0); crc = crc32(crc, (unsigned char *) buf + start, super.size - start); munmap(buf, super.size); } else { @@ -255,7 +255,7 @@ static void test_crc(int start) break; if (length == 0) ((struct cramfs_super *)buf)->fsid.crc = - crc32(0L, Z_NULL, 0); + crc32(0L, NULL, 0); length += retval; if (length > (super.size - start)) { crc = crc32(crc, buf, @@ -646,12 +646,12 @@ int main(int argc, char **argv) size_t length = 0; static const struct option longopts[] = { - {"verbose", no_argument, 0, 'v'}, - {"version", no_argument, 0, 'V'}, - {"help", no_argument, 0, 'h'}, - {"blocksize", required_argument, 0, 'b'}, - {"extract", optional_argument, 0, 'x'}, - {NULL, no_argument, 0, '0'}, + {"verbose", no_argument, NULL, 'v'}, + {"version", no_argument, NULL, 'V'}, + {"help", no_argument, NULL, 'h'}, + {"blocksize", required_argument, NULL, 'b'}, + {"extract", optional_argument, NULL, 'x'}, + {NULL, 0, NULL, 0}, }; setlocale(LC_MESSAGES, ""); diff --git a/disk-utils/isosize.c b/disk-utils/isosize.c index cd8a16fc8..d3d11c921 100644 --- a/disk-utils/isosize.c +++ b/disk-utils/isosize.c @@ -190,11 +190,11 @@ int main(int argc, char **argv) long divisor = 0; static const struct option longopts[] = { - {"divisor", required_argument, 0, 'd'}, - {"sectors", no_argument, 0, 'x'}, - {"version", no_argument, 0, 'V'}, - {"help", no_argument, 0, 'h'}, - {NULL, 0, 0, 0} + {"divisor", required_argument, NULL, 'd'}, + {"sectors", no_argument, NULL, 'x'}, + {"version", no_argument, NULL, 'V'}, + {"help", no_argument, NULL, 'h'}, + {NULL, 0, NULL, 0} }; setlocale(LC_ALL, ""); diff --git a/disk-utils/mkfs.cramfs.c b/disk-utils/mkfs.cramfs.c index 3c7d0f599..f277aaf23 100644 --- a/disk-utils/mkfs.cramfs.c +++ b/disk-utils/mkfs.cramfs.c @@ -302,7 +302,7 @@ static unsigned int parse_directory(struct entry *root_entry, const char *name, endpath++; /* read in the directory and sort */ - dircount = scandir(name, &dirlist, 0, cramsort); + dircount = scandir(name, &dirlist, NULL, cramsort); if (dircount < 0) err(MKFS_EX_ERROR, _("could not read directory %s"), name); @@ -412,7 +412,7 @@ static unsigned int write_superblock(struct entry *root, char *base, int size) super->size = size; memcpy(super->signature, CRAMFS_SIGNATURE, sizeof(super->signature)); - super->fsid.crc = crc32(0L, Z_NULL, 0); + super->fsid.crc = crc32(0L, NULL, 0); super->fsid.edition = opt_edition; super->fsid.blocks = total_blocks; super->fsid.files = total_nodes; @@ -706,7 +706,7 @@ int main(int argc, char **argv) loff_t fslen_ub = sizeof(struct cramfs_super); unsigned int fslen_max; char const *dirname, *outfile; - uint32_t crc = crc32(0L, Z_NULL, 0); + uint32_t crc = crc32(0L, NULL, 0); int c; cramfs_is_big_endian = HOST_IS_BIG_ENDIAN; /* default is to use host order */ diff --git a/disk-utils/mkswap.c b/disk-utils/mkswap.c index b367117dd..ea93f9b3a 100644 --- a/disk-utils/mkswap.c +++ b/disk-utils/mkswap.c @@ -352,15 +352,15 @@ int main(int argc, char **argv) uuid_t uuid_dat; #endif static const struct option longopts[] = { - { "check", no_argument, 0, 'c' }, - { "force", no_argument, 0, 'f' }, - { "pagesize", required_argument, 0, 'p' }, - { "label", required_argument, 0, 'L' }, - { "swapversion", required_argument, 0, 'v' }, - { "uuid", required_argument, 0, 'U' }, - { "version", no_argument, 0, 'V' }, - { "help", no_argument, 0, 'h' }, - { NULL, 0, 0, 0 } + { "check", no_argument, NULL, 'c' }, + { "force", no_argument, NULL, 'f' }, + { "pagesize", required_argument, NULL, 'p' }, + { "label", required_argument, NULL, 'L' }, + { "swapversion", required_argument, NULL, 'v' }, + { "uuid", required_argument, NULL, 'U' }, + { "version", no_argument, NULL, 'V' }, + { "help", no_argument, NULL, 'h' }, + { NULL, 0, NULL, 0 } }; setlocale(LC_ALL, ""); diff --git a/disk-utils/raw.c b/disk-utils/raw.c index 77945bc0f..d5c2a681f 100644 --- a/disk-utils/raw.c +++ b/disk-utils/raw.c @@ -100,11 +100,11 @@ int main(int argc, char *argv[]) struct stat statbuf; static const struct option longopts[] = { - {"query", no_argument, 0, 'q'}, - {"all", no_argument, 0, 'a'}, - {"version", no_argument, 0, 'V'}, - {"help", no_argument, 0, 'h'}, - {NULL, no_argument, 0, '0'}, + {"query", no_argument, NULL, 'q'}, + {"all", no_argument, NULL, 'a'}, + {"version", no_argument, NULL, 'V'}, + {"help", no_argument, NULL, 'h'}, + {NULL, 0, NULL, '0'}, }; setlocale(LC_ALL, ""); diff --git a/disk-utils/resizepart.c b/disk-utils/resizepart.c index 5c6c0497a..97533e26f 100644 --- a/disk-utils/resizepart.c +++ b/disk-utils/resizepart.c @@ -70,9 +70,9 @@ int main(int argc, char **argv) uint64_t start; static const struct option longopts[] = { - {"help", no_argument, 0, 'h'}, - {"version", no_argument, 0, 'V'}, - {NULL, no_argument, 0, '0'}, + {"help", no_argument, NULL, 'h'}, + {"version", no_argument, NULL, 'V'}, + {NULL, 0, NULL, '0'}, }; setlocale(LC_ALL, ""); diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c index cf6d96df5..b304acb53 100644 --- a/disk-utils/sfdisk.c +++ b/disk-utils/sfdisk.c @@ -1980,7 +1980,7 @@ int main(int argc, char *argv[]) { "id", no_argument, NULL, 'c' }, /* deprecated */ { "print-id",no_argument, NULL, OPT_PRINT_ID }, /* deprecated */ - { NULL, 0, 0, 0 }, + { NULL, 0, NULL, 0 }, }; setlocale(LC_ALL, ""); diff --git a/disk-utils/swaplabel.c b/disk-utils/swaplabel.c index 046efb495..233f027d1 100644 --- a/disk-utils/swaplabel.c +++ b/disk-utils/swaplabel.c @@ -137,11 +137,11 @@ int main(int argc, char *argv[]) int c, rc = -1; static const struct option longopts[] = { - { "help", 0, 0, 'h' }, - { "version", 0, 0, 'V' }, - { "label", 1, 0, 'L' }, - { "uuid", 1, 0, 'U' }, - { NULL, 0, 0, 0 } + { "help", no_argument, NULL, 'h' }, + { "version", no_argument, NULL, 'V' }, + { "label", required_argument, NULL, 'L' }, + { "uuid", required_argument, NULL, 'U' }, + { NULL, 0, NULL, 0 } }; setlocale(LC_ALL, ""); diff --git a/include/pt-mbr-partnames.h b/include/pt-mbr-partnames.h index 9e6da030c..223fa4967 100644 --- a/include/pt-mbr-partnames.h +++ b/include/pt-mbr-partnames.h @@ -106,4 +106,4 @@ {0xfe, N_("LANstep")}, /* SpeedStor >1024 cyl. or LANstep */ {0xff, N_("BBT")}, /* Xenix Bad Block Table */ - { 0, 0 } + { 0, NULL } diff --git a/lib/randutils.c b/lib/randutils.c index a835ff345..72ca550be 100644 --- a/lib/randutils.c +++ b/lib/randutils.c @@ -59,7 +59,7 @@ static void crank_random(void) int i; struct timeval tv; - gettimeofday(&tv, 0); + gettimeofday(&tv, NULL); srand((getpid() << 16) ^ getuid() ^ tv.tv_sec ^ tv.tv_usec); #ifdef DO_JRAND_MIX @@ -68,7 +68,7 @@ static void crank_random(void) ul_jrand_seed[2] = (tv.tv_sec ^ tv.tv_usec) >> 16; #endif /* Crank the random number generator a few times */ - gettimeofday(&tv, 0); + gettimeofday(&tv, NULL); for (i = (tv.tv_sec ^ tv.tv_usec) & 0x1F; i > 0; i--) rand(); } diff --git a/lib/timer.c b/lib/timer.c index 62656932a..05fbd92f5 100644 --- a/lib/timer.c +++ b/lib/timer.c @@ -31,7 +31,7 @@ int setup_timer(timer_t * t_id, struct itimerval *timeout, sig_a.sa_flags = SA_SIGINFO; sig_a.sa_sigaction = timeout_handler; - if (sigaction(SIGALRM, &sig_a, 0)) + if (sigaction(SIGALRM, &sig_a, NULL)) return 1; if (timer_create(CLOCK_MONOTONIC, &sig_e, t_id)) return 1; diff --git a/libblkid/src/dev.c b/libblkid/src/dev.c index fddc7354c..046cdce1b 100644 --- a/libblkid/src/dev.c +++ b/libblkid/src/dev.c @@ -141,8 +141,8 @@ blkid_dev_iterate blkid_dev_iterate_begin(blkid_cache cache) iter->magic = DEV_ITERATE_MAGIC; iter->cache = cache; iter->p = cache->bic_devs.next; - iter->search_type = 0; - iter->search_value = 0; + iter->search_type = NULL; + iter->search_value = NULL; } return iter; } @@ -181,7 +181,7 @@ int blkid_dev_next(blkid_dev_iterate iter, if (!ret_dev || !iter || iter->magic != DEV_ITERATE_MAGIC) return -1; - *ret_dev = 0; + *ret_dev = NULL; while (iter->p != &iter->cache->bic_devs) { dev = list_entry(iter->p, struct blkid_struct_dev, bid_devs); iter->p = iter->p->next; diff --git a/libblkid/src/devname.c b/libblkid/src/devname.c index 2dd6067af..ba3c57a41 100644 --- a/libblkid/src/devname.c +++ b/libblkid/src/devname.c @@ -201,7 +201,7 @@ static void probe_one(blkid_cache cache, const char *ptname, dev = blkid_verify(cache, tmp); if (dev && (dev->bid_flags & BLKID_BID_FL_VERIFIED)) break; - dev = 0; + dev = NULL; } } if (dev && dev->bid_devno == devno) @@ -213,7 +213,7 @@ static void probe_one(blkid_cache cache, const char *ptname, if (!strncmp(ptname, "dm-", 3) && isdigit(ptname[3])) { devname = canonicalize_dm_name(ptname); if (!devname) - blkid__scan_dir("/dev/mapper", devno, 0, &devname); + blkid__scan_dir("/dev/mapper", devno, NULL, &devname); if (devname) goto get_dev; } @@ -243,7 +243,7 @@ static void probe_one(blkid_cache cache, const char *ptname, } /* Do a short-cut scan of /dev/mapper first */ if (!devname) - blkid__scan_dir("/dev/mapper", devno, 0, &devname); + blkid__scan_dir("/dev/mapper", devno, NULL, &devname); if (!devname) { devname = blkid_devno_to_devname(devno); if (!devname) @@ -449,7 +449,7 @@ static int probe_all(blkid_cache cache, int only_if_new) { FILE *proc; char line[1024]; - char ptname0[128 + 1], ptname1[128 + 1], *ptname = 0; + char ptname0[128 + 1], ptname1[128 + 1], *ptname = NULL; char *ptnames[2]; dev_t devs[2]; int ma, mi; @@ -465,7 +465,7 @@ static int probe_all(blkid_cache cache, int only_if_new) return -BLKID_ERR_PARAM; if (cache->bic_flags & BLKID_BIC_FL_PROBED && - time(0) - cache->bic_time < BLKID_PROBE_INTERVAL) + time(NULL) - cache->bic_time < BLKID_PROBE_INTERVAL) return 0; blkid_read_cache(cache); @@ -623,7 +623,7 @@ int blkid_probe_all(blkid_cache cache) DBG(PROBE, ul_debug("Begin blkid_probe_all()")); ret = probe_all(cache, 0); if (ret == 0) { - cache->bic_time = time(0); + cache->bic_time = time(NULL); cache->bic_flags |= BLKID_BIC_FL_PROBED; } DBG(PROBE, ul_debug("End blkid_probe_all() [rc=%d]", ret)); diff --git a/libblkid/src/read.c b/libblkid/src/read.c index 42867735f..89adf1167 100644 --- a/libblkid/src/read.c +++ b/libblkid/src/read.c @@ -320,14 +320,14 @@ static int parse_tag(blkid_cache cache, blkid_dev dev, char **cp) /* Some tags are stored directly in the device struct */ if (!strcmp(name, "DEVNO")) - dev->bid_devno = strtoull(value, 0, 0); + dev->bid_devno = strtoull(value, NULL, 0); else if (!strcmp(name, "PRI")) - dev->bid_pri = strtol(value, 0, 0); + dev->bid_pri = strtol(value, NULL, 0); else if (!strcmp(name, "TIME")) { char *end = NULL; dev->bid_time = strtoull(value, &end, 0); if (end && *end == '.') - dev->bid_utime = strtoull(end + 1, 0, 0); + dev->bid_utime = strtoull(end + 1, NULL, 0); } else ret = blkid_set_tag(dev, name, value, strlen(value)); diff --git a/libblkid/src/resolve.c b/libblkid/src/resolve.c index f5fc33666..641b02286 100644 --- a/libblkid/src/resolve.c +++ b/libblkid/src/resolve.c @@ -60,7 +60,7 @@ char *blkid_get_devname(blkid_cache cache, const char *token, { blkid_dev dev; blkid_cache c = cache; - char *t = 0, *v = 0; + char *t = NULL, *v = NULL; char *ret = NULL; if (!token) diff --git a/libblkid/src/superblocks/vfat.c b/libblkid/src/superblocks/vfat.c index cb8656067..a8186358b 100644 --- a/libblkid/src/superblocks/vfat.c +++ b/libblkid/src/superblocks/vfat.c @@ -299,7 +299,7 @@ static int probe_vfat(blkid_probe pr, const struct blkid_idmag *mag) { struct vfat_super_block *vs; struct msdos_super_block *ms; - const unsigned char *vol_label = 0; + const unsigned char *vol_label = NULL; unsigned char *vol_serno = NULL, vol_label_buf[11]; uint16_t sector_size = 0, reserved; uint32_t cluster_count, fat_size; diff --git a/libblkid/src/tag.c b/libblkid/src/tag.c index f07d058f8..f6b67f66e 100644 --- a/libblkid/src/tag.c +++ b/libblkid/src/tag.c @@ -109,9 +109,9 @@ static blkid_tag blkid_find_head_cache(blkid_cache cache, const char *type) int blkid_set_tag(blkid_dev dev, const char *name, const char *value, const int vlength) { - blkid_tag t = 0, head = 0; - char *val = 0; - char **dev_var = 0; + blkid_tag t = NULL, head = NULL; + char *val = NULL; + char **dev_var = NULL; if (value && !(val = strndup(value, vlength))) return -BLKID_ERR_MEM; @@ -295,8 +295,8 @@ int blkid_tag_next(blkid_tag_iterate iter, iter->p == &iter->dev->bid_tags) return -1; - *type = 0; - *value = 0; + *type = NULL; + *value = NULL; tag = list_entry(iter->p, struct blkid_struct_tag, bit_tags); *type = tag->bit_name; *value = tag->bit_val; @@ -337,7 +337,7 @@ blkid_dev blkid_find_dev_with_tag(blkid_cache cache, try_again: pri = -1; - dev = 0; + dev = NULL; head = blkid_find_head_cache(cache, type); if (head) { diff --git a/libblkid/src/verify.c b/libblkid/src/verify.c index 06f6d53d5..412eb66ba 100644 --- a/libblkid/src/verify.c +++ b/libblkid/src/verify.c @@ -69,7 +69,7 @@ blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev) if (!dev || !cache) return NULL; - now = time(0); + now = time(NULL); diff = now - dev->bid_time; if (stat(dev->bid_name, &st) < 0) { @@ -172,7 +172,7 @@ blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev) dev->bid_utime = tv.tv_usec; } else #endif - dev->bid_time = time(0); + dev->bid_time = time(NULL); dev->bid_devno = st.st_rdev; dev->bid_flags |= BLKID_BID_FL_VERIFIED; diff --git a/libfdisk/src/bsd.c b/libfdisk/src/bsd.c index 62e4634b6..0a2563dde 100644 --- a/libfdisk/src/bsd.c +++ b/libfdisk/src/bsd.c @@ -43,7 +43,7 @@ static const char *bsd_dktypenames[] = { "HP-FL", "type 9", "floppy", - 0 + NULL }; #define BSD_DKMAXTYPES (ARRAY_SIZE(bsd_dktypenames) - 1) diff --git a/libmount/python/context.c b/libmount/python/context.c index 8256e87c9..6d82e1432 100644 --- a/libmount/python/context.c +++ b/libmount/python/context.c @@ -1179,38 +1179,38 @@ PyTypeObject ContextType = { sizeof(ContextObjext), /*tp_basicsize*/ 0, /*tp_itemsize*/ (destructor)Context_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ + NULL, /*tp_print*/ + NULL, /*tp_getattr*/ + NULL, /*tp_setattr*/ + NULL, /*tp_compare*/ (reprfunc) Context_repr, - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ + NULL, /*tp_as_number*/ + NULL, /*tp_as_sequence*/ + NULL, /*tp_as_mapping*/ + NULL, /*tp_hash */ + NULL, /*tp_call*/ + NULL, /*tp_str*/ + NULL, /*tp_getattro*/ + NULL, /*tp_setattro*/ + NULL, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ Context_HELP, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ + NULL, /* tp_traverse */ + NULL, /* tp_clear */ + NULL, /* tp_richcompare */ 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ + NULL, /* tp_iter */ + NULL, /* tp_iternext */ Context_methods, /* tp_methods */ Context_members, /* tp_members */ Context_getseters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ + NULL, /* tp_base */ + NULL, /* tp_dict */ + NULL, /* tp_descr_get */ + NULL, /* tp_descr_set */ 0, /* tp_dictoffset */ (initproc)Context_init, /* tp_init */ - 0, /* tp_alloc */ + NULL, /* tp_alloc */ Context_new, /* tp_new */ }; diff --git a/libmount/python/fs.c b/libmount/python/fs.c index ca1ce2ada..872a9f29e 100644 --- a/libmount/python/fs.c +++ b/libmount/python/fs.c @@ -803,38 +803,38 @@ PyTypeObject FsType = { sizeof(FsObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ (destructor)Fs_destructor, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ + NULL, /*tp_print*/ + NULL, /*tp_getattr*/ + NULL, /*tp_setattr*/ + NULL, /*tp_compare*/ (reprfunc)Fs_repr, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ + NULL, /*tp_as_number*/ + NULL, /*tp_as_sequence*/ + NULL, /*tp_as_mapping*/ + NULL, /*tp_hash */ + NULL, /*tp_call*/ + NULL, /*tp_str*/ + NULL, /*tp_getattro*/ + NULL, /*tp_setattro*/ + NULL, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ Fs_HELP, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ + NULL, /* tp_traverse */ + NULL, /* tp_clear */ + NULL, /* tp_richcompare */ 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ + NULL, /* tp_iter */ + NULL, /* tp_iternext */ Fs_methods, /* tp_methods */ Fs_members, /* tp_members */ Fs_getseters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ + NULL, /* tp_base */ + NULL, /* tp_dict */ + NULL, /* tp_descr_get */ + NULL, /* tp_descr_set */ 0, /* tp_dictoffset */ (initproc)Fs_init, /* tp_init */ - 0, /* tp_alloc */ + NULL, /* tp_alloc */ Fs_new, /* tp_new */ }; diff --git a/libmount/python/pylibmount.c b/libmount/python/pylibmount.c index 61dace7d4..a2e128684 100644 --- a/libmount/python/pylibmount.c +++ b/libmount/python/pylibmount.c @@ -210,7 +210,7 @@ PyMODINIT_FUNC initpylibmount(void) pylibmount_debug_mask = 0; if (str) - pylibmount_debug_mask = strtoul(str, 0, 0); + pylibmount_debug_mask = strtoul(str, NULL, 0); pylibmount_debug_mask |= PYMNT_DEBUG_INIT; } diff --git a/libmount/python/tab.c b/libmount/python/tab.c index a77c5cb0c..5fb7140d9 100644 --- a/libmount/python/tab.c +++ b/libmount/python/tab.c @@ -733,38 +733,38 @@ PyTypeObject TableType = { sizeof(TableObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ (destructor)Table_destructor, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ + NULL, /*tp_print*/ + NULL, /*tp_getattr*/ + NULL, /*tp_setattr*/ + NULL, /*tp_compare*/ (reprfunc) Table_repr, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ + NULL, /*tp_as_number*/ + NULL, /*tp_as_sequence*/ + NULL, /*tp_as_mapping*/ + NULL, /*tp_hash */ + NULL, /*tp_call*/ + NULL, /*tp_str*/ + NULL, /*tp_getattro*/ + NULL, /*tp_setattro*/ + NULL, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ Table_HELP, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ + NULL, /* tp_traverse */ + NULL, /* tp_clear */ + NULL, /* tp_richcompare */ 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ + NULL, /* tp_iter */ + NULL, /* tp_iternext */ Table_methods, /* tp_methods */ Table_members, /* tp_members */ Table_getseters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ + NULL, /* tp_base */ + NULL, /* tp_dict */ + NULL, /* tp_descr_get */ + NULL, /* tp_descr_set */ 0, /* tp_dictoffset */ (initproc)Table_init, /* tp_init */ - 0, /* tp_alloc */ + NULL, /* tp_alloc */ Table_new, /* tp_new */ }; diff --git a/libuuid/src/gen_uuid.c b/libuuid/src/gen_uuid.c index 6d2194ee4..21e361293 100644 --- a/libuuid/src/gen_uuid.c +++ b/libuuid/src/gen_uuid.c @@ -275,12 +275,12 @@ static int get_clock(uint32_t *clock_high, uint32_t *clock_low, if ((last.tv_sec == 0) && (last.tv_usec == 0)) { random_get_bytes(&clock_seq, sizeof(clock_seq)); clock_seq &= 0x3FFF; - gettimeofday(&last, 0); + gettimeofday(&last, NULL); last.tv_sec--; } try_again: - gettimeofday(&tv, 0); + gettimeofday(&tv, NULL); if ((tv.tv_sec < last.tv_sec) || ((tv.tv_sec == last.tv_sec) && (tv.tv_usec < last.tv_usec))) { @@ -446,7 +446,7 @@ static int uuid_generate_time_generic(uuid_t out) { time_t now; if (num > 0) { - now = time(0); + now = time(NULL); if (now > last_time+1) num = 0; } @@ -454,7 +454,7 @@ static int uuid_generate_time_generic(uuid_t out) { num = 1000; if (get_uuid_via_daemon(UUIDD_OP_BULK_TIME_UUID, out, &num) == 0) { - last_time = time(0); + last_time = time(NULL); uuid_unpack(out, &uu); num--; return 0; @@ -477,7 +477,7 @@ static int uuid_generate_time_generic(uuid_t out) { return 0; #endif - return __uuid_generate_time(out, 0); + return __uuid_generate_time(out, NULL); } /* diff --git a/login-utils/chfn.c b/login-utils/chfn.c index 7f00f79a3..faddd89a7 100644 --- a/login-utils/chfn.c +++ b/login-utils/chfn.c @@ -133,13 +133,13 @@ static void parse_argv(struct chfn_control *ctl, int argc, char **argv) { int index, c, status = 0; static const struct option long_options[] = { - {"full-name", required_argument, 0, 'f'}, - {"office", required_argument, 0, 'o'}, - {"office-phone", required_argument, 0, 'p'}, - {"home-phone", required_argument, 0, 'h'}, - {"help", no_argument, 0, 'u'}, - {"version", no_argument, 0, 'v'}, - {NULL, no_argument, 0, '0'}, + { "full-name", required_argument, NULL, 'f' }, + { "office", required_argument, NULL, 'o' }, + { "office-phone", required_argument, NULL, 'p' }, + { "home-phone", required_argument, NULL, 'h' }, + { "help", no_argument, NULL, 'u' }, + { "version", no_argument, NULL, 'v' }, + { NULL, 0, NULL, 0 }, }; while ((c = getopt_long(argc, argv, "f:r:p:h:o:uv", long_options, diff --git a/login-utils/chsh.c b/login-utils/chsh.c index c7defd49f..979a287fe 100644 --- a/login-utils/chsh.c +++ b/login-utils/chsh.c @@ -129,11 +129,11 @@ static int get_shell_list(const char *shell_name) static void parse_argv(int argc, char **argv, struct sinfo *pinfo) { static const struct option long_options[] = { - {"shell", required_argument, 0, 's'}, - {"list-shells", no_argument, 0, 'l'}, - {"help", no_argument, 0, 'h'}, - {"version", no_argument, 0, 'v'}, - {NULL, no_argument, 0, '0'}, + {"shell", required_argument, NULL, 's'}, + {"list-shells", no_argument, NULL, 'l'}, + {"help", no_argument, NULL, 'h'}, + {"version", no_argument, NULL, 'v'}, + {NULL, 0, NULL, 0}, }; int c; @@ -227,7 +227,7 @@ int main(int argc, char **argv) char *oldshell; int nullshell = 0; const uid_t uid = getuid(); - struct sinfo info = { 0 }; + struct sinfo info = { NULL }; struct passwd *pw; sanitize_env(); diff --git a/login-utils/nologin.c b/login-utils/nologin.c index cd62c3677..2e897cc72 100644 --- a/login-utils/nologin.c +++ b/login-utils/nologin.c @@ -41,9 +41,9 @@ int main(int argc, char *argv[]) int c, fd; struct stat st; static const struct option longopts[] = { - { "help", 0, 0, 'h' }, - { "version", 0, 0, 'V' }, - { NULL, 0, 0, 0 } + { "help", 0, NULL, 'h' }, + { "version", 0, NULL, 'V' }, + { NULL, 0, NULL, 0 } }; setlocale(LC_ALL, ""); diff --git a/login-utils/su-common.c b/login-utils/su-common.c index 696adc888..41f2b1cea 100644 --- a/login-utils/su-common.c +++ b/login-utils/su-common.c @@ -793,8 +793,8 @@ su_main (int argc, char **argv, int mode) {"group", required_argument, NULL, 'g'}, {"supp-group", required_argument, NULL, 'G'}, {"user", required_argument, NULL, 'u'}, /* runuser only */ - {"help", no_argument, 0, 'h'}, - {"version", no_argument, 0, 'V'}, + {"help", no_argument, NULL, 'h'}, + {"version", no_argument, NULL, 'V'}, {NULL, 0, NULL, 0} }; diff --git a/login-utils/sulogin.c b/login-utils/sulogin.c index 5b8712bfe..b1e8c90f4 100644 --- a/login-utils/sulogin.c +++ b/login-utils/sulogin.c @@ -840,12 +840,12 @@ int main(int argc, char **argv) pid_t pid; static const struct option longopts[] = { - { "login-shell", 0, 0, 'p' }, - { "timeout", 1, 0, 't' }, - { "force", 0, 0, 'e' }, - { "help", 0, 0, 'h' }, - { "version", 0, 0, 'V' }, - { NULL, 0, 0, 0 } + { "login-shell", no_argument, NULL, 'p' }, + { "timeout", required_argument, NULL, 't' }, + { "force", no_argument, NULL, 'e' }, + { "help", no_argument, NULL, 'h' }, + { "version", no_argument, NULL, 'V' }, + { NULL, 0, NULL, 0 } }; INIT_LIST_HEAD(&consoles); diff --git a/login-utils/utmpdump.c b/login-utils/utmpdump.c index 8e4839346..02e13ea88 100644 --- a/login-utils/utmpdump.c +++ b/login-utils/utmpdump.c @@ -329,12 +329,12 @@ int main(int argc, char **argv) const char *filename = NULL; static const struct option longopts[] = { - { "follow", 0, 0, 'f' }, - { "reverse", 0, 0, 'r' }, - { "output", required_argument, 0, 'o' }, - { "help", 0, 0, 'h' }, - { "version", 0, 0, 'V' }, - { NULL, 0, 0, 0 } + { "follow", no_argument, NULL, 'f' }, + { "reverse", no_argument, NULL, 'r' }, + { "output", required_argument, NULL, 'o' }, + { "help", no_argument, NULL, 'h' }, + { "version", no_argument, NULL, 'V' }, + { NULL, 0, NULL, 0 } }; setlocale(LC_ALL, ""); diff --git a/misc-utils/cal.c b/misc-utils/cal.c index a7a5bbc78..68c2a3da9 100644 --- a/misc-utils/cal.c +++ b/misc-utils/cal.c @@ -542,7 +542,7 @@ static void init_monthnames(struct cal_control *ctl) { size_t i; - if (ctl->full_month[0] != '\0') + if (ctl->full_month[0] != NULL) return; /* already initialized */ for (i = 0; i < MONTHS_IN_YEAR; i++) @@ -553,7 +553,7 @@ static void init_abbr_monthnames(struct cal_control *ctl) { size_t i; - if (ctl->abbr_month[0] != '\0') + if (ctl->abbr_month[0] != NULL) return; /* already initialized */ for (i = 0; i < MONTHS_IN_YEAR; i++) diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c index 0de8c92a3..b15a52b9d 100644 --- a/misc-utils/findmnt.c +++ b/misc-utils/findmnt.c @@ -1276,44 +1276,44 @@ int main(int argc, char *argv[]) }; static const struct option longopts[] = { - { "all", 0, 0, 'A' }, - { "ascii", 0, 0, 'a' }, - { "bytes", 0, 0, 'b' }, - { "canonicalize", 0, 0, 'c' }, - { "direction", 1, 0, 'd' }, - { "df", 0, 0, 'D' }, - { "evaluate", 0, 0, 'e' }, - { "first-only", 0, 0, 'f' }, - { "fstab", 0, 0, 's' }, - { "help", 0, 0, 'h' }, - { "invert", 0, 0, 'i' }, - { "json", 0, 0, 'J' }, - { "kernel", 0, 0, 'k' }, - { "list", 0, 0, 'l' }, - { "mountpoint", 1, 0, 'M' }, - { "mtab", 0, 0, 'm' }, - { "noheadings", 0, 0, 'n' }, - { "notruncate", 0, 0, 'u' }, - { "options", 1, 0, 'O' }, - { "output", 1, 0, 'o' }, - { "poll", 2, 0, 'p' }, - { "pairs", 0, 0, 'P' }, - { "raw", 0, 0, 'r' }, - { "types", 1, 0, 't' }, - { "nocanonicalize", 0, 0, 'C' }, - { "nofsroot", 0, 0, 'v' }, - { "submounts", 0, 0, 'R' }, - { "source", 1, 0, 'S' }, - { "tab-file", 1, 0, 'F' }, - { "task", 1, 0, 'N' }, - { "target", 1, 0, 'T' }, - { "timeout", 1, 0, 'w' }, - { "uniq", 0, 0, 'U' }, - { "verify", 0, 0, 'x' }, - { "version", 0, 0, 'V' }, - { "verbose", 0, 0, FINDMNT_OPT_VERBOSE }, - { "tree", 0, 0, FINDMNT_OPT_TREE }, - { NULL, 0, 0, 0 } + { "all", no_argument, NULL, 'A' }, + { "ascii", no_argument, NULL, 'a' }, + { "bytes", no_argument, NULL, 'b' }, + { "canonicalize", no_argument, NULL, 'c' }, + { "direction", required_argument, NULL, 'd' }, + { "df", no_argument, NULL, 'D' }, + { "evaluate", no_argument, NULL, 'e' }, + { "first-only", no_argument, NULL, 'f' }, + { "fstab", no_argument, NULL, 's' }, + { "help", no_argument, NULL, 'h' }, + { "invert", no_argument, NULL, 'i' }, + { "json", no_argument, NULL, 'J' }, + { "kernel", no_argument, NULL, 'k' }, + { "list", no_argument, NULL, 'l' }, + { "mountpoint", required_argument, NULL, 'M' }, + { "mtab", no_argument, NULL, 'm' }, + { "noheadings", no_argument, NULL, 'n' }, + { "notruncate", no_argument, NULL, 'u' }, + { "options", required_argument, NULL, 'O' }, + { "output", required_argument, NULL, 'o' }, + { "poll", optional_argument, NULL, 'p' }, + { "pairs", no_argument, NULL, 'P' }, + { "raw", no_argument, NULL, 'r' }, + { "types", required_argument, NULL, 't' }, + { "nocanonicalize", no_argument, NULL, 'C' }, + { "nofsroot", no_argument, NULL, 'v' }, + { "submounts", no_argument, NULL, 'R' }, + { "source", required_argument, NULL, 'S' }, + { "tab-file", required_argument, NULL, 'F' }, + { "task", required_argument, NULL, 'N' }, + { "target", required_argument, NULL, 'T' }, + { "timeout", required_argument, NULL, 'w' }, + { "uniq", no_argument, NULL, 'U' }, + { "verify", no_argument, NULL, 'x' }, + { "version", no_argument, NULL, 'V' }, + { "verbose", no_argument, NULL, FINDMNT_OPT_VERBOSE }, + { "tree", no_argument, NULL, FINDMNT_OPT_TREE }, + { NULL, 0, NULL, 0 } }; static const ul_excl_t excl[] = { /* rows and cols in ASCII order */ diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c index 647506b40..5f8a02e8c 100644 --- a/misc-utils/lsblk.c +++ b/misc-utils/lsblk.c @@ -448,7 +448,7 @@ static int is_active_swap(const char *filename) mnt_table_parse_swaps(swaps, NULL); } - return mnt_table_find_srcpath(swaps, filename, MNT_ITER_BACKWARD) != 0; + return mnt_table_find_srcpath(swaps, filename, MNT_ITER_BACKWARD) != NULL; } static char *get_device_mountpoint(struct blkdev_cxt *cxt) @@ -1257,7 +1257,7 @@ static int list_partitions(struct blkdev_cxt *wholedisk_cxt, struct blkdev_cxt * { DIR *dir; struct dirent *d; - struct blkdev_cxt part_cxt = { 0 }; + struct blkdev_cxt part_cxt = { NULL }; int r = -1; assert(wholedisk_cxt); @@ -1360,7 +1360,7 @@ static int list_deps(struct blkdev_cxt *cxt) { DIR *dir; struct dirent *d; - struct blkdev_cxt dep = { 0 }; + struct blkdev_cxt dep = { NULL }; const char *depname; assert(cxt); @@ -1421,7 +1421,7 @@ static int iterate_block_devices(void) { DIR *dir; struct dirent *d; - struct blkdev_cxt cxt = { 0 }; + struct blkdev_cxt cxt = { NULL }; if (!(dir = opendir(_PATH_SYS_BLOCK))) return -errno; @@ -1475,7 +1475,7 @@ static char *devno_to_sysfs_name(dev_t devno, char *devname, char *buf, size_t b static int process_one_device(char *devname) { - struct blkdev_cxt parent = { 0 }, cxt = { 0 }; + struct blkdev_cxt parent = { NULL }, cxt = { NULL }; struct stat st; char buf[PATH_MAX + 1], *name = NULL, *diskname = NULL; dev_t disk = 0; @@ -1670,30 +1670,30 @@ int main(int argc, char *argv[]) size_t i; static const struct option longopts[] = { - { "all", 0, 0, 'a' }, - { "bytes", 0, 0, 'b' }, - { "nodeps", 0, 0, 'd' }, - { "discard", 0, 0, 'D' }, - { "help", 0, 0, 'h' }, - { "json", 0, 0, 'J' }, - { "output", 1, 0, 'o' }, - { "output-all", 0, 0, 'O' }, - { "perms", 0, 0, 'm' }, - { "noheadings", 0, 0, 'n' }, - { "list", 0, 0, 'l' }, - { "ascii", 0, 0, 'i' }, - { "raw", 0, 0, 'r' }, - { "inverse", 0, 0, 's' }, - { "fs", 0, 0, 'f' }, - { "exclude", 1, 0, 'e' }, - { "include", 1, 0, 'I' }, - { "topology", 0, 0, 't' }, - { "paths", 0, 0, 'p' }, - { "pairs", 0, 0, 'P' }, - { "scsi", 0, 0, 'S' }, - { "sort", 1, 0, 'x' }, - { "version", 0, 0, 'V' }, - { NULL, 0, 0, 0 }, + { "all", no_argument, NULL, 'a' }, + { "bytes", no_argument, NULL, 'b' }, + { "nodeps", no_argument, NULL, 'd' }, + { "discard", no_argument, NULL, 'D' }, + { "help", no_argument, NULL, 'h' }, + { "json", no_argument, NULL, 'J' }, + { "output", required_argument, NULL, 'o' }, + { "output-all", no_argument, NULL, 'O' }, + { "perms", no_argument, NULL, 'm' }, + { "noheadings", no_argument, NULL, 'n' }, + { "list", no_argument, NULL, 'l' }, + { "ascii", no_argument, NULL, 'i' }, + { "raw", no_argument, NULL, 'r' }, + { "inverse", no_argument, NULL, 's' }, + { "fs", no_argument, NULL, 'f' }, + { "exclude", required_argument, NULL, 'e' }, + { "include", required_argument, NULL, 'I' }, + { "topology", no_argument, NULL, 't' }, + { "paths", no_argument, NULL, 'p' }, + { "pairs", no_argument, NULL, 'P' }, + { "scsi", no_argument, NULL, 'S' }, + { "sort", required_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/misc-utils/namei.c b/misc-utils/namei.c index 97e4d5674..0b0a0579c 100644 --- a/misc-utils/namei.c +++ b/misc-utils/namei.c @@ -351,15 +351,15 @@ static void usage(int rc) static const struct option longopts[] = { - { "help", 0, 0, 'h' }, - { "version", 0, 0, 'V' }, - { "mountpoints",0, 0, 'x' }, - { "modes", 0, 0, 'm' }, - { "owners", 0, 0, 'o' }, - { "long", 0, 0, 'l' }, - { "nolinks", 0, 0, 'n' }, - { "vertical", 0, 0, 'v' }, - { NULL, 0, 0, 0 }, + { "help", no_argument, NULL, 'h' }, + { "version", no_argument, NULL, 'V' }, + { "mountpoints", no_argument, NULL, 'x' }, + { "modes", no_argument, NULL, 'm' }, + { "owners", no_argument, NULL, 'o' }, + { "long", no_argument, NULL, 'l' }, + { "nolinks", no_argument, NULL, 'n' }, + { "vertical", no_argument, NULL, 'v' }, + { NULL, 0, NULL, 0 }, }; int diff --git a/misc-utils/wipefs.c b/misc-utils/wipefs.c index 441083a5a..e07ce18e3 100644 --- a/misc-utils/wipefs.c +++ b/misc-utils/wipefs.c @@ -486,17 +486,17 @@ main(int argc, char **argv) int mode = WP_MODE_PRETTY; static const struct option longopts[] = { - { "all", 0, 0, 'a' }, - { "backup", 0, 0, 'b' }, - { "force", 0, 0, 'f' }, - { "help", 0, 0, 'h' }, - { "no-act", 0, 0, 'n' }, - { "offset", 1, 0, 'o' }, - { "parsable", 0, 0, 'p' }, - { "quiet", 0, 0, 'q' }, - { "types", 1, 0, 't' }, - { "version", 0, 0, 'V' }, - { NULL, 0, 0, 0 } + { "all", no_argument, NULL, 'a' }, + { "backup", no_argument, NULL, 'b' }, + { "force", no_argument, NULL, 'f' }, + { "help", no_argument, NULL, 'h' }, + { "no-act", no_argument, NULL, 'n' }, + { "offset", required_argument, NULL, 'o' }, + { "parsable", no_argument, NULL, 'p' }, + { "quiet", no_argument, NULL, 'q' }, + { "types", required_argument, NULL, 't' }, + { "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/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; diff --git a/term-utils/agetty.c b/term-utils/agetty.c index 830128e84..8ac08f57c 100644 --- a/term-utils/agetty.c +++ b/term-utils/agetty.c @@ -628,41 +628,41 @@ static void parse_args(int argc, char **argv, struct options *op) RELOAD_OPTION, }; const struct option longopts[] = { - { "8bits", no_argument, 0, '8' }, - { "autologin", required_argument, 0, 'a' }, - { "noreset", no_argument, 0, 'c' }, - { "chdir", required_argument, 0, 'C' }, - { "delay", required_argument, 0, 'd' }, - { "remote", no_argument, 0, 'E' }, - { "issue-file", required_argument, 0, 'f' }, - { "flow-control", no_argument, 0, 'h' }, - { "host", required_argument, 0, 'H' }, - { "noissue", no_argument, 0, 'i' }, - { "init-string", required_argument, 0, 'I' }, - { "noclear", no_argument, 0, 'J' }, - { "login-program", required_argument, 0, 'l' }, - { "local-line", optional_argument, 0, 'L' }, - { "extract-baud", no_argument, 0, 'm' }, - { "skip-login", no_argument, 0, 'n' }, - { "nonewline", no_argument, 0, 'N' }, - { "login-options", required_argument, 0, 'o' }, - { "login-pause", no_argument, 0, 'p' }, - { "nice", required_argument, 0, 'P' }, - { "chroot", required_argument, 0, 'r' }, - { "hangup", no_argument, 0, 'R' }, - { "keep-baud", no_argument, 0, 's' }, - { "timeout", required_argument, 0, 't' }, - { "detect-case", no_argument, 0, 'U' }, - { "wait-cr", no_argument, 0, 'w' }, - { "nohints", no_argument, 0, NOHINTS_OPTION }, - { "nohostname", no_argument, 0, NOHOSTNAME_OPTION }, - { "long-hostname", no_argument, 0, LONGHOSTNAME_OPTION }, - { "reload", no_argument, 0, RELOAD_OPTION }, - { "version", no_argument, 0, VERSION_OPTION }, - { "help", no_argument, 0, HELP_OPTION }, - { "erase-chars", required_argument, 0, ERASE_CHARS_OPTION }, - { "kill-chars", required_argument, 0, KILL_CHARS_OPTION }, - { NULL, 0, 0, 0 } + { "8bits", no_argument, NULL, '8' }, + { "autologin", required_argument, NULL, 'a' }, + { "noreset", no_argument, NULL, 'c' }, + { "chdir", required_argument, NULL, 'C' }, + { "delay", required_argument, NULL, 'd' }, + { "remote", no_argument, NULL, 'E' }, + { "issue-file", required_argument, NULL, 'f' }, + { "flow-control", no_argument, NULL, 'h' }, + { "host", required_argument, NULL, 'H' }, + { "noissue", no_argument, NULL, 'i' }, + { "init-string", required_argument, NULL, 'I' }, + { "noclear", no_argument, NULL, 'J' }, + { "login-program", required_argument, NULL, 'l' }, + { "local-line", optional_argument, NULL, 'L' }, + { "extract-baud", no_argument, NULL, 'm' }, + { "skip-login", no_argument, NULL, 'n' }, + { "nonewline", no_argument, NULL, 'N' }, + { "login-options", required_argument, NULL, 'o' }, + { "login-pause", no_argument, NULL, 'p' }, + { "nice", required_argument, NULL, 'P' }, + { "chroot", required_argument, NULL, 'r' }, + { "hangup", no_argument, NULL, 'R' }, + { "keep-baud", no_argument, NULL, 's' }, + { "timeout", required_argument, NULL, 't' }, + { "detect-case", no_argument, NULL, 'U' }, + { "wait-cr", no_argument, NULL, 'w' }, + { "nohints", no_argument, NULL, NOHINTS_OPTION }, + { "nohostname", no_argument, NULL, NOHOSTNAME_OPTION }, + { "long-hostname", no_argument, NULL, LONGHOSTNAME_OPTION }, + { "reload", no_argument, NULL, RELOAD_OPTION }, + { "version", no_argument, NULL, VERSION_OPTION }, + { "help", no_argument, NULL, HELP_OPTION }, + { "erase-chars", required_argument, NULL, ERASE_CHARS_OPTION }, + { "kill-chars", required_argument, NULL, KILL_CHARS_OPTION }, + { NULL, 0, NULL, 0 } }; while ((c = getopt_long(argc, argv, diff --git a/term-utils/mesg.c b/term-utils/mesg.c index af9a81ebc..43835b480 100644 --- a/term-utils/mesg.c +++ b/term-utils/mesg.c @@ -93,10 +93,10 @@ int main(int argc, char *argv[]) int ch, fd, verbose = FALSE, ret; static const struct option longopts[] = { - { "verbose", no_argument, 0, 'v' }, - { "version", no_argument, 0, 'V' }, - { "help", no_argument, 0, 'h' }, - { NULL, 0, 0, 0 } + { "verbose", no_argument, NULL, 'v' }, + { "version", no_argument, NULL, 'V' }, + { "help", no_argument, NULL, 'h' }, + { NULL, 0, NULL, 0 } }; setlocale(LC_ALL, ""); diff --git a/term-utils/setterm.c b/term-utils/setterm.c index 900a9f3b1..1cf59957b 100644 --- a/term-utils/setterm.c +++ b/term-utils/setterm.c @@ -1166,7 +1166,7 @@ static void init_terminal(struct setterm_control *ctl) int main(int argc, char **argv) { - struct setterm_control ctl = { 0 }; + struct setterm_control ctl = { NULL }; setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); diff --git a/term-utils/wall.c b/term-utils/wall.c index fe72e1e1d..6dec05c12 100644 --- a/term-utils/wall.c +++ b/term-utils/wall.c @@ -182,12 +182,12 @@ int main(int argc, char **argv) int mvecsz = 0; static const struct option longopts[] = { - { "nobanner", no_argument, 0, 'n' }, - { "timeout", required_argument, 0, 't' }, - { "group", required_argument, 0, 'g' }, - { "version", no_argument, 0, 'V' }, - { "help", no_argument, 0, 'h' }, - { NULL, 0, 0, 0 } + { "nobanner", no_argument, NULL, 'n' }, + { "timeout", required_argument, NULL, 't' }, + { "group", required_argument, NULL, 'g' }, + { "version", no_argument, NULL, 'V' }, + { "help", no_argument, NULL, 'h' }, + { NULL, 0, NULL, 0 } }; setlocale(LC_ALL, ""); diff --git a/text-utils/col.c b/text-utils/col.c index 7bf3708bd..b35306e48 100644 --- a/text-utils/col.c +++ b/text-utils/col.c @@ -173,15 +173,15 @@ int main(int argc, char **argv) int ret = EXIT_SUCCESS; static const struct option longopts[] = { - { "no-backspaces", no_argument, 0, 'b' }, - { "fine", no_argument, 0, 'f' }, - { "pass", no_argument, 0, 'p' }, - { "tabs", no_argument, 0, 'h' }, - { "spaces", no_argument, 0, 'x' }, - { "lines", required_argument, 0, 'l' }, - { "version", no_argument, 0, 'V' }, - { "help", no_argument, 0, 'H' }, - { NULL, 0, 0, 0 } + { "no-backspaces", no_argument, NULL, 'b' }, + { "fine", no_argument, NULL, 'f' }, + { "pass", no_argument, NULL, 'p' }, + { "tabs", no_argument, NULL, 'h' }, + { "spaces", no_argument, NULL, 'x' }, + { "lines", required_argument, NULL, 'l' }, + { "version", no_argument, NULL, 'V' }, + { "help", no_argument, NULL, 'H' }, + { NULL, 0, NULL, 0 } }; setlocale(LC_ALL, ""); diff --git a/text-utils/colcrt.c b/text-utils/colcrt.c index 346a10fff..ff8cd4694 100644 --- a/text-utils/colcrt.c +++ b/text-utils/colcrt.c @@ -224,7 +224,7 @@ static void colcrt(struct colcrt_control *ctl) int main(int argc, char **argv) { - struct colcrt_control ctl = { 0 }; + struct colcrt_control ctl = { NULL }; int opt; enum { NO_UL_OPTION = CHAR_MAX + 1 }; diff --git a/text-utils/colrm.c b/text-utils/colrm.c index d474696e7..b2816cd07 100644 --- a/text-utils/colrm.c +++ b/text-utils/colrm.c @@ -158,9 +158,9 @@ int main(int argc, char **argv) int opt; static const struct option longopts[] = { - {"version", no_argument, 0, 'V'}, - {"help", no_argument, 0, 'h'}, - {NULL, 0, 0, 0} + {"version", no_argument, NULL, 'V'}, + {"help", no_argument, NULL, 'h'}, + {NULL, 0, NULL, 0} }; setlocale(LC_ALL, ""); diff --git a/text-utils/column.c b/text-utils/column.c index 2eb47a3ea..deeea855e 100644 --- a/text-utils/column.c +++ b/text-utils/column.c @@ -152,15 +152,15 @@ int main(int argc, char **argv) static const struct option longopts[] = { - { "columns", 1, 0, 'c' }, /* deprecated */ - { "fillrows", 0, 0, 'x' }, - { "help", 0, 0, 'h' }, - { "output-separator", 1, 0, 'o' }, - { "output-width", 1, 0, 'c' }, - { "separator", 1, 0, 's' }, - { "table", 0, 0, 't' }, - { "version", 0, 0, 'V' }, - { NULL, 0, 0, 0 }, + { "columns", required_argument, NULL, 'c' }, /* deprecated */ + { "fillrows", no_argument, NULL, 'x' }, + { "help", no_argument, NULL, 'h' }, + { "output-separator", required_argument, NULL, 'o' }, + { "output-width", required_argument, NULL, 'c' }, + { "separator", required_argument, NULL, 's' }, + { "table", no_argument, NULL, 't' }, + { "version", no_argument, NULL, 'V' }, + { NULL, 0, NULL, 0 }, }; setlocale(LC_ALL, ""); diff --git a/text-utils/more.c b/text-utils/more.c index 76ba24a17..ea881e8ed 100644 --- a/text-utils/more.c +++ b/text-utils/more.c @@ -1481,7 +1481,7 @@ void do_shell(char *filename) putsout(shell_line); else { ttyin(cmdbuf, sizeof(cmdbuf) - 2, '!'); - expanded = 0; + expanded = NULL; rc = expand(&expanded, cmdbuf); if (expanded) { if (strlen(expanded) < sizeof(shell_line)) @@ -1634,7 +1634,7 @@ void execute(char *filename, char *cmd, ...) signal(SIGQUIT, SIG_IGN); if (catch_susp) signal(SIGTSTP, SIG_DFL); - while (wait(0) > 0) ; + while (wait(NULL) > 0) ; signal(SIGINT, end_it); signal(SIGQUIT, onquit); if (catch_susp) diff --git a/text-utils/rev.c b/text-utils/rev.c index fe3884389..b4ae892f1 100644 --- a/text-utils/rev.c +++ b/text-utils/rev.c @@ -106,9 +106,9 @@ int main(int argc, char *argv[]) int ch, rval = EXIT_SUCCESS; static const struct option longopts[] = { - { "version", no_argument, 0, 'V' }, - { "help", no_argument, 0, 'h' }, - { NULL, 0, 0, 0 } + { "version", no_argument, NULL, 'V' }, + { "help", no_argument, NULL, 'h' }, + { NULL, 0, NULL, 0 } }; setlocale(LC_ALL, ""); diff --git a/text-utils/tailf.c b/text-utils/tailf.c index 9f175822c..78ead34f7 100644 --- a/text-utils/tailf.c +++ b/text-utils/tailf.c @@ -66,7 +66,7 @@ static void tailf(const char *filename, size_t lines, struct stat *st) fd = open(filename, O_RDONLY); if (fd < 0) err(EXIT_FAILURE, _("cannot open %s"), filename); - data = mmap(0, st->st_size, PROT_READ, MAP_SHARED, fd, 0); + data = mmap(NULL, st->st_size, PROT_READ, MAP_SHARED, fd, 0); i = (size_t) st->st_size - 1; /* humans do not think last new line in a file should be counted, @@ -241,10 +241,10 @@ int main(int argc, char **argv) struct stat st; static const struct option longopts[] = { - { "lines", required_argument, 0, 'n' }, - { "version", no_argument, 0, 'V' }, - { "help", no_argument, 0, 'h' }, - { NULL, 0, 0, 0 } + { "lines", required_argument, NULL, 'n' }, + { "version", no_argument, NULL, 'V' }, + { "help", no_argument, NULL, 'h' }, + { NULL, 0, NULL, 0 } }; setlocale(LC_ALL, ""); diff --git a/text-utils/ul.c b/text-utils/ul.c index 5421c24a0..de6da8178 100644 --- a/text-utils/ul.c +++ b/text-utils/ul.c @@ -157,11 +157,11 @@ int main(int argc, char **argv) FILE *f; static const struct option longopts[] = { - { "terminal", required_argument, 0, 't' }, - { "indicated", no_argument, 0, 'i' }, - { "version", no_argument, 0, 'V' }, - { "help", no_argument, 0, 'h' }, - { NULL, 0, 0, 0 } + { "terminal", required_argument, NULL, 't' }, + { "indicated", no_argument, NULL, 'i' }, + { "version", no_argument, NULL, 'V' }, + { "help", no_argument, NULL, 'h' }, + { NULL, 0, NULL, 0 } }; setlocale(LC_ALL, ""); -- cgit v1.2.3-55-g7522