]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
misc: do not use plain 0 as NULL [smatch scan]
authorSami Kerola <kerolasa@iki.fi>
Sat, 11 Feb 2017 20:23:26 +0000 (20:23 +0000)
committerKarel Zak <kzak@redhat.com>
Mon, 20 Feb 2017 11:58:49 +0000 (12:58 +0100)
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>
73 files changed:
Documentation/boilerplate.c
disk-utils/addpart.c
disk-utils/cfdisk.c
disk-utils/delpart.c
disk-utils/fsck.c
disk-utils/fsck.cramfs.c
disk-utils/isosize.c
disk-utils/mkfs.cramfs.c
disk-utils/mkswap.c
disk-utils/raw.c
disk-utils/resizepart.c
disk-utils/sfdisk.c
disk-utils/swaplabel.c
include/pt-mbr-partnames.h
lib/randutils.c
lib/timer.c
libblkid/src/dev.c
libblkid/src/devname.c
libblkid/src/read.c
libblkid/src/resolve.c
libblkid/src/superblocks/vfat.c
libblkid/src/tag.c
libblkid/src/verify.c
libfdisk/src/bsd.c
libmount/python/context.c
libmount/python/fs.c
libmount/python/pylibmount.c
libmount/python/tab.c
libuuid/src/gen_uuid.c
login-utils/chfn.c
login-utils/chsh.c
login-utils/nologin.c
login-utils/su-common.c
login-utils/sulogin.c
login-utils/utmpdump.c
misc-utils/cal.c
misc-utils/findmnt.c
misc-utils/lsblk.c
misc-utils/namei.c
misc-utils/wipefs.c
sys-utils/blkdiscard.c
sys-utils/chcpu.c
sys-utils/eject.c
sys-utils/fallocate.c
sys-utils/flock.c
sys-utils/fsfreeze.c
sys-utils/fstrim.c
sys-utils/hwclock.c
sys-utils/losetup.c
sys-utils/lscpu.c
sys-utils/lsipc.c
sys-utils/mount.c
sys-utils/mountpoint.c
sys-utils/readprofile.c
sys-utils/rtcwake.c
sys-utils/setpriv.c
sys-utils/swapoff.c
sys-utils/swapon.c
sys-utils/tunelp.c
sys-utils/umount.c
sys-utils/unshare.c
term-utils/agetty.c
term-utils/mesg.c
term-utils/setterm.c
term-utils/wall.c
text-utils/col.c
text-utils/colcrt.c
text-utils/colrm.c
text-utils/column.c
text-utils/more.c
text-utils/rev.c
text-utils/tailf.c
text-utils/ul.c

index ed2a192e7b8ed3aa8f7c107495c96c2d268978b5..b210cc363e5e7cbade3f9a51d6c6104fc94d53a6 100644 (file)
@@ -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, "");
index e003b18b5fea4ccdad13070708fded695a4c1513..f99e9bc9cd7250f35164aaad617dce2044d200e7 100644 (file)
@@ -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, "");
index 19b62f24bf01049f01b0619be5bd64609bcf35c3..4ad52842ccb5dfd9485e8fc84ce70b6dea586901 100644 (file)
@@ -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, "");
index d39401f6ff123c93f08acfaf4008e93ff81a1b92..1f82b58e9d0f8af2b62534319c18c6242d87e2ad 100644 (file)
@@ -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, "");
index 68b768ea1808fc7ce649fd0a268dba061179efdb..93296c97d615b1ab9572486953d86b2fcb2b0743 100644 (file)
@@ -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])
index 9e7bab898e5422cd613bd221c2288b805d1daa9e..81e17be27b57825adf62b3385c8e5aed3d806170 100644 (file)
@@ -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, "");
index cd8a16fc8101eb8d282318b1a512cfc197dc4aa5..d3d11c9217e3452da0f8b7a35783a7bc6f580012 100644 (file)
@@ -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, "");
index 3c7d0f599ae19729d1d01694a0fa61eeaffed0b0..f277aaf2300b52dae3beff0fed2d3bb06a56affd 100644 (file)
@@ -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 */
 
index b367117dd2c68a1ce52f65daecae57935eb91e01..ea93f9b3af1af161b6800ddb1d59ea72543e6474 100644 (file)
@@ -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, "");
index 77945bc0fcdbe94d4f850a6b8f1bcc0abd995c16..d5c2a681f102952f5d15a33957e0d58fbf388fca 100644 (file)
@@ -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, "");
index 5c6c0497a270838e2adc2881dabb4dd2115ab400..97533e26f96bdb6a6a598c978aa18fdc69cf1a8a 100644 (file)
@@ -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, "");
index cf6d96df59e7db5f6bae3ae862c491cc4da5ca51..b304acb534123328282da05181da3107e6eb7ebb 100644 (file)
@@ -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, "");
index 046efb49585d1c6afbc6fd0da34429986618043c..233f027d15413e3b52db81b3538d62a11b2e8cae 100644 (file)
@@ -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, "");
index 9e6da030c0b5d39b757cf3e7cc2759af9fd87640..223fa4967337e772d20201d6f4c12a5e11f65e77 100644 (file)
        {0xfe, N_("LANstep")},          /* SpeedStor >1024 cyl. or LANstep */
        {0xff, N_("BBT")},              /* Xenix Bad Block Table */
 
-       { 0, 0 }
+       { 0, NULL }
index a835ff345e5190720d507861a1d1d3b020108a72..72ca550be9a2b71b36e3537db9e538aa137d6771 100644 (file)
@@ -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();
 }
index 62656932ad9da1826fde491630b37bb1ca31fead..05fbd92f57adfa1ebd2b0be853937ab3f79ad2a2 100644 (file)
@@ -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;
index fddc7354c64cd34fe22b2266d523305b04bc46b1..046cdce1b3de7748f303cd2a3f882a90be9afdf5 100644 (file)
@@ -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;
index 2dd6067af7be653724335df3ad9103f91919f8a9..ba3c57a4197e1843534477fc2e4f0f0b4bfb416a 100644 (file)
@@ -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));
index 42867735ff2d11da5669202296187b79e8eceea6..89adf11672678fe010516810948b5d236eb0647c 100644 (file)
@@ -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));
 
index f5fc336665388ebddb27c81ca65b475882313188..641b02286081331d1a4023783ec5df5961a08d95 100644 (file)
@@ -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)
index cb8656067ff9774e111fe20f23532442d3a40a34..a8186358be15478a64e79a701313434dbc813570 100644 (file)
@@ -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;
index f07d058f8a472efbeecd48021290cb7ea16f4a3d..f6b67f66e22eec5d019a4054405048b59dcd89f6 100644 (file)
@@ -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) {
index 06f6d53d5c0030542049a914aac8b0bfe506dcc9..412eb66ba856611c1abad82fe5ade242f741a5c4 100644 (file)
@@ -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;
index 62e4634b6106453b4e230205676aab589c5269d4..0a2563ddeae468a60c3c32e09638d875874d4c6c 100644 (file)
@@ -43,7 +43,7 @@ static const char *bsd_dktypenames[] = {
        "HP-FL",
        "type 9",
        "floppy",
-       0
+       NULL
 };
 #define BSD_DKMAXTYPES (ARRAY_SIZE(bsd_dktypenames) - 1)
 
index 8256e87c906d5569c4b195d0301fb6603ac1eabc..6d82e14327a38c2a9d108cc2fd829102813140a6 100644 (file)
@@ -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 */
 };
 
index ca1ce2ada0268e55fa30792a0de16617c30f6ad1..872a9f29e4874e28213197565b0c4584d662a59e 100644 (file)
@@ -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 */
 };
 
index 61dace7d44f32e7eff04dd5de86a61e8f6b6cbf2..a2e12868488f60dbc8de26bdb1af835640db5cdc 100644 (file)
@@ -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;
        }
index a77c5cb0cc28c405220ca0050e1dc76ca8e87971..5fb7140d9a4afd6e5ee6498ba9deb75918613e91 100644 (file)
@@ -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 */
 };
 
index 6d2194ee40241df347b829af34815dc7d389a1cc..21e361293e8e6f47aea5ee252b826b22ded63765 100644 (file)
@@ -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);
 }
 
 /*
index 7f00f79a37b44be935505b1f22403e89e6203ecf..faddd89a78c370ef58311f967d318484740d729b 100644 (file)
@@ -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,
index c7defd49f60fa4479cc017ede4a29ac6c86a515b..979a287fe245de38650b1912c3b4d1c1afe4617d 100644 (file)
@@ -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();
index cd62c36771eaaa836fa0165408ade55e279baeb2..2e897cc722764f52447db4500bd31ab9d3d8e5b4 100644 (file)
@@ -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, "");
index 696adc8888ad901efbb98f7878c31e4a21c4cf27..41f2b1ceaa5b6aa698becb422d4d4537acf0fe54 100644 (file)
@@ -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}
   };
 
index 5b8712bfe9fd05e3222513d62917d602a9d1fa32..b1e8c90f4c6b9abbb69e4fe56ee9ffb623282920 100644 (file)
@@ -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);
index 8e4839346705c8a73e0dbb19f10d1c3f7ced0334..02e13ea88e24a1181012f083768fd8ce842c5d57 100644 (file)
@@ -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, "");
index a7a5bbc78ea0ab096a94b4b4b72476ba420ea447..68c2a3da93e74204a7a249344f0f91e176eada61 100644 (file)
@@ -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++)
index 0de8c92a37d7e9eb3f0f32ac33e19b619abd9ead..b15a52b9d8c9e367cd1fdd1c138f427911309a17 100644 (file)
@@ -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 */
index 647506b406b092184940c294c9af98cdec6ac518..5f8a02e8c1e75ca7312e345ead7e78177f29e8b9 100644 (file)
@@ -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 */
index 97e4d567406a80311243c098673795449ce214d9..0b0a0579ccd63ccc9ea416ddfc866e54e1728611 100644 (file)
@@ -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
index 441083a5aa2ffc445f9998cd053a9822815541e0..e07ce18e3456f1995bf600ffa66c69a08231c80d 100644 (file)
@@ -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 */
index 2bfa7f85645682ca3a24ef50d18919187f8de49d..7f2db58b1f13923c69463c55448bc70f8abe3d71 100644 (file)
@@ -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, "");
index 003cf59c90bda808976f8d5c21802131a0cbbb43..30afa457ccdf86b323fd4da0baa96b95851b3ba5 100644 (file)
@@ -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 */
index 7bc68555ad29f0d8b7b9c473e805f2f6a282e4ba..7cdd2db6e2ef9537c79eaacd9316fbd009b8558d 100644 (file)
@@ -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);
index c8068082f4d3e1a78a144523b596735f3835cda1..7bbc3686501136e3dd5dcf211d30657f5ef970cb 100644 (file)
@@ -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 */
index 08e313e6960c2f14dfc34a9c886da7fda57d1a02..8af1e8ade03703830f7014ed12d961b719d16e1a 100644 (file)
@@ -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];
                }
index 294c44103aed33b7c3b33143cc87a6a5d52653e6..b1fa4fa8cbd74a53011a768f054c1f632e8d52a4 100644 (file)
@@ -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 */
index f252edba0b61724602f5d498093066cfd492654c..f42ebe77afdc71066c7f42e7f5c6c3a94d7d81d3 100644 (file)
@@ -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, "");
index 6de09fda83f1932a386bc91ad3ffb689008c58be..9fae9df235376130a74d0b0afeab5d9bb120f3cf 100644 (file)
@@ -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 */
index ad508109dce899f7163b8e5fa221ba2b53904c96..5f599ead513223f2c20a18b9b275d91b6d512cf0 100644 (file)
@@ -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 */
index f1b0348cf96f579a2f7a6f1c7df5017cf748919b..92ffba44ae7a2a11724cbfc69c92c33608b2325a 100644 (file)
@@ -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 */
index d4e5037adc8de712579b99e493448d699105e6cf..ee203e02a1eef6aa5131546788a6836b39a8acca 100644 (file)
@@ -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}
        };
 
index 0b55500f2a4aa7bd81301eac60868c04d808d65c..b09e776161948c861714aa862844dcd83803310c 100644 (file)
@@ -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 */
index f5302937b3c8ceb01a120ab25acc8c2380c152e5..ab0951f9b915df681c3b175a42df90c5df1c89b7 100644 (file)
@@ -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, "");
index 0170a72405a57674464c292b973507806d2ede91..f18fa9bf2b8497b082f9895f2e4d4d4ccd29c4ad 100644 (file)
@@ -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;
index 11f75ae9b084a6b2790ed6706dfafd1597de0e95..de0ac4d853e33e8bf5d04dc11f7126e3e77f0ed2 100644 (file)
@@ -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' },
index 897be3fd0c986249f979a78a3b293502f10f8d6e..2129115a0edc20169b2566b4d00cc827fb68467e 100644 (file)
@@ -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[] = {
index e20c502bde608abda61cb13e6379a6872177be62..aab6dfb8d9e9bcbf23acfea840eea339ac81fc29 100644 (file)
@@ -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, "");
index 0982093d5653fc77c6bd510f513da92979c5a4d8..d0ad6bb6f48ad36923acc45fe107fb0c8b1b10a4 100644 (file)
@@ -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 */
index 7b38255d6a09b920d4ef3efae8ce980ff3539103..8cfbe80a21ac0f0c2a6761b20388431ff1d75601 100644 (file)
@@ -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':
index 640e2cd0d94de2756556968a9139af08c17c1070..21f7edfed89f17349170a6db8c1cfd7263bd97ed 100644 (file)
@@ -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 */
index 0d02b70b3c80006456c217c99f6c1ddc3bd06e76..bccd75f3a1a032c3510c42685a39df6f01ba7b71 100644 (file)
@@ -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;
index 830128e841d166c883e1608965552360795cce15..8ac08f57cfd00a9f11fc1ff6bedbc413a0e9d8ca 100644 (file)
@@ -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,
index af9a81ebc9d7b3d1efce1a507b248b9a3ae05f35..43835b480bab48562e0e43f9ea8664dc5e2e5b42 100644 (file)
@@ -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, "");
index 900a9f3b1b60dd3dd5b8de6f16dd75edf13f7768..1cf59957b43e6d673fa9abae2f0c77d0f53ec453 100644 (file)
@@ -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);
index fe72e1e1dbbb82adda873db22d128b8bb5e82d03..6dec05c12b68dd43bfe37dbbcca57ff1265d72f5 100644 (file)
@@ -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, "");
index 7bf3708bd9bbaa15c1a80caf2fde0366b96ea1ee..b35306e48faaf8426265023b53f40d0aa2ac7b4c 100644 (file)
@@ -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, "");
index 346a10fff74f6f3f81473fcf640897df3bb89383..ff8cd46944ed980c91736dc7f00e656cfe33974c 100644 (file)
@@ -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 };
 
index d474696e7d67029c3b0a85df638a3cb98b9025b7..b2816cd074d6c7c5ddec06f3d49a3052f7e989b9 100644 (file)
@@ -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, "");
index 2eb47a3ea7e77646ad32a923feefb9f94f8f9ae3..deeea855e70390c7306ed1f53098acb2f83062d0 100644 (file)
@@ -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, "");
index 76ba24a17497c138e87a842cc6b46aa1884b7d3a..ea881e8ed0bc93e5572f36f84d14d176a05d393c 100644 (file)
@@ -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)
index fe3884389764698a91f6e272141ca394a9bae1a1..b4ae892f16115c6074f13b9e338bb5c6d0db966b 100644 (file)
@@ -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, "");
index 9f175822ca763d114b36f3371d46bb9d75491079..78ead34f75632b09e5201bf366f9cedd61eeb379 100644 (file)
@@ -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, "");
index 5421c24a0554091f48fd64c7b27f89f5b0c56c66..de6da81780ff74bac36ea72b53a801685eeb8a66 100644 (file)
@@ -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, "");