misc: do not use plain 0 as NULL [smatch scan]

text-utils/tailf.c:69:21: warning: Using plain integer as NULL pointer

Since many 'struct option' has used zero as NULL make them more readable in
same go by reindenting, and using named argument requirements.

Reference: https://lwn.net/Articles/93577/
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2017-02-11 20:23:26 +00:00 committed by Karel Zak
parent e948f4b616
commit 8791804065
73 changed files with 653 additions and 653 deletions

View File

@ -61,15 +61,15 @@ int main(int argc, char **argv)
OPT_OPTIONAL /* see howto-man-page.txt about short option */ OPT_OPTIONAL /* see howto-man-page.txt about short option */
}; };
static const struct option longopts[] = { static const struct option longopts[] = {
{"no-argument", no_argument, NULL, 'n'}, { "no-argument", no_argument, NULL, 'n' },
{"required", required_argument, NULL, 'r'}, { "required", required_argument, NULL, 'r' },
{"xyzzy", no_argument, NULL, OPT_XYZZY}, { "extremely-long-long-option", no_argument, NULL, 'e' },
{"extremely-long-long-option", no_argument, NULL, 'e'}, { "xyzzy", no_argument, NULL, OPT_XYZZY },
{"long-explanation", no_argument, NULL, 'l'}, { "long-explanation", no_argument, NULL, 'l' },
{"foobar", no_argument, NULL, 'f'}, { "foobar", no_argument, NULL, 'f' },
{"version", no_argument, NULL, 'V'}, { "version", no_argument, NULL, 'V' },
{"help", no_argument, NULL, 'h'}, { "help", no_argument, NULL, 'h' },
{NULL, 0, NULL, 0} { NULL, 0, NULL, 0 }
}; };
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");

View File

@ -29,9 +29,9 @@ int main(int argc, char **argv)
int c, fd; int c, fd;
static const struct option longopts[] = { static const struct option longopts[] = {
{"help", no_argument, 0, 'h'}, {"help", no_argument, NULL, 'h'},
{"version", no_argument, 0, 'V'}, {"version", no_argument, NULL, 'V'},
{NULL, no_argument, 0, '0'}, {NULL, 0, NULL, 0},
}; };
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");

View File

@ -2573,7 +2573,7 @@ int main(int argc, char *argv[])
{ "help", no_argument, NULL, 'h' }, { "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'V' }, { "version", no_argument, NULL, 'V' },
{ "zero", no_argument, NULL, 'z' }, { "zero", no_argument, NULL, 'z' },
{ NULL, 0, 0, 0 }, { NULL, 0, NULL, 0 },
}; };
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");

View File

@ -29,9 +29,9 @@ int main(int argc, char **argv)
int c, fd; int c, fd;
static const struct option longopts[] = { static const struct option longopts[] = {
{"help", no_argument, 0, 'h'}, {"help", no_argument, NULL, 'h'},
{"version", no_argument, 0, 'V'}, {"version", no_argument, NULL, 'V'},
{NULL, no_argument, 0, '0'}, {NULL, 0, NULL, 0},
}; };
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");

View File

@ -652,7 +652,7 @@ static int execute(const char *progname, const char *progpath,
} }
argv[argc++] = xstrdup(fs_get_device(fs)); argv[argc++] = xstrdup(fs_get_device(fs));
argv[argc] = 0; argv[argc] = NULL;
if (verbose || noexecute) { if (verbose || noexecute) {
const char *tgt = mnt_fs_get_target(fs); const char *tgt = mnt_fs_get_target(fs);
@ -742,7 +742,7 @@ static struct fsck_instance *wait_one(int flags)
if (noexecute) { if (noexecute) {
inst = instance_list; inst = instance_list;
prev = 0; prev = NULL;
#ifdef RANDOM_DEBUG #ifdef RANDOM_DEBUG
while (inst->next && (random() & 1)) { while (inst->next && (random() & 1)) {
prev = inst; prev = inst;
@ -777,7 +777,7 @@ static struct fsck_instance *wait_one(int flags)
warn(_("waitpid failed")); warn(_("waitpid failed"));
continue; continue;
} }
for (prev = 0, inst = instance_list; for (prev = NULL, inst = instance_list;
inst; inst;
prev = inst, inst = inst->next) { prev = inst, inst = inst->next) {
if (inst->pid == pid) if (inst->pid == pid)
@ -823,7 +823,7 @@ static struct fsck_instance *wait_one(int flags)
* bit before sending the kill, to give it * bit before sending the kill, to give it
* time to set up the signal handler * 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) { if (fork() == 0) {
sleep(1); sleep(1);
kill(inst2->pid, SIGUSR1); 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; int n, ret = 0, checked_type = 0;
char *cp; char *cp;
if (cmp->list == 0 || cmp->list[0] == 0) if (cmp->list == NULL || cmp->list[0] == NULL)
return 1; return 1;
for (n=0; (cp = cmp->list[n]); n++) { for (n=0; (cp = cmp->list[n]); n++) {
@ -1175,7 +1175,7 @@ static int count_slaves(dev_t disk)
if (!(dir = opendir(dirname))) if (!(dir = opendir(dirname)))
return -1; return -1;
while ((dp = readdir(dir)) != 0) { while ((dp = readdir(dir)) != NULL) {
#ifdef _DIRENT_HAVE_D_TYPE #ifdef _DIRENT_HAVE_D_TYPE
if (dp->d_type != DT_UNKNOWN && dp->d_type != DT_LNK) if (dp->d_type != DT_UNKNOWN && dp->d_type != DT_LNK)
continue; 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. * Don't check a stacked device with any other disk too.
*/ */
if (!disk || fs_is_stacked(fs)) if (!disk || fs_is_stacked(fs))
return (instance_list != 0); return (instance_list != NULL);
for (inst = instance_list; inst; inst = inst->next) { for (inst = instance_list; inst; inst = inst->next) {
dev_t idisk = fs_get_disk(inst->fs, 0); 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[]) static void parse_argv(int argc, char *argv[])
{ {
int i, j; int i, j;
char *arg, *dev, *tmp = 0; char *arg, *dev, *tmp = NULL;
char options[128]; char options[128];
int opt = 0; int opt = 0;
int opts_for_fsck = 0; int opts_for_fsck = 0;
@ -1422,12 +1422,12 @@ static void parse_argv(int argc, char *argv[])
*/ */
memset(&sa, 0, sizeof(struct sigaction)); memset(&sa, 0, sizeof(struct sigaction));
sa.sa_handler = signal_cancel; sa.sa_handler = signal_cancel;
sigaction(SIGINT, &sa, 0); sigaction(SIGINT, &sa, NULL);
sigaction(SIGTERM, &sa, 0); sigaction(SIGTERM, &sa, NULL);
num_devices = 0; num_devices = 0;
num_args = 0; num_args = 0;
instance_list = 0; instance_list = NULL;
for (i=1; i < argc; i++) { for (i=1; i < argc; i++) {
arg = argv[i]; arg = argv[i];
@ -1534,7 +1534,7 @@ static void parse_argv(int argc, char *argv[])
serialize = 1; serialize = 1;
break; break;
case 't': case 't':
tmp = 0; tmp = NULL;
if (fstype) if (fstype)
usage(stderr); usage(stderr);
if (arg[j+1]) if (arg[j+1])

View File

@ -220,7 +220,7 @@ static void test_crc(int start)
return; return;
} }
crc = crc32(0L, Z_NULL, 0); crc = crc32(0L, NULL, 0);
buf = buf =
mmap(NULL, super.size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0); 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) { if (buf != MAP_FAILED) {
((struct cramfs_super *)((unsigned char *) buf + start))->fsid.crc = ((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); crc = crc32(crc, (unsigned char *) buf + start, super.size - start);
munmap(buf, super.size); munmap(buf, super.size);
} else { } else {
@ -255,7 +255,7 @@ static void test_crc(int start)
break; break;
if (length == 0) if (length == 0)
((struct cramfs_super *)buf)->fsid.crc = ((struct cramfs_super *)buf)->fsid.crc =
crc32(0L, Z_NULL, 0); crc32(0L, NULL, 0);
length += retval; length += retval;
if (length > (super.size - start)) { if (length > (super.size - start)) {
crc = crc32(crc, buf, crc = crc32(crc, buf,
@ -646,12 +646,12 @@ int main(int argc, char **argv)
size_t length = 0; size_t length = 0;
static const struct option longopts[] = { static const struct option longopts[] = {
{"verbose", no_argument, 0, 'v'}, {"verbose", no_argument, NULL, 'v'},
{"version", no_argument, 0, 'V'}, {"version", no_argument, NULL, 'V'},
{"help", no_argument, 0, 'h'}, {"help", no_argument, NULL, 'h'},
{"blocksize", required_argument, 0, 'b'}, {"blocksize", required_argument, NULL, 'b'},
{"extract", optional_argument, 0, 'x'}, {"extract", optional_argument, NULL, 'x'},
{NULL, no_argument, 0, '0'}, {NULL, 0, NULL, 0},
}; };
setlocale(LC_MESSAGES, ""); setlocale(LC_MESSAGES, "");

View File

@ -190,11 +190,11 @@ int main(int argc, char **argv)
long divisor = 0; long divisor = 0;
static const struct option longopts[] = { static const struct option longopts[] = {
{"divisor", required_argument, 0, 'd'}, {"divisor", required_argument, NULL, 'd'},
{"sectors", no_argument, 0, 'x'}, {"sectors", no_argument, NULL, 'x'},
{"version", no_argument, 0, 'V'}, {"version", no_argument, NULL, 'V'},
{"help", no_argument, 0, 'h'}, {"help", no_argument, NULL, 'h'},
{NULL, 0, 0, 0} {NULL, 0, NULL, 0}
}; };
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");

View File

@ -302,7 +302,7 @@ static unsigned int parse_directory(struct entry *root_entry, const char *name,
endpath++; endpath++;
/* read in the directory and sort */ /* read in the directory and sort */
dircount = scandir(name, &dirlist, 0, cramsort); dircount = scandir(name, &dirlist, NULL, cramsort);
if (dircount < 0) if (dircount < 0)
err(MKFS_EX_ERROR, _("could not read directory %s"), name); 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; super->size = size;
memcpy(super->signature, CRAMFS_SIGNATURE, sizeof(super->signature)); 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.edition = opt_edition;
super->fsid.blocks = total_blocks; super->fsid.blocks = total_blocks;
super->fsid.files = total_nodes; super->fsid.files = total_nodes;
@ -706,7 +706,7 @@ int main(int argc, char **argv)
loff_t fslen_ub = sizeof(struct cramfs_super); loff_t fslen_ub = sizeof(struct cramfs_super);
unsigned int fslen_max; unsigned int fslen_max;
char const *dirname, *outfile; char const *dirname, *outfile;
uint32_t crc = crc32(0L, Z_NULL, 0); uint32_t crc = crc32(0L, NULL, 0);
int c; int c;
cramfs_is_big_endian = HOST_IS_BIG_ENDIAN; /* default is to use host order */ cramfs_is_big_endian = HOST_IS_BIG_ENDIAN; /* default is to use host order */

View File

@ -352,15 +352,15 @@ int main(int argc, char **argv)
uuid_t uuid_dat; uuid_t uuid_dat;
#endif #endif
static const struct option longopts[] = { static const struct option longopts[] = {
{ "check", no_argument, 0, 'c' }, { "check", no_argument, NULL, 'c' },
{ "force", no_argument, 0, 'f' }, { "force", no_argument, NULL, 'f' },
{ "pagesize", required_argument, 0, 'p' }, { "pagesize", required_argument, NULL, 'p' },
{ "label", required_argument, 0, 'L' }, { "label", required_argument, NULL, 'L' },
{ "swapversion", required_argument, 0, 'v' }, { "swapversion", required_argument, NULL, 'v' },
{ "uuid", required_argument, 0, 'U' }, { "uuid", required_argument, NULL, 'U' },
{ "version", no_argument, 0, 'V' }, { "version", no_argument, NULL, 'V' },
{ "help", no_argument, 0, 'h' }, { "help", no_argument, NULL, 'h' },
{ NULL, 0, 0, 0 } { NULL, 0, NULL, 0 }
}; };
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");

View File

@ -100,11 +100,11 @@ int main(int argc, char *argv[])
struct stat statbuf; struct stat statbuf;
static const struct option longopts[] = { static const struct option longopts[] = {
{"query", no_argument, 0, 'q'}, {"query", no_argument, NULL, 'q'},
{"all", no_argument, 0, 'a'}, {"all", no_argument, NULL, 'a'},
{"version", no_argument, 0, 'V'}, {"version", no_argument, NULL, 'V'},
{"help", no_argument, 0, 'h'}, {"help", no_argument, NULL, 'h'},
{NULL, no_argument, 0, '0'}, {NULL, 0, NULL, '0'},
}; };
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");

View File

@ -70,9 +70,9 @@ int main(int argc, char **argv)
uint64_t start; uint64_t start;
static const struct option longopts[] = { static const struct option longopts[] = {
{"help", no_argument, 0, 'h'}, {"help", no_argument, NULL, 'h'},
{"version", no_argument, 0, 'V'}, {"version", no_argument, NULL, 'V'},
{NULL, no_argument, 0, '0'}, {NULL, 0, NULL, '0'},
}; };
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");

View File

@ -1980,7 +1980,7 @@ int main(int argc, char *argv[])
{ "id", no_argument, NULL, 'c' }, /* deprecated */ { "id", no_argument, NULL, 'c' }, /* deprecated */
{ "print-id",no_argument, NULL, OPT_PRINT_ID }, /* deprecated */ { "print-id",no_argument, NULL, OPT_PRINT_ID }, /* deprecated */
{ NULL, 0, 0, 0 }, { NULL, 0, NULL, 0 },
}; };
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");

View File

@ -137,11 +137,11 @@ int main(int argc, char *argv[])
int c, rc = -1; int c, rc = -1;
static const struct option longopts[] = { static const struct option longopts[] = {
{ "help", 0, 0, 'h' }, { "help", no_argument, NULL, 'h' },
{ "version", 0, 0, 'V' }, { "version", no_argument, NULL, 'V' },
{ "label", 1, 0, 'L' }, { "label", required_argument, NULL, 'L' },
{ "uuid", 1, 0, 'U' }, { "uuid", required_argument, NULL, 'U' },
{ NULL, 0, 0, 0 } { NULL, 0, NULL, 0 }
}; };
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");

View File

@ -106,4 +106,4 @@
{0xfe, N_("LANstep")}, /* SpeedStor >1024 cyl. or LANstep */ {0xfe, N_("LANstep")}, /* SpeedStor >1024 cyl. or LANstep */
{0xff, N_("BBT")}, /* Xenix Bad Block Table */ {0xff, N_("BBT")}, /* Xenix Bad Block Table */
{ 0, 0 } { 0, NULL }

View File

@ -59,7 +59,7 @@ static void crank_random(void)
int i; int i;
struct timeval tv; struct timeval tv;
gettimeofday(&tv, 0); gettimeofday(&tv, NULL);
srand((getpid() << 16) ^ getuid() ^ tv.tv_sec ^ tv.tv_usec); srand((getpid() << 16) ^ getuid() ^ tv.tv_sec ^ tv.tv_usec);
#ifdef DO_JRAND_MIX #ifdef DO_JRAND_MIX
@ -68,7 +68,7 @@ static void crank_random(void)
ul_jrand_seed[2] = (tv.tv_sec ^ tv.tv_usec) >> 16; ul_jrand_seed[2] = (tv.tv_sec ^ tv.tv_usec) >> 16;
#endif #endif
/* Crank the random number generator a few times */ /* 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--) for (i = (tv.tv_sec ^ tv.tv_usec) & 0x1F; i > 0; i--)
rand(); rand();
} }

View File

@ -31,7 +31,7 @@ int setup_timer(timer_t * t_id, struct itimerval *timeout,
sig_a.sa_flags = SA_SIGINFO; sig_a.sa_flags = SA_SIGINFO;
sig_a.sa_sigaction = timeout_handler; sig_a.sa_sigaction = timeout_handler;
if (sigaction(SIGALRM, &sig_a, 0)) if (sigaction(SIGALRM, &sig_a, NULL))
return 1; return 1;
if (timer_create(CLOCK_MONOTONIC, &sig_e, t_id)) if (timer_create(CLOCK_MONOTONIC, &sig_e, t_id))
return 1; return 1;

View File

@ -141,8 +141,8 @@ blkid_dev_iterate blkid_dev_iterate_begin(blkid_cache cache)
iter->magic = DEV_ITERATE_MAGIC; iter->magic = DEV_ITERATE_MAGIC;
iter->cache = cache; iter->cache = cache;
iter->p = cache->bic_devs.next; iter->p = cache->bic_devs.next;
iter->search_type = 0; iter->search_type = NULL;
iter->search_value = 0; iter->search_value = NULL;
} }
return iter; return iter;
} }
@ -181,7 +181,7 @@ int blkid_dev_next(blkid_dev_iterate iter,
if (!ret_dev || !iter || iter->magic != DEV_ITERATE_MAGIC) if (!ret_dev || !iter || iter->magic != DEV_ITERATE_MAGIC)
return -1; return -1;
*ret_dev = 0; *ret_dev = NULL;
while (iter->p != &iter->cache->bic_devs) { while (iter->p != &iter->cache->bic_devs) {
dev = list_entry(iter->p, struct blkid_struct_dev, bid_devs); dev = list_entry(iter->p, struct blkid_struct_dev, bid_devs);
iter->p = iter->p->next; iter->p = iter->p->next;

View File

@ -201,7 +201,7 @@ static void probe_one(blkid_cache cache, const char *ptname,
dev = blkid_verify(cache, tmp); dev = blkid_verify(cache, tmp);
if (dev && (dev->bid_flags & BLKID_BID_FL_VERIFIED)) if (dev && (dev->bid_flags & BLKID_BID_FL_VERIFIED))
break; break;
dev = 0; dev = NULL;
} }
} }
if (dev && dev->bid_devno == devno) 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])) { if (!strncmp(ptname, "dm-", 3) && isdigit(ptname[3])) {
devname = canonicalize_dm_name(ptname); devname = canonicalize_dm_name(ptname);
if (!devname) if (!devname)
blkid__scan_dir("/dev/mapper", devno, 0, &devname); blkid__scan_dir("/dev/mapper", devno, NULL, &devname);
if (devname) if (devname)
goto get_dev; 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 */ /* Do a short-cut scan of /dev/mapper first */
if (!devname) if (!devname)
blkid__scan_dir("/dev/mapper", devno, 0, &devname); blkid__scan_dir("/dev/mapper", devno, NULL, &devname);
if (!devname) { if (!devname) {
devname = blkid_devno_to_devname(devno); devname = blkid_devno_to_devname(devno);
if (!devname) if (!devname)
@ -449,7 +449,7 @@ static int probe_all(blkid_cache cache, int only_if_new)
{ {
FILE *proc; FILE *proc;
char line[1024]; char line[1024];
char ptname0[128 + 1], ptname1[128 + 1], *ptname = 0; char ptname0[128 + 1], ptname1[128 + 1], *ptname = NULL;
char *ptnames[2]; char *ptnames[2];
dev_t devs[2]; dev_t devs[2];
int ma, mi; int ma, mi;
@ -465,7 +465,7 @@ static int probe_all(blkid_cache cache, int only_if_new)
return -BLKID_ERR_PARAM; return -BLKID_ERR_PARAM;
if (cache->bic_flags & BLKID_BIC_FL_PROBED && 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; return 0;
blkid_read_cache(cache); blkid_read_cache(cache);
@ -623,7 +623,7 @@ int blkid_probe_all(blkid_cache cache)
DBG(PROBE, ul_debug("Begin blkid_probe_all()")); DBG(PROBE, ul_debug("Begin blkid_probe_all()"));
ret = probe_all(cache, 0); ret = probe_all(cache, 0);
if (ret == 0) { if (ret == 0) {
cache->bic_time = time(0); cache->bic_time = time(NULL);
cache->bic_flags |= BLKID_BIC_FL_PROBED; cache->bic_flags |= BLKID_BIC_FL_PROBED;
} }
DBG(PROBE, ul_debug("End blkid_probe_all() [rc=%d]", ret)); DBG(PROBE, ul_debug("End blkid_probe_all() [rc=%d]", ret));

View 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 */ /* Some tags are stored directly in the device struct */
if (!strcmp(name, "DEVNO")) if (!strcmp(name, "DEVNO"))
dev->bid_devno = strtoull(value, 0, 0); dev->bid_devno = strtoull(value, NULL, 0);
else if (!strcmp(name, "PRI")) else if (!strcmp(name, "PRI"))
dev->bid_pri = strtol(value, 0, 0); dev->bid_pri = strtol(value, NULL, 0);
else if (!strcmp(name, "TIME")) { else if (!strcmp(name, "TIME")) {
char *end = NULL; char *end = NULL;
dev->bid_time = strtoull(value, &end, 0); dev->bid_time = strtoull(value, &end, 0);
if (end && *end == '.') if (end && *end == '.')
dev->bid_utime = strtoull(end + 1, 0, 0); dev->bid_utime = strtoull(end + 1, NULL, 0);
} else } else
ret = blkid_set_tag(dev, name, value, strlen(value)); ret = blkid_set_tag(dev, name, value, strlen(value));

View File

@ -60,7 +60,7 @@ char *blkid_get_devname(blkid_cache cache, const char *token,
{ {
blkid_dev dev; blkid_dev dev;
blkid_cache c = cache; blkid_cache c = cache;
char *t = 0, *v = 0; char *t = NULL, *v = NULL;
char *ret = NULL; char *ret = NULL;
if (!token) if (!token)

View File

@ -299,7 +299,7 @@ static int probe_vfat(blkid_probe pr, const struct blkid_idmag *mag)
{ {
struct vfat_super_block *vs; struct vfat_super_block *vs;
struct msdos_super_block *ms; 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]; unsigned char *vol_serno = NULL, vol_label_buf[11];
uint16_t sector_size = 0, reserved; uint16_t sector_size = 0, reserved;
uint32_t cluster_count, fat_size; uint32_t cluster_count, fat_size;

View 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, int blkid_set_tag(blkid_dev dev, const char *name,
const char *value, const int vlength) const char *value, const int vlength)
{ {
blkid_tag t = 0, head = 0; blkid_tag t = NULL, head = NULL;
char *val = 0; char *val = NULL;
char **dev_var = 0; char **dev_var = NULL;
if (value && !(val = strndup(value, vlength))) if (value && !(val = strndup(value, vlength)))
return -BLKID_ERR_MEM; return -BLKID_ERR_MEM;
@ -295,8 +295,8 @@ int blkid_tag_next(blkid_tag_iterate iter,
iter->p == &iter->dev->bid_tags) iter->p == &iter->dev->bid_tags)
return -1; return -1;
*type = 0; *type = NULL;
*value = 0; *value = NULL;
tag = list_entry(iter->p, struct blkid_struct_tag, bit_tags); tag = list_entry(iter->p, struct blkid_struct_tag, bit_tags);
*type = tag->bit_name; *type = tag->bit_name;
*value = tag->bit_val; *value = tag->bit_val;
@ -337,7 +337,7 @@ blkid_dev blkid_find_dev_with_tag(blkid_cache cache,
try_again: try_again:
pri = -1; pri = -1;
dev = 0; dev = NULL;
head = blkid_find_head_cache(cache, type); head = blkid_find_head_cache(cache, type);
if (head) { if (head) {

View File

@ -69,7 +69,7 @@ blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev)
if (!dev || !cache) if (!dev || !cache)
return NULL; return NULL;
now = time(0); now = time(NULL);
diff = now - dev->bid_time; diff = now - dev->bid_time;
if (stat(dev->bid_name, &st) < 0) { 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; dev->bid_utime = tv.tv_usec;
} else } else
#endif #endif
dev->bid_time = time(0); dev->bid_time = time(NULL);
dev->bid_devno = st.st_rdev; dev->bid_devno = st.st_rdev;
dev->bid_flags |= BLKID_BID_FL_VERIFIED; dev->bid_flags |= BLKID_BID_FL_VERIFIED;

View File

@ -43,7 +43,7 @@ static const char *bsd_dktypenames[] = {
"HP-FL", "HP-FL",
"type 9", "type 9",
"floppy", "floppy",
0 NULL
}; };
#define BSD_DKMAXTYPES (ARRAY_SIZE(bsd_dktypenames) - 1) #define BSD_DKMAXTYPES (ARRAY_SIZE(bsd_dktypenames) - 1)

View File

@ -1179,38 +1179,38 @@ PyTypeObject ContextType = {
sizeof(ContextObjext), /*tp_basicsize*/ sizeof(ContextObjext), /*tp_basicsize*/
0, /*tp_itemsize*/ 0, /*tp_itemsize*/
(destructor)Context_dealloc, /*tp_dealloc*/ (destructor)Context_dealloc, /*tp_dealloc*/
0, /*tp_print*/ NULL, /*tp_print*/
0, /*tp_getattr*/ NULL, /*tp_getattr*/
0, /*tp_setattr*/ NULL, /*tp_setattr*/
0, /*tp_compare*/ NULL, /*tp_compare*/
(reprfunc) Context_repr, (reprfunc) Context_repr,
0, /*tp_as_number*/ NULL, /*tp_as_number*/
0, /*tp_as_sequence*/ NULL, /*tp_as_sequence*/
0, /*tp_as_mapping*/ NULL, /*tp_as_mapping*/
0, /*tp_hash */ NULL, /*tp_hash */
0, /*tp_call*/ NULL, /*tp_call*/
0, /*tp_str*/ NULL, /*tp_str*/
0, /*tp_getattro*/ NULL, /*tp_getattro*/
0, /*tp_setattro*/ NULL, /*tp_setattro*/
0, /*tp_as_buffer*/ NULL, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
Context_HELP, /* tp_doc */ Context_HELP, /* tp_doc */
0, /* tp_traverse */ NULL, /* tp_traverse */
0, /* tp_clear */ NULL, /* tp_clear */
0, /* tp_richcompare */ NULL, /* tp_richcompare */
0, /* tp_weaklistoffset */ 0, /* tp_weaklistoffset */
0, /* tp_iter */ NULL, /* tp_iter */
0, /* tp_iternext */ NULL, /* tp_iternext */
Context_methods, /* tp_methods */ Context_methods, /* tp_methods */
Context_members, /* tp_members */ Context_members, /* tp_members */
Context_getseters, /* tp_getset */ Context_getseters, /* tp_getset */
0, /* tp_base */ NULL, /* tp_base */
0, /* tp_dict */ NULL, /* tp_dict */
0, /* tp_descr_get */ NULL, /* tp_descr_get */
0, /* tp_descr_set */ NULL, /* tp_descr_set */
0, /* tp_dictoffset */ 0, /* tp_dictoffset */
(initproc)Context_init, /* tp_init */ (initproc)Context_init, /* tp_init */
0, /* tp_alloc */ NULL, /* tp_alloc */
Context_new, /* tp_new */ Context_new, /* tp_new */
}; };

View File

@ -803,38 +803,38 @@ PyTypeObject FsType = {
sizeof(FsObject), /*tp_basicsize*/ sizeof(FsObject), /*tp_basicsize*/
0, /*tp_itemsize*/ 0, /*tp_itemsize*/
(destructor)Fs_destructor, /*tp_dealloc*/ (destructor)Fs_destructor, /*tp_dealloc*/
0, /*tp_print*/ NULL, /*tp_print*/
0, /*tp_getattr*/ NULL, /*tp_getattr*/
0, /*tp_setattr*/ NULL, /*tp_setattr*/
0, /*tp_compare*/ NULL, /*tp_compare*/
(reprfunc)Fs_repr, /*tp_repr*/ (reprfunc)Fs_repr, /*tp_repr*/
0, /*tp_as_number*/ NULL, /*tp_as_number*/
0, /*tp_as_sequence*/ NULL, /*tp_as_sequence*/
0, /*tp_as_mapping*/ NULL, /*tp_as_mapping*/
0, /*tp_hash */ NULL, /*tp_hash */
0, /*tp_call*/ NULL, /*tp_call*/
0, /*tp_str*/ NULL, /*tp_str*/
0, /*tp_getattro*/ NULL, /*tp_getattro*/
0, /*tp_setattro*/ NULL, /*tp_setattro*/
0, /*tp_as_buffer*/ NULL, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
Fs_HELP, /* tp_doc */ Fs_HELP, /* tp_doc */
0, /* tp_traverse */ NULL, /* tp_traverse */
0, /* tp_clear */ NULL, /* tp_clear */
0, /* tp_richcompare */ NULL, /* tp_richcompare */
0, /* tp_weaklistoffset */ 0, /* tp_weaklistoffset */
0, /* tp_iter */ NULL, /* tp_iter */
0, /* tp_iternext */ NULL, /* tp_iternext */
Fs_methods, /* tp_methods */ Fs_methods, /* tp_methods */
Fs_members, /* tp_members */ Fs_members, /* tp_members */
Fs_getseters, /* tp_getset */ Fs_getseters, /* tp_getset */
0, /* tp_base */ NULL, /* tp_base */
0, /* tp_dict */ NULL, /* tp_dict */
0, /* tp_descr_get */ NULL, /* tp_descr_get */
0, /* tp_descr_set */ NULL, /* tp_descr_set */
0, /* tp_dictoffset */ 0, /* tp_dictoffset */
(initproc)Fs_init, /* tp_init */ (initproc)Fs_init, /* tp_init */
0, /* tp_alloc */ NULL, /* tp_alloc */
Fs_new, /* tp_new */ Fs_new, /* tp_new */
}; };

View File

@ -210,7 +210,7 @@ PyMODINIT_FUNC initpylibmount(void)
pylibmount_debug_mask = 0; pylibmount_debug_mask = 0;
if (str) if (str)
pylibmount_debug_mask = strtoul(str, 0, 0); pylibmount_debug_mask = strtoul(str, NULL, 0);
pylibmount_debug_mask |= PYMNT_DEBUG_INIT; pylibmount_debug_mask |= PYMNT_DEBUG_INIT;
} }

View File

@ -733,38 +733,38 @@ PyTypeObject TableType = {
sizeof(TableObject), /*tp_basicsize*/ sizeof(TableObject), /*tp_basicsize*/
0, /*tp_itemsize*/ 0, /*tp_itemsize*/
(destructor)Table_destructor, /*tp_dealloc*/ (destructor)Table_destructor, /*tp_dealloc*/
0, /*tp_print*/ NULL, /*tp_print*/
0, /*tp_getattr*/ NULL, /*tp_getattr*/
0, /*tp_setattr*/ NULL, /*tp_setattr*/
0, /*tp_compare*/ NULL, /*tp_compare*/
(reprfunc) Table_repr, /*tp_repr*/ (reprfunc) Table_repr, /*tp_repr*/
0, /*tp_as_number*/ NULL, /*tp_as_number*/
0, /*tp_as_sequence*/ NULL, /*tp_as_sequence*/
0, /*tp_as_mapping*/ NULL, /*tp_as_mapping*/
0, /*tp_hash */ NULL, /*tp_hash */
0, /*tp_call*/ NULL, /*tp_call*/
0, /*tp_str*/ NULL, /*tp_str*/
0, /*tp_getattro*/ NULL, /*tp_getattro*/
0, /*tp_setattro*/ NULL, /*tp_setattro*/
0, /*tp_as_buffer*/ NULL, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
Table_HELP, /* tp_doc */ Table_HELP, /* tp_doc */
0, /* tp_traverse */ NULL, /* tp_traverse */
0, /* tp_clear */ NULL, /* tp_clear */
0, /* tp_richcompare */ NULL, /* tp_richcompare */
0, /* tp_weaklistoffset */ 0, /* tp_weaklistoffset */
0, /* tp_iter */ NULL, /* tp_iter */
0, /* tp_iternext */ NULL, /* tp_iternext */
Table_methods, /* tp_methods */ Table_methods, /* tp_methods */
Table_members, /* tp_members */ Table_members, /* tp_members */
Table_getseters, /* tp_getset */ Table_getseters, /* tp_getset */
0, /* tp_base */ NULL, /* tp_base */
0, /* tp_dict */ NULL, /* tp_dict */
0, /* tp_descr_get */ NULL, /* tp_descr_get */
0, /* tp_descr_set */ NULL, /* tp_descr_set */
0, /* tp_dictoffset */ 0, /* tp_dictoffset */
(initproc)Table_init, /* tp_init */ (initproc)Table_init, /* tp_init */
0, /* tp_alloc */ NULL, /* tp_alloc */
Table_new, /* tp_new */ Table_new, /* tp_new */
}; };

View 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)) { if ((last.tv_sec == 0) && (last.tv_usec == 0)) {
random_get_bytes(&clock_seq, sizeof(clock_seq)); random_get_bytes(&clock_seq, sizeof(clock_seq));
clock_seq &= 0x3FFF; clock_seq &= 0x3FFF;
gettimeofday(&last, 0); gettimeofday(&last, NULL);
last.tv_sec--; last.tv_sec--;
} }
try_again: try_again:
gettimeofday(&tv, 0); gettimeofday(&tv, NULL);
if ((tv.tv_sec < last.tv_sec) || if ((tv.tv_sec < last.tv_sec) ||
((tv.tv_sec == last.tv_sec) && ((tv.tv_sec == last.tv_sec) &&
(tv.tv_usec < last.tv_usec))) { (tv.tv_usec < last.tv_usec))) {
@ -446,7 +446,7 @@ static int uuid_generate_time_generic(uuid_t out) {
time_t now; time_t now;
if (num > 0) { if (num > 0) {
now = time(0); now = time(NULL);
if (now > last_time+1) if (now > last_time+1)
num = 0; num = 0;
} }
@ -454,7 +454,7 @@ static int uuid_generate_time_generic(uuid_t out) {
num = 1000; num = 1000;
if (get_uuid_via_daemon(UUIDD_OP_BULK_TIME_UUID, if (get_uuid_via_daemon(UUIDD_OP_BULK_TIME_UUID,
out, &num) == 0) { out, &num) == 0) {
last_time = time(0); last_time = time(NULL);
uuid_unpack(out, &uu); uuid_unpack(out, &uu);
num--; num--;
return 0; return 0;
@ -477,7 +477,7 @@ static int uuid_generate_time_generic(uuid_t out) {
return 0; return 0;
#endif #endif
return __uuid_generate_time(out, 0); return __uuid_generate_time(out, NULL);
} }
/* /*

View File

@ -133,13 +133,13 @@ static void parse_argv(struct chfn_control *ctl, int argc, char **argv)
{ {
int index, c, status = 0; int index, c, status = 0;
static const struct option long_options[] = { static const struct option long_options[] = {
{"full-name", required_argument, 0, 'f'}, { "full-name", required_argument, NULL, 'f' },
{"office", required_argument, 0, 'o'}, { "office", required_argument, NULL, 'o' },
{"office-phone", required_argument, 0, 'p'}, { "office-phone", required_argument, NULL, 'p' },
{"home-phone", required_argument, 0, 'h'}, { "home-phone", required_argument, NULL, 'h' },
{"help", no_argument, 0, 'u'}, { "help", no_argument, NULL, 'u' },
{"version", no_argument, 0, 'v'}, { "version", no_argument, NULL, 'v' },
{NULL, no_argument, 0, '0'}, { NULL, 0, NULL, 0 },
}; };
while ((c = getopt_long(argc, argv, "f:r:p:h:o:uv", long_options, while ((c = getopt_long(argc, argv, "f:r:p:h:o:uv", long_options,

View 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 void parse_argv(int argc, char **argv, struct sinfo *pinfo)
{ {
static const struct option long_options[] = { static const struct option long_options[] = {
{"shell", required_argument, 0, 's'}, {"shell", required_argument, NULL, 's'},
{"list-shells", no_argument, 0, 'l'}, {"list-shells", no_argument, NULL, 'l'},
{"help", no_argument, 0, 'h'}, {"help", no_argument, NULL, 'h'},
{"version", no_argument, 0, 'v'}, {"version", no_argument, NULL, 'v'},
{NULL, no_argument, 0, '0'}, {NULL, 0, NULL, 0},
}; };
int c; int c;
@ -227,7 +227,7 @@ int main(int argc, char **argv)
char *oldshell; char *oldshell;
int nullshell = 0; int nullshell = 0;
const uid_t uid = getuid(); const uid_t uid = getuid();
struct sinfo info = { 0 }; struct sinfo info = { NULL };
struct passwd *pw; struct passwd *pw;
sanitize_env(); sanitize_env();

View File

@ -41,9 +41,9 @@ int main(int argc, char *argv[])
int c, fd; int c, fd;
struct stat st; struct stat st;
static const struct option longopts[] = { static const struct option longopts[] = {
{ "help", 0, 0, 'h' }, { "help", 0, NULL, 'h' },
{ "version", 0, 0, 'V' }, { "version", 0, NULL, 'V' },
{ NULL, 0, 0, 0 } { NULL, 0, NULL, 0 }
}; };
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");

View File

@ -793,8 +793,8 @@ su_main (int argc, char **argv, int mode)
{"group", required_argument, NULL, 'g'}, {"group", required_argument, NULL, 'g'},
{"supp-group", required_argument, NULL, 'G'}, {"supp-group", required_argument, NULL, 'G'},
{"user", required_argument, NULL, 'u'}, /* runuser only */ {"user", required_argument, NULL, 'u'}, /* runuser only */
{"help", no_argument, 0, 'h'}, {"help", no_argument, NULL, 'h'},
{"version", no_argument, 0, 'V'}, {"version", no_argument, NULL, 'V'},
{NULL, 0, NULL, 0} {NULL, 0, NULL, 0}
}; };

View File

@ -840,12 +840,12 @@ int main(int argc, char **argv)
pid_t pid; pid_t pid;
static const struct option longopts[] = { static const struct option longopts[] = {
{ "login-shell", 0, 0, 'p' }, { "login-shell", no_argument, NULL, 'p' },
{ "timeout", 1, 0, 't' }, { "timeout", required_argument, NULL, 't' },
{ "force", 0, 0, 'e' }, { "force", no_argument, NULL, 'e' },
{ "help", 0, 0, 'h' }, { "help", no_argument, NULL, 'h' },
{ "version", 0, 0, 'V' }, { "version", no_argument, NULL, 'V' },
{ NULL, 0, 0, 0 } { NULL, 0, NULL, 0 }
}; };
INIT_LIST_HEAD(&consoles); INIT_LIST_HEAD(&consoles);

View File

@ -329,12 +329,12 @@ int main(int argc, char **argv)
const char *filename = NULL; const char *filename = NULL;
static const struct option longopts[] = { static const struct option longopts[] = {
{ "follow", 0, 0, 'f' }, { "follow", no_argument, NULL, 'f' },
{ "reverse", 0, 0, 'r' }, { "reverse", no_argument, NULL, 'r' },
{ "output", required_argument, 0, 'o' }, { "output", required_argument, NULL, 'o' },
{ "help", 0, 0, 'h' }, { "help", no_argument, NULL, 'h' },
{ "version", 0, 0, 'V' }, { "version", no_argument, NULL, 'V' },
{ NULL, 0, 0, 0 } { NULL, 0, NULL, 0 }
}; };
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");

View File

@ -542,7 +542,7 @@ static void init_monthnames(struct cal_control *ctl)
{ {
size_t i; size_t i;
if (ctl->full_month[0] != '\0') if (ctl->full_month[0] != NULL)
return; /* already initialized */ return; /* already initialized */
for (i = 0; i < MONTHS_IN_YEAR; i++) for (i = 0; i < MONTHS_IN_YEAR; i++)
@ -553,7 +553,7 @@ static void init_abbr_monthnames(struct cal_control *ctl)
{ {
size_t i; size_t i;
if (ctl->abbr_month[0] != '\0') if (ctl->abbr_month[0] != NULL)
return; /* already initialized */ return; /* already initialized */
for (i = 0; i < MONTHS_IN_YEAR; i++) for (i = 0; i < MONTHS_IN_YEAR; i++)

View File

@ -1276,44 +1276,44 @@ int main(int argc, char *argv[])
}; };
static const struct option longopts[] = { static const struct option longopts[] = {
{ "all", 0, 0, 'A' }, { "all", no_argument, NULL, 'A' },
{ "ascii", 0, 0, 'a' }, { "ascii", no_argument, NULL, 'a' },
{ "bytes", 0, 0, 'b' }, { "bytes", no_argument, NULL, 'b' },
{ "canonicalize", 0, 0, 'c' }, { "canonicalize", no_argument, NULL, 'c' },
{ "direction", 1, 0, 'd' }, { "direction", required_argument, NULL, 'd' },
{ "df", 0, 0, 'D' }, { "df", no_argument, NULL, 'D' },
{ "evaluate", 0, 0, 'e' }, { "evaluate", no_argument, NULL, 'e' },
{ "first-only", 0, 0, 'f' }, { "first-only", no_argument, NULL, 'f' },
{ "fstab", 0, 0, 's' }, { "fstab", no_argument, NULL, 's' },
{ "help", 0, 0, 'h' }, { "help", no_argument, NULL, 'h' },
{ "invert", 0, 0, 'i' }, { "invert", no_argument, NULL, 'i' },
{ "json", 0, 0, 'J' }, { "json", no_argument, NULL, 'J' },
{ "kernel", 0, 0, 'k' }, { "kernel", no_argument, NULL, 'k' },
{ "list", 0, 0, 'l' }, { "list", no_argument, NULL, 'l' },
{ "mountpoint", 1, 0, 'M' }, { "mountpoint", required_argument, NULL, 'M' },
{ "mtab", 0, 0, 'm' }, { "mtab", no_argument, NULL, 'm' },
{ "noheadings", 0, 0, 'n' }, { "noheadings", no_argument, NULL, 'n' },
{ "notruncate", 0, 0, 'u' }, { "notruncate", no_argument, NULL, 'u' },
{ "options", 1, 0, 'O' }, { "options", required_argument, NULL, 'O' },
{ "output", 1, 0, 'o' }, { "output", required_argument, NULL, 'o' },
{ "poll", 2, 0, 'p' }, { "poll", optional_argument, NULL, 'p' },
{ "pairs", 0, 0, 'P' }, { "pairs", no_argument, NULL, 'P' },
{ "raw", 0, 0, 'r' }, { "raw", no_argument, NULL, 'r' },
{ "types", 1, 0, 't' }, { "types", required_argument, NULL, 't' },
{ "nocanonicalize", 0, 0, 'C' }, { "nocanonicalize", no_argument, NULL, 'C' },
{ "nofsroot", 0, 0, 'v' }, { "nofsroot", no_argument, NULL, 'v' },
{ "submounts", 0, 0, 'R' }, { "submounts", no_argument, NULL, 'R' },
{ "source", 1, 0, 'S' }, { "source", required_argument, NULL, 'S' },
{ "tab-file", 1, 0, 'F' }, { "tab-file", required_argument, NULL, 'F' },
{ "task", 1, 0, 'N' }, { "task", required_argument, NULL, 'N' },
{ "target", 1, 0, 'T' }, { "target", required_argument, NULL, 'T' },
{ "timeout", 1, 0, 'w' }, { "timeout", required_argument, NULL, 'w' },
{ "uniq", 0, 0, 'U' }, { "uniq", no_argument, NULL, 'U' },
{ "verify", 0, 0, 'x' }, { "verify", no_argument, NULL, 'x' },
{ "version", 0, 0, 'V' }, { "version", no_argument, NULL, 'V' },
{ "verbose", 0, 0, FINDMNT_OPT_VERBOSE }, { "verbose", no_argument, NULL, FINDMNT_OPT_VERBOSE },
{ "tree", 0, 0, FINDMNT_OPT_TREE }, { "tree", no_argument, NULL, FINDMNT_OPT_TREE },
{ NULL, 0, 0, 0 } { NULL, 0, NULL, 0 }
}; };
static const ul_excl_t excl[] = { /* rows and cols in ASCII order */ static const ul_excl_t excl[] = { /* rows and cols in ASCII order */

View File

@ -448,7 +448,7 @@ static int is_active_swap(const char *filename)
mnt_table_parse_swaps(swaps, NULL); 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) 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; DIR *dir;
struct dirent *d; struct dirent *d;
struct blkdev_cxt part_cxt = { 0 }; struct blkdev_cxt part_cxt = { NULL };
int r = -1; int r = -1;
assert(wholedisk_cxt); assert(wholedisk_cxt);
@ -1360,7 +1360,7 @@ static int list_deps(struct blkdev_cxt *cxt)
{ {
DIR *dir; DIR *dir;
struct dirent *d; struct dirent *d;
struct blkdev_cxt dep = { 0 }; struct blkdev_cxt dep = { NULL };
const char *depname; const char *depname;
assert(cxt); assert(cxt);
@ -1421,7 +1421,7 @@ static int iterate_block_devices(void)
{ {
DIR *dir; DIR *dir;
struct dirent *d; struct dirent *d;
struct blkdev_cxt cxt = { 0 }; struct blkdev_cxt cxt = { NULL };
if (!(dir = opendir(_PATH_SYS_BLOCK))) if (!(dir = opendir(_PATH_SYS_BLOCK)))
return -errno; 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) static int process_one_device(char *devname)
{ {
struct blkdev_cxt parent = { 0 }, cxt = { 0 }; struct blkdev_cxt parent = { NULL }, cxt = { NULL };
struct stat st; struct stat st;
char buf[PATH_MAX + 1], *name = NULL, *diskname = NULL; char buf[PATH_MAX + 1], *name = NULL, *diskname = NULL;
dev_t disk = 0; dev_t disk = 0;
@ -1670,30 +1670,30 @@ int main(int argc, char *argv[])
size_t i; size_t i;
static const struct option longopts[] = { static const struct option longopts[] = {
{ "all", 0, 0, 'a' }, { "all", no_argument, NULL, 'a' },
{ "bytes", 0, 0, 'b' }, { "bytes", no_argument, NULL, 'b' },
{ "nodeps", 0, 0, 'd' }, { "nodeps", no_argument, NULL, 'd' },
{ "discard", 0, 0, 'D' }, { "discard", no_argument, NULL, 'D' },
{ "help", 0, 0, 'h' }, { "help", no_argument, NULL, 'h' },
{ "json", 0, 0, 'J' }, { "json", no_argument, NULL, 'J' },
{ "output", 1, 0, 'o' }, { "output", required_argument, NULL, 'o' },
{ "output-all", 0, 0, 'O' }, { "output-all", no_argument, NULL, 'O' },
{ "perms", 0, 0, 'm' }, { "perms", no_argument, NULL, 'm' },
{ "noheadings", 0, 0, 'n' }, { "noheadings", no_argument, NULL, 'n' },
{ "list", 0, 0, 'l' }, { "list", no_argument, NULL, 'l' },
{ "ascii", 0, 0, 'i' }, { "ascii", no_argument, NULL, 'i' },
{ "raw", 0, 0, 'r' }, { "raw", no_argument, NULL, 'r' },
{ "inverse", 0, 0, 's' }, { "inverse", no_argument, NULL, 's' },
{ "fs", 0, 0, 'f' }, { "fs", no_argument, NULL, 'f' },
{ "exclude", 1, 0, 'e' }, { "exclude", required_argument, NULL, 'e' },
{ "include", 1, 0, 'I' }, { "include", required_argument, NULL, 'I' },
{ "topology", 0, 0, 't' }, { "topology", no_argument, NULL, 't' },
{ "paths", 0, 0, 'p' }, { "paths", no_argument, NULL, 'p' },
{ "pairs", 0, 0, 'P' }, { "pairs", no_argument, NULL, 'P' },
{ "scsi", 0, 0, 'S' }, { "scsi", no_argument, NULL, 'S' },
{ "sort", 1, 0, 'x' }, { "sort", required_argument, NULL, 'x' },
{ "version", 0, 0, 'V' }, { "version", no_argument, NULL, 'V' },
{ NULL, 0, 0, 0 }, { NULL, 0, NULL, 0 },
}; };
static const ul_excl_t excl[] = { /* rows and cols in ASCII order */ static const ul_excl_t excl[] = { /* rows and cols in ASCII order */

View File

@ -351,15 +351,15 @@ static void usage(int rc)
static const struct option longopts[] = static const struct option longopts[] =
{ {
{ "help", 0, 0, 'h' }, { "help", no_argument, NULL, 'h' },
{ "version", 0, 0, 'V' }, { "version", no_argument, NULL, 'V' },
{ "mountpoints",0, 0, 'x' }, { "mountpoints", no_argument, NULL, 'x' },
{ "modes", 0, 0, 'm' }, { "modes", no_argument, NULL, 'm' },
{ "owners", 0, 0, 'o' }, { "owners", no_argument, NULL, 'o' },
{ "long", 0, 0, 'l' }, { "long", no_argument, NULL, 'l' },
{ "nolinks", 0, 0, 'n' }, { "nolinks", no_argument, NULL, 'n' },
{ "vertical", 0, 0, 'v' }, { "vertical", no_argument, NULL, 'v' },
{ NULL, 0, 0, 0 }, { NULL, 0, NULL, 0 },
}; };
int int

View File

@ -486,17 +486,17 @@ main(int argc, char **argv)
int mode = WP_MODE_PRETTY; int mode = WP_MODE_PRETTY;
static const struct option longopts[] = { static const struct option longopts[] = {
{ "all", 0, 0, 'a' }, { "all", no_argument, NULL, 'a' },
{ "backup", 0, 0, 'b' }, { "backup", no_argument, NULL, 'b' },
{ "force", 0, 0, 'f' }, { "force", no_argument, NULL, 'f' },
{ "help", 0, 0, 'h' }, { "help", no_argument, NULL, 'h' },
{ "no-act", 0, 0, 'n' }, { "no-act", no_argument, NULL, 'n' },
{ "offset", 1, 0, 'o' }, { "offset", required_argument, NULL, 'o' },
{ "parsable", 0, 0, 'p' }, { "parsable", no_argument, NULL, 'p' },
{ "quiet", 0, 0, 'q' }, { "quiet", no_argument, NULL, 'q' },
{ "types", 1, 0, 't' }, { "types", required_argument, NULL, 't' },
{ "version", 0, 0, 'V' }, { "version", no_argument, NULL, 'V' },
{ NULL, 0, 0, 0 } { NULL, 0, NULL, 0 }
}; };
static const ul_excl_t excl[] = { /* rows and cols in ASCII order */ static const ul_excl_t excl[] = { /* rows and cols in ASCII order */

View File

@ -113,15 +113,15 @@ int main(int argc, char **argv)
int act = ACT_DISCARD; int act = ACT_DISCARD;
static const struct option longopts[] = { static const struct option longopts[] = {
{ "help", 0, 0, 'h' }, { "help", no_argument, NULL, 'h' },
{ "version", 0, 0, 'V' }, { "version", no_argument, NULL, 'V' },
{ "offset", 1, 0, 'o' }, { "offset", required_argument, NULL, 'o' },
{ "length", 1, 0, 'l' }, { "length", required_argument, NULL, 'l' },
{ "step", 1, 0, 'p' }, { "step", required_argument, NULL, 'p' },
{ "secure", 0, 0, 's' }, { "secure", no_argument, NULL, 's' },
{ "verbose", 0, 0, 'v' }, { "verbose", no_argument, NULL, 'v' },
{ "zeroout", 0, 0, 'z' }, { "zeroout", no_argument, NULL, 'z' },
{ NULL, 0, 0, 0 } { NULL, 0, NULL, 0 }
}; };
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");

View File

@ -262,15 +262,15 @@ int main(int argc, char *argv[])
int c, rc; int c, rc;
static const struct option longopts[] = { static const struct option longopts[] = {
{ "configure", required_argument, 0, 'c' }, { "configure", required_argument, NULL, 'c' },
{ "deconfigure",required_argument, 0, 'g' }, { "deconfigure",required_argument, NULL, 'g' },
{ "disable", required_argument, 0, 'd' }, { "disable", required_argument, NULL, 'd' },
{ "dispatch", required_argument, 0, 'p' }, { "dispatch", required_argument, NULL, 'p' },
{ "enable", required_argument, 0, 'e' }, { "enable", required_argument, NULL, 'e' },
{ "help", no_argument, 0, 'h' }, { "help", no_argument, NULL, 'h' },
{ "rescan", no_argument, 0, 'r' }, { "rescan", no_argument, NULL, 'r' },
{ "version", no_argument, 0, 'V' }, { "version", no_argument, NULL, 'V' },
{ NULL, 0, 0, 0 } { NULL, 0, NULL, 0 }
}; };
static const ul_excl_t excl[] = { /* rows and cols in ASCII order */ static const ul_excl_t excl[] = { /* rows and cols in ASCII order */

View File

@ -193,7 +193,7 @@ static void parse_args(struct eject_control *ctl, int argc, char **argv)
{"traytoggle", no_argument, NULL, 'T'}, {"traytoggle", no_argument, NULL, 'T'},
{"verbose", no_argument, NULL, 'v'}, {"verbose", no_argument, NULL, 'v'},
{"version", no_argument, NULL, 'V'}, {"version", no_argument, NULL, 'V'},
{0, 0, 0, 0} {NULL, 0, NULL, 0}
}; };
int c; int c;
@ -845,7 +845,7 @@ int main(int argc, char **argv)
char *disk = NULL; char *disk = NULL;
char *mountpoint = NULL; char *mountpoint = NULL;
int worked = 0; /* set to 1 when successfully ejected */ int worked = 0; /* set to 1 when successfully ejected */
struct eject_control ctl = { 0 }; struct eject_control ctl = { NULL };
setlocale(LC_ALL,""); setlocale(LC_ALL,"");
bindtextdomain(PACKAGE, LOCALEDIR); bindtextdomain(PACKAGE, LOCALEDIR);

View File

@ -294,19 +294,19 @@ int main(int argc, char **argv)
loff_t offset = 0; loff_t offset = 0;
static const struct option longopts[] = { static const struct option longopts[] = {
{ "help", 0, 0, 'h' }, { "help", no_argument, NULL, 'h' },
{ "version", 0, 0, 'V' }, { "version", no_argument, NULL, 'V' },
{ "keep-size", 0, 0, 'n' }, { "keep-size", no_argument, NULL, 'n' },
{ "punch-hole", 0, 0, 'p' }, { "punch-hole", no_argument, NULL, 'p' },
{ "collapse-range", 0, 0, 'c' }, { "collapse-range", no_argument, NULL, 'c' },
{ "dig-holes", 0, 0, 'd' }, { "dig-holes", no_argument, NULL, 'd' },
{ "insert-range", 0, 0, 'i' }, { "insert-range", no_argument, NULL, 'i' },
{ "zero-range", 0, 0, 'z' }, { "zero-range", no_argument, NULL, 'z' },
{ "offset", 1, 0, 'o' }, { "offset", required_argument, NULL, 'o' },
{ "length", 1, 0, 'l' }, { "length", required_argument, NULL, 'l' },
{ "posix", 0, 0, 'x' }, { "posix", no_argument, NULL, 'x' },
{ "verbose", 0, 0, 'v' }, { "verbose", no_argument, NULL, 'v' },
{ NULL, 0, 0, 0 } { NULL, 0, NULL, 0 }
}; };
static const ul_excl_t excl[] = { /* rows and cols in ASCII order */ static const ul_excl_t excl[] = { /* rows and cols in ASCII order */

View File

@ -239,7 +239,7 @@ int main(int argc, char *argv[])
cmd_argv[0] = _PATH_BSHELL; cmd_argv[0] = _PATH_BSHELL;
cmd_argv[1] = "-c"; cmd_argv[1] = "-c";
cmd_argv[2] = argv[optind + 2]; cmd_argv[2] = argv[optind + 2];
cmd_argv[3] = 0; cmd_argv[3] = NULL;
} else { } else {
cmd_argv = &argv[optind + 1]; cmd_argv = &argv[optind + 1];
} }

View File

@ -61,11 +61,11 @@ int main(int argc, char **argv)
struct stat sb; struct stat sb;
static const struct option longopts[] = { static const struct option longopts[] = {
{ "help", 0, 0, 'h' }, { "help", no_argument, NULL, 'h' },
{ "freeze", 0, 0, 'f' }, { "freeze", no_argument, NULL, 'f' },
{ "unfreeze", 0, 0, 'u' }, { "unfreeze", no_argument, NULL, 'u' },
{ "version", 0, 0, 'V' }, { "version", no_argument, NULL, 'V' },
{ NULL, 0, 0, 0 } { NULL, 0, NULL, 0 }
}; };
static const ul_excl_t excl[] = { /* rows and cols in ASCII order */ static const ul_excl_t excl[] = { /* rows and cols in ASCII order */

View File

@ -274,14 +274,14 @@ int main(int argc, char **argv)
struct fstrim_range range; struct fstrim_range range;
static const struct option longopts[] = { static const struct option longopts[] = {
{ "all", 0, 0, 'a' }, { "all", no_argument, NULL, 'a' },
{ "help", 0, 0, 'h' }, { "help", no_argument, NULL, 'h' },
{ "version", 0, 0, 'V' }, { "version", no_argument, NULL, 'V' },
{ "offset", 1, 0, 'o' }, { "offset", required_argument, NULL, 'o' },
{ "length", 1, 0, 'l' }, { "length", required_argument, NULL, 'l' },
{ "minimum", 1, 0, 'm' }, { "minimum", required_argument, NULL, 'm' },
{ "verbose", 0, 0, 'v' }, { "verbose", no_argument, NULL, 'v' },
{ NULL, 0, 0, 0 } { NULL, 0, NULL, 0 }
}; };
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");

View File

@ -1457,7 +1457,7 @@ static void usage(const struct hwclock_control *ctl, const char *fmt, ...)
*/ */
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
struct hwclock_control ctl = { 0 }; struct hwclock_control ctl = { NULL };
struct timeval startup_time; struct timeval startup_time;
struct adjtime adjtime = { 0 }; struct adjtime adjtime = { 0 };
/* /*
@ -1487,44 +1487,44 @@ int main(int argc, char **argv)
}; };
static const struct option longopts[] = { static const struct option longopts[] = {
{"adjust", 0, 0, 'a'}, { "adjust", no_argument, NULL, 'a' },
{"help", 0, 0, 'h'}, { "help", no_argument, NULL, 'h' },
{"show", 0, 0, 'r'}, { "show", no_argument, NULL, 'r' },
{"hctosys", 0, 0, 's'}, { "hctosys", no_argument, NULL, 's' },
{"utc", 0, 0, 'u'}, { "utc", no_argument, NULL, 'u' },
{"version", 0, 0, 'v'}, { "version", no_argument, NULL, 'v' },
{"systohc", 0, 0, 'w'}, { "systohc", no_argument, NULL, 'w' },
{"debug", 0, 0, 'D'}, { "debug", no_argument, NULL, 'D' },
#ifdef __alpha__ #ifdef __alpha__
{"ARC", 0, 0, 'A'}, { "ARC", no_argument, NULL, 'A' },
{"arc", 0, 0, 'A'}, { "arc", no_argument, NULL, 'A' },
{"Jensen", 0, 0, 'J'}, { "Jensen", no_argument, NULL, 'J' },
{"jensen", 0, 0, 'J'}, { "jensen", no_argument, NULL, 'J' },
{"SRM", 0, 0, 'S'}, { "SRM", no_argument, NULL, 'S' },
{"srm", 0, 0, 'S'}, { "srm", no_argument, NULL, 'S' },
{"funky-toy", 0, 0, 'F'}, { "funky-toy", no_argument, NULL, 'F' },
#endif #endif
{"set", 0, 0, OPT_SET}, { "set", no_argument, NULL, OPT_SET },
#ifdef __linux__ #ifdef __linux__
{"getepoch", 0, 0, OPT_GETEPOCH}, { "getepoch", no_argument, NULL, OPT_GETEPOCH },
{"setepoch", 0, 0, OPT_SETEPOCH}, { "setepoch", no_argument, NULL, OPT_SETEPOCH },
#endif #endif
{"noadjfile", 0, 0, OPT_NOADJFILE}, { "noadjfile", no_argument, NULL, OPT_NOADJFILE },
{"localtime", 0, 0, OPT_LOCALTIME}, { "localtime", no_argument, NULL, OPT_LOCALTIME },
{"badyear", 0, 0, OPT_BADYEAR}, { "badyear", no_argument, NULL, OPT_BADYEAR },
{"directisa", 0, 0, OPT_DIRECTISA}, { "directisa", no_argument, NULL, OPT_DIRECTISA },
{"test", 0, 0, OPT_TEST}, { "test", no_argument, NULL, OPT_TEST },
{"date", 1, 0, OPT_DATE}, { "date", required_argument, NULL, OPT_DATE },
{"epoch", 1, 0, OPT_EPOCH}, { "epoch", required_argument, NULL, OPT_EPOCH },
#ifdef __linux__ #ifdef __linux__
{"rtc", 1, 0, 'f'}, { "rtc", required_argument, NULL, 'f' },
#endif #endif
{"adjfile", 1, 0, OPT_ADJFILE}, { "adjfile", required_argument, NULL, OPT_ADJFILE },
{"systz", 0, 0, OPT_SYSTZ}, { "systz", no_argument, NULL, OPT_SYSTZ },
{"predict-hc", 0, 0, OPT_PREDICT_HC}, { "predict-hc", no_argument, NULL, OPT_PREDICT_HC },
{"get", 0, 0, OPT_GET}, { "get", no_argument, NULL, OPT_GET },
{"update-drift",0, 0, OPT_UPDATE}, { "update-drift", no_argument, NULL, OPT_UPDATE },
{NULL, 0, NULL, 0} { NULL, 0, NULL, 0 }
}; };
static const ul_excl_t excl[] = { /* rows and cols in ASCII order */ static const ul_excl_t excl[] = { /* rows and cols in ASCII order */

View File

@ -574,28 +574,28 @@ int main(int argc, char **argv)
OPT_DIO OPT_DIO
}; };
static const struct option longopts[] = { static const struct option longopts[] = {
{ "all", 0, 0, 'a' }, { "all", no_argument, NULL, 'a' },
{ "set-capacity", 1, 0, 'c' }, { "set-capacity", required_argument, NULL, 'c' },
{ "detach", 1, 0, 'd' }, { "detach", required_argument, NULL, 'd' },
{ "detach-all", 0, 0, 'D' }, { "detach-all", no_argument, NULL, 'D' },
{ "find", 0, 0, 'f' }, { "find", no_argument, NULL, 'f' },
{ "nooverlap", 0, 0, 'L' }, { "nooverlap", no_argument, NULL, 'L' },
{ "help", 0, 0, 'h' }, { "help", no_argument, NULL, 'h' },
{ "associated", 1, 0, 'j' }, { "associated", required_argument, NULL, 'j' },
{ "json", 0, 0, 'J' }, { "json", no_argument, NULL, 'J' },
{ "list", 0, 0, 'l' }, { "list", no_argument, NULL, 'l' },
{ "noheadings", 0, 0, 'n' }, { "noheadings", no_argument, NULL, 'n' },
{ "offset", 1, 0, 'o' }, { "offset", required_argument, NULL, 'o' },
{ "output", 1, 0, 'O' }, { "output", required_argument, NULL, 'O' },
{ "sizelimit", 1, 0, OPT_SIZELIMIT }, { "sizelimit", required_argument, NULL, OPT_SIZELIMIT },
{ "partscan", 0, 0, 'P' }, { "partscan", no_argument, NULL, 'P' },
{ "read-only", 0, 0, 'r' }, { "read-only", no_argument, NULL, 'r' },
{ "direct-io", 2, 0, OPT_DIO }, { "direct-io", optional_argument, NULL, OPT_DIO },
{ "raw", 0, 0, OPT_RAW }, { "raw", no_argument, NULL, OPT_RAW },
{ "show", 0, 0, OPT_SHOW }, { "show", no_argument, NULL, OPT_SHOW },
{ "verbose", 0, 0, 'v' }, { "verbose", no_argument, NULL, 'v' },
{ "version", 0, 0, 'V' }, { "version", no_argument, NULL, 'V' },
{ NULL, 0, 0, 0 } { NULL, 0, NULL, 0 }
}; };
static const ul_excl_t excl[] = { /* rows and cols in ASCII order */ static const ul_excl_t excl[] = { /* rows and cols in ASCII order */

View File

@ -1988,23 +1988,23 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
struct lscpu_modifier _mod = { .mode = OUTPUT_SUMMARY }, *mod = &_mod; 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 c, i;
int columns[ARRAY_SIZE(coldescs)], ncolumns = 0; int columns[ARRAY_SIZE(coldescs)], ncolumns = 0;
int cpu_modifier_specified = 0; int cpu_modifier_specified = 0;
static const struct option longopts[] = { static const struct option longopts[] = {
{ "all", no_argument, 0, 'a' }, { "all", no_argument, NULL, 'a' },
{ "online", no_argument, 0, 'b' }, { "online", no_argument, NULL, 'b' },
{ "offline", no_argument, 0, 'c' }, { "offline", no_argument, NULL, 'c' },
{ "help", no_argument, 0, 'h' }, { "help", no_argument, NULL, 'h' },
{ "extended", optional_argument, 0, 'e' }, { "extended", optional_argument, NULL, 'e' },
{ "parse", optional_argument, 0, 'p' }, { "parse", optional_argument, NULL, 'p' },
{ "sysroot", required_argument, 0, 's' }, { "sysroot", required_argument, NULL, 's' },
{ "physical", no_argument, 0, 'y' }, { "physical", no_argument, NULL, 'y' },
{ "hex", no_argument, 0, 'x' }, { "hex", no_argument, NULL, 'x' },
{ "version", no_argument, 0, 'V' }, { "version", no_argument, NULL, 'V' },
{ NULL, 0, 0, 0 } { NULL, 0, NULL, 0 }
}; };
static const ul_excl_t excl[] = { /* rows and cols in ASCII order */ static const ul_excl_t excl[] = { /* rows and cols in ASCII order */

View File

@ -1081,27 +1081,27 @@ int main(int argc, char *argv[])
}; };
static const struct option longopts[] = { static const struct option longopts[] = {
{ "bytes", no_argument, 0, 'b' }, { "bytes", no_argument, NULL, 'b' },
{ "creator", no_argument, 0, 'c' }, { "creator", no_argument, NULL, 'c' },
{ "export", no_argument, 0, 'e' }, { "export", no_argument, NULL, 'e' },
{ "global", no_argument, 0, 'g' }, { "global", no_argument, NULL, 'g' },
{ "help", no_argument, 0, 'h' }, { "help", no_argument, NULL, 'h' },
{ "id", required_argument, 0, 'i' }, { "id", required_argument, NULL, 'i' },
{ "json", no_argument, 0, 'J' }, { "json", no_argument, NULL, 'J' },
{ "list", no_argument, 0, 'l' }, { "list", no_argument, NULL, 'l' },
{ "newline", no_argument, 0, 'n' }, { "newline", no_argument, NULL, 'n' },
{ "noheadings", no_argument, 0, OPT_NOHEAD }, { "noheadings", no_argument, NULL, OPT_NOHEAD },
{ "notruncate", no_argument, 0, OPT_NOTRUNC }, { "notruncate", no_argument, NULL, OPT_NOTRUNC },
{ "numeric-perms", no_argument, 0, 'P' }, { "numeric-perms", no_argument, NULL, 'P' },
{ "output", required_argument, 0, 'o' }, { "output", required_argument, NULL, 'o' },
{ "pid", no_argument, 0, 'p' }, { "pid", no_argument, NULL, 'p' },
{ "queues", no_argument, 0, 'q' }, { "queues", no_argument, NULL, 'q' },
{ "raw", no_argument, 0, 'r' }, { "raw", no_argument, NULL, 'r' },
{ "semaphores", no_argument, 0, 's' }, { "semaphores", no_argument, NULL, 's' },
{ "shmems", no_argument, 0, 'm' }, { "shmems", no_argument, NULL, 'm' },
{ "time", no_argument, 0, 't' }, { "time", no_argument, NULL, 't' },
{ "time-format", required_argument, 0, OPT_TIME_FMT }, { "time-format", required_argument, NULL, OPT_TIME_FMT },
{ "version", no_argument, 0, 'V' }, { "version", no_argument, NULL, 'V' },
{NULL, 0, NULL, 0} {NULL, 0, NULL, 0}
}; };

View File

@ -832,40 +832,40 @@ int main(int argc, char **argv)
}; };
static const struct option longopts[] = { static const struct option longopts[] = {
{ "all", 0, 0, 'a' }, { "all", no_argument, NULL, 'a' },
{ "fake", 0, 0, 'f' }, { "fake", no_argument, NULL, 'f' },
{ "fstab", 1, 0, 'T' }, { "fstab", required_argument, NULL, 'T' },
{ "fork", 0, 0, 'F' }, { "fork", no_argument, NULL, 'F' },
{ "help", 0, 0, 'h' }, { "help", no_argument, NULL, 'h' },
{ "no-mtab", 0, 0, 'n' }, { "no-mtab", no_argument, NULL, 'n' },
{ "read-only", 0, 0, 'r' }, { "read-only", no_argument, NULL, 'r' },
{ "ro", 0, 0, 'r' }, { "ro", no_argument, NULL, 'r' },
{ "verbose", 0, 0, 'v' }, { "verbose", no_argument, NULL, 'v' },
{ "version", 0, 0, 'V' }, { "version", no_argument, NULL, 'V' },
{ "read-write", 0, 0, 'w' }, { "read-write", no_argument, NULL, 'w' },
{ "rw", 0, 0, 'w' }, { "rw", no_argument, NULL, 'w' },
{ "options", 1, 0, 'o' }, { "options", required_argument, NULL, 'o' },
{ "test-opts", 1, 0, 'O' }, { "test-opts", required_argument, NULL, 'O' },
{ "types", 1, 0, 't' }, { "types", required_argument, NULL, 't' },
{ "uuid", 1, 0, 'U' }, { "uuid", required_argument, NULL, 'U' },
{ "label", 1, 0, 'L'}, { "label", required_argument, NULL, 'L' },
{ "bind", 0, 0, 'B' }, { "bind", no_argument, NULL, 'B' },
{ "move", 0, 0, 'M' }, { "move", no_argument, NULL, 'M' },
{ "rbind", 0, 0, 'R' }, { "rbind", no_argument, NULL, 'R' },
{ "make-shared", 0, 0, MOUNT_OPT_SHARED }, { "make-shared", no_argument, NULL, MOUNT_OPT_SHARED },
{ "make-slave", 0, 0, MOUNT_OPT_SLAVE }, { "make-slave", no_argument, NULL, MOUNT_OPT_SLAVE },
{ "make-private", 0, 0, MOUNT_OPT_PRIVATE }, { "make-private", no_argument, NULL, MOUNT_OPT_PRIVATE },
{ "make-unbindable", 0, 0, MOUNT_OPT_UNBINDABLE }, { "make-unbindable", no_argument, NULL, MOUNT_OPT_UNBINDABLE },
{ "make-rshared", 0, 0, MOUNT_OPT_RSHARED }, { "make-rshared", no_argument, NULL, MOUNT_OPT_RSHARED },
{ "make-rslave", 0, 0, MOUNT_OPT_RSLAVE }, { "make-rslave", no_argument, NULL, MOUNT_OPT_RSLAVE },
{ "make-rprivate", 0, 0, MOUNT_OPT_RPRIVATE }, { "make-rprivate", no_argument, NULL, MOUNT_OPT_RPRIVATE },
{ "make-runbindable", 0, 0, MOUNT_OPT_RUNBINDABLE }, { "make-runbindable", no_argument, NULL, MOUNT_OPT_RUNBINDABLE },
{ "no-canonicalize", 0, 0, 'c' }, { "no-canonicalize", no_argument, NULL, 'c' },
{ "internal-only", 0, 0, 'i' }, { "internal-only", no_argument, NULL, 'i' },
{ "show-labels", 0, 0, 'l' }, { "show-labels", no_argument, NULL, 'l' },
{ "target", 1, 0, MOUNT_OPT_TARGET }, { "target", required_argument, NULL, MOUNT_OPT_TARGET },
{ "source", 1, 0, MOUNT_OPT_SOURCE }, { "source", required_argument, NULL, MOUNT_OPT_SOURCE },
{ NULL, 0, 0, 0 } { NULL, 0, NULL, 0 }
}; };
static const ul_excl_t excl[] = { /* rows and cols in ASCII order */ static const ul_excl_t excl[] = { /* rows and cols in ASCII order */

View File

@ -136,15 +136,15 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
int c; int c;
struct mountpoint_control ctl = { 0 }; struct mountpoint_control ctl = { NULL };
static const struct option longopts[] = { static const struct option longopts[] = {
{ "quiet", 0, 0, 'q' }, { "quiet", no_argument, NULL, 'q' },
{ "fs-devno", 0, 0, 'd' }, { "fs-devno", no_argument, NULL, 'd' },
{ "devno", 0, 0, 'x' }, { "devno", no_argument, NULL, 'x' },
{ "help", 0, 0, 'h' }, { "help", no_argument, NULL, 'h' },
{ "version", 0, 0, 'V' }, { "version", no_argument, NULL, 'V' },
{ NULL, 0, 0, 0 } { NULL, 0, NULL, 0 }
}; };
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");

View File

@ -132,7 +132,7 @@ int main(int argc, char **argv)
{ {
FILE *map; FILE *map;
int proFd; int proFd;
char *mapFile, *proFile, *mult = 0; char *mapFile, *proFile, *mult = NULL;
size_t len = 0, indx = 1; size_t len = 0, indx = 1;
unsigned long long add0 = 0; unsigned long long add0 = 0;
unsigned int step; unsigned int step;
@ -162,7 +162,7 @@ int main(int argc, char **argv)
{"no-auto", no_argument, NULL, 'n'}, {"no-auto", no_argument, NULL, 'n'},
{"version", no_argument, NULL, 'V'}, {"version", no_argument, NULL, 'V'},
{"help", no_argument, NULL, 'h'}, {"help", no_argument, NULL, 'h'},
{NULL, 0, 0, 0} {NULL, 0, NULL, 0}
}; };
#define next (current^1) #define next (current^1)
@ -224,7 +224,7 @@ int main(int argc, char **argv)
* write is not sizeof(int), the multiplier is not * write is not sizeof(int), the multiplier is not
* changed. */ * changed. */
if (mult) { if (mult) {
multiplier = strtoul(mult, 0, 10); multiplier = strtoul(mult, NULL, 10);
to_write = sizeof(int); to_write = sizeof(int);
} else { } else {
multiplier = 0; multiplier = 0;

View File

@ -168,7 +168,7 @@ static int get_basetimes(struct rtcwake_control *ctl, int fd)
return -1; return -1;
} }
ctl->sys_time = time(0); ctl->sys_time = time(NULL);
if (ctl->sys_time == (time_t)-1) { if (ctl->sys_time == (time_t)-1) {
warn(_("read system time failed")); warn(_("read system time failed"));
return -1; return -1;
@ -413,21 +413,21 @@ int main(int argc, char **argv)
OPT_LIST OPT_LIST
}; };
static const struct option long_options[] = { static const struct option long_options[] = {
{"adjfile", required_argument, 0, 'A'}, { "adjfile", required_argument, NULL, 'A' },
{"auto", no_argument, 0, 'a'}, { "auto", no_argument, NULL, 'a' },
{"dry-run", no_argument, 0, 'n'}, { "dry-run", no_argument, NULL, 'n' },
{"local", no_argument, 0, 'l'}, { "local", no_argument, NULL, 'l' },
{"utc", no_argument, 0, 'u'}, { "utc", no_argument, NULL, 'u' },
{"verbose", no_argument, 0, 'v'}, { "verbose", no_argument, NULL, 'v' },
{"version", no_argument, 0, 'V'}, { "version", no_argument, NULL, 'V' },
{"help", no_argument, 0, 'h'}, { "help", no_argument, NULL, 'h' },
{"mode", required_argument, 0, 'm'}, { "mode", required_argument, NULL, 'm' },
{"device", required_argument, 0, 'd'}, { "device", required_argument, NULL, 'd' },
{"seconds", required_argument, 0, 's'}, { "seconds", required_argument, NULL, 's' },
{"time", required_argument, 0, 't'}, { "time", required_argument, NULL, 't' },
{"date", required_argument, 0, OPT_DATE}, { "date", required_argument, NULL, OPT_DATE },
{"list-modes", no_argument, 0, OPT_LIST}, { "list-modes", no_argument, NULL, OPT_LIST },
{0, 0, 0, 0 } { NULL, 0, NULL, 0 }
}; };
static const ul_excl_t excl[] = { static const ul_excl_t excl[] = {
{ 'a', 'l', 'u' }, { 'a', 'l', 'u' },

View File

@ -252,7 +252,7 @@ static void dump_label(const char *name)
static void dump_groups(void) static void dump_groups(void)
{ {
int n = getgroups(0, 0); int n = getgroups(0, NULL);
gid_t *groups; gid_t *groups;
if (n < 0) { if (n < 0) {
@ -602,27 +602,27 @@ int main(int argc, char **argv)
}; };
static const struct option longopts[] = { static const struct option longopts[] = {
{"dump", no_argument, 0, 'd'}, { "dump", no_argument, NULL, 'd' },
{"nnp", no_argument, 0, NNP}, { "nnp", no_argument, NULL, NNP },
{"no-new-privs", no_argument, 0, NNP}, { "no-new-privs", no_argument, NULL, NNP },
{"inh-caps", required_argument, 0, INHCAPS}, { "inh-caps", required_argument, NULL, INHCAPS },
{"list-caps", no_argument, 0, LISTCAPS}, { "list-caps", no_argument, NULL, LISTCAPS },
{"ruid", required_argument, 0, RUID}, { "ruid", required_argument, NULL, RUID },
{"euid", required_argument, 0, EUID}, { "euid", required_argument, NULL, EUID },
{"rgid", required_argument, 0, RGID}, { "rgid", required_argument, NULL, RGID },
{"egid", required_argument, 0, EGID}, { "egid", required_argument, NULL, EGID },
{"reuid", required_argument, 0, REUID}, { "reuid", required_argument, NULL, REUID },
{"regid", required_argument, 0, REGID}, { "regid", required_argument, NULL, REGID },
{"clear-groups", no_argument, 0, CLEAR_GROUPS}, { "clear-groups", no_argument, NULL, CLEAR_GROUPS },
{"keep-groups", no_argument, 0, KEEP_GROUPS}, { "keep-groups", no_argument, NULL, KEEP_GROUPS },
{"groups", required_argument, 0, GROUPS}, { "groups", required_argument, NULL, GROUPS },
{"bounding-set", required_argument, 0, CAPBSET}, { "bounding-set", required_argument, NULL, CAPBSET },
{"securebits", required_argument, 0, SECUREBITS}, { "securebits", required_argument, NULL, SECUREBITS },
{"selinux-label", required_argument, 0, SELINUX_LABEL}, { "selinux-label", required_argument, NULL, SELINUX_LABEL },
{"apparmor-profile", required_argument, 0, APPARMOR_PROFILE}, { "apparmor-profile", required_argument, NULL, APPARMOR_PROFILE },
{"help", no_argument, 0, 'h'}, { "help", no_argument, NULL, 'h' },
{"version", no_argument, 0, 'V'}, { "version", no_argument, NULL, 'V' },
{NULL, 0, 0, 0} { NULL, 0, NULL, 0 }
}; };
static const ul_excl_t excl[] = { static const ul_excl_t excl[] = {

View File

@ -188,11 +188,11 @@ int main(int argc, char *argv[])
size_t i; size_t i;
static const struct option long_opts[] = { static const struct option long_opts[] = {
{ "all", 0, 0, 'a' }, { "all", no_argument, NULL, 'a' },
{ "help", 0, 0, 'h' }, { "help", no_argument, NULL, 'h' },
{ "verbose", 0, 0, 'v' }, { "verbose", no_argument, NULL, 'v' },
{ "version", 0, 0, 'V' }, { "version", no_argument, NULL, 'V' },
{ NULL, 0, 0, 0 } { NULL, 0, NULL, 0 }
}; };
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");

View File

@ -693,7 +693,7 @@ static int parse_options(struct swap_prop *props, const char *options)
assert(props); assert(props);
assert(options); 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; props->no_fail = 1;
if (mnt_optstr_get_option(options, "discard", &arg, &argsz) == 0) { 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[] = { static const struct option long_opts[] = {
{ "priority", 1, 0, 'p' }, { "priority", required_argument, NULL, 'p' },
{ "discard", 2, 0, 'd' }, { "discard", optional_argument, NULL, 'd' },
{ "ifexists", 0, 0, 'e' }, { "ifexists", no_argument, NULL, 'e' },
{ "options", 2, 0, 'o' }, { "options", optional_argument, NULL, 'o' },
{ "summary", 0, 0, 's' }, { "summary", no_argument, NULL, 's' },
{ "fixpgsz", 0, 0, 'f' }, { "fixpgsz", no_argument, NULL, 'f' },
{ "all", 0, 0, 'a' }, { "all", no_argument, NULL, 'a' },
{ "help", 0, 0, 'h' }, { "help", no_argument, NULL, 'h' },
{ "verbose", 0, 0, 'v' }, { "verbose", no_argument, NULL, 'v' },
{ "version", 0, 0, 'V' }, { "version", no_argument, NULL, 'V' },
{ "show", 2, 0, SHOW_OPTION }, { "show", optional_argument, NULL, SHOW_OPTION },
{ "noheadings", 0, 0, NOHEADINGS_OPTION }, { "noheadings", no_argument, NULL, NOHEADINGS_OPTION },
{ "raw", 0, 0, RAW_OPTION }, { "raw", no_argument, NULL, RAW_OPTION },
{ "bytes", 0, 0, BYTES_OPTION }, { "bytes", no_argument, NULL, BYTES_OPTION },
{ NULL, 0, 0, 0 } { NULL, 0, NULL, 0 }
}; };
static const ul_excl_t excl[] = { /* rows and cols in ASCII order */ static const ul_excl_t excl[] = { /* rows and cols in ASCII order */

View File

@ -148,7 +148,7 @@ int main(int argc, char **argv)
print_usage(stderr); print_usage(stderr);
cmdst = cmds = xmalloc(sizeof(struct command)); cmdst = cmds = xmalloc(sizeof(struct command));
cmds->next = 0; cmds->next = NULL;
show_irq = 1; show_irq = 1;
while ((c = getopt_long(argc, argv, "t:c:w:a:i:ho:C:sq:rT:vV", longopts, NULL)) != -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->val = strtol_or_err(optarg, _("argument error"));
cmds->next = xmalloc(sizeof(struct command)); cmds->next = xmalloc(sizeof(struct command));
cmds = cmds->next; cmds = cmds->next;
cmds->next = 0; cmds->next = NULL;
break; break;
case 't': case 't':
cmds->op = LPTIME; cmds->op = LPTIME;
cmds->val = strtol_or_err(optarg, _("argument error")); cmds->val = strtol_or_err(optarg, _("argument error"));
cmds->next = xmalloc(sizeof(struct command)); cmds->next = xmalloc(sizeof(struct command));
cmds = cmds->next; cmds = cmds->next;
cmds->next = 0; cmds->next = NULL;
break; break;
case 'c': case 'c':
cmds->op = LPCHAR; cmds->op = LPCHAR;
cmds->val = strtol_or_err(optarg, _("argument error")); cmds->val = strtol_or_err(optarg, _("argument error"));
cmds->next = xmalloc(sizeof(struct command)); cmds->next = xmalloc(sizeof(struct command));
cmds = cmds->next; cmds = cmds->next;
cmds->next = 0; cmds->next = NULL;
break; break;
case 'w': case 'w':
cmds->op = LPWAIT; cmds->op = LPWAIT;
cmds->val = strtol_or_err(optarg, _("argument error")); cmds->val = strtol_or_err(optarg, _("argument error"));
cmds->next = xmalloc(sizeof(struct command)); cmds->next = xmalloc(sizeof(struct command));
cmds = cmds->next; cmds = cmds->next;
cmds->next = 0; cmds->next = NULL;
break; break;
case 'a': case 'a':
cmds->op = LPABORT; cmds->op = LPABORT;
cmds->val = parse_switch(optarg, _("argument error"), "on", "off", NULL); cmds->val = parse_switch(optarg, _("argument error"), "on", "off", NULL);
cmds->next = xmalloc(sizeof(struct command)); cmds->next = xmalloc(sizeof(struct command));
cmds = cmds->next; cmds = cmds->next;
cmds->next = 0; cmds->next = NULL;
break; break;
case 'q': case 'q':
show_irq = parse_switch(optarg, _("argument error"), "on", "off", NULL); 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->val = parse_switch(optarg, _("argument error"), "on", "off", NULL);
cmds->next = xmalloc(sizeof(struct command)); cmds->next = xmalloc(sizeof(struct command));
cmds = cmds->next; cmds = cmds->next;
cmds->next = 0; cmds->next = NULL;
break; break;
case 'C': case 'C':
cmds->op = LPCAREFUL; cmds->op = LPCAREFUL;
cmds->val = parse_switch(optarg, _("argument error"), "on", "off", NULL); cmds->val = parse_switch(optarg, _("argument error"), "on", "off", NULL);
cmds->next = xmalloc(sizeof(struct command)); cmds->next = xmalloc(sizeof(struct command));
cmds = cmds->next; cmds = cmds->next;
cmds->next = 0; cmds->next = NULL;
break; break;
case 's': case 's':
show_irq = 0; show_irq = 0;
@ -214,14 +214,14 @@ int main(int argc, char **argv)
cmds->val = 0; cmds->val = 0;
cmds->next = xmalloc(sizeof(struct command)); cmds->next = xmalloc(sizeof(struct command));
cmds = cmds->next; cmds = cmds->next;
cmds->next = 0; cmds->next = NULL;
break; break;
case 'r': case 'r':
cmds->op = LPRESET; cmds->op = LPRESET;
cmds->val = 0; cmds->val = 0;
cmds->next = xmalloc(sizeof(struct command)); cmds->next = xmalloc(sizeof(struct command));
cmds = cmds->next; cmds = cmds->next;
cmds->next = 0; cmds->next = NULL;
break; break;
case 'T': case 'T':
/* Note: this will do the wrong thing on /* 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->val = parse_switch(optarg, _("argument error"), "on", "off", NULL);
cmds->next = xmalloc(sizeof(struct command)); cmds->next = xmalloc(sizeof(struct command));
cmds = cmds->next; cmds = cmds->next;
cmds->next = 0; cmds->next = NULL;
break; break;
case 'v': case 'v':
case 'V': case 'V':

View File

@ -508,23 +508,23 @@ int main(int argc, char **argv)
}; };
static const struct option longopts[] = { static const struct option longopts[] = {
{ "all", 0, 0, 'a' }, { "all", no_argument, NULL, 'a' },
{ "all-targets", 0, 0, 'A' }, { "all-targets", no_argument, NULL, 'A' },
{ "detach-loop", 0, 0, 'd' }, { "detach-loop", no_argument, NULL, 'd' },
{ "fake", 0, 0, UMOUNT_OPT_FAKE }, { "fake", no_argument, NULL, UMOUNT_OPT_FAKE },
{ "force", 0, 0, 'f' }, { "force", no_argument, NULL, 'f' },
{ "help", 0, 0, 'h' }, { "help", no_argument, NULL, 'h' },
{ "internal-only", 0, 0, 'i' }, { "internal-only", no_argument, NULL, 'i' },
{ "lazy", 0, 0, 'l' }, { "lazy", no_argument, NULL, 'l' },
{ "no-canonicalize", 0, 0, 'c' }, { "no-canonicalize", no_argument, NULL, 'c' },
{ "no-mtab", 0, 0, 'n' }, { "no-mtab", no_argument, NULL, 'n' },
{ "read-only", 0, 0, 'r' }, { "read-only", no_argument, NULL, 'r' },
{ "recursive", 0, 0, 'R' }, { "recursive", no_argument, NULL, 'R' },
{ "test-opts", 1, 0, 'O' }, { "test-opts", required_argument, NULL, 'O' },
{ "types", 1, 0, 't' }, { "types", required_argument, NULL, 't' },
{ "verbose", 0, 0, 'v' }, { "verbose", no_argument, NULL, 'v' },
{ "version", 0, 0, 'V' }, { "version", no_argument, NULL, 'V' },
{ NULL, 0, 0, 0 } { NULL, 0, NULL, 0 }
}; };
static const ul_excl_t excl[] = { /* rows and cols in ASCII order */ static const ul_excl_t excl[] = { /* rows and cols in ASCII order */

View File

@ -280,23 +280,23 @@ int main(int argc, char *argv[])
OPT_SETGROUPS OPT_SETGROUPS
}; };
static const struct option longopts[] = { static const struct option longopts[] = {
{ "help", no_argument, 0, 'h' }, { "help", no_argument, NULL, 'h' },
{ "version", no_argument, 0, 'V'}, { "version", no_argument, NULL, 'V' },
{ "mount", optional_argument, 0, 'm' }, { "mount", optional_argument, NULL, 'm' },
{ "uts", optional_argument, 0, 'u' }, { "uts", optional_argument, NULL, 'u' },
{ "ipc", optional_argument, 0, 'i' }, { "ipc", optional_argument, NULL, 'i' },
{ "net", optional_argument, 0, 'n' }, { "net", optional_argument, NULL, 'n' },
{ "pid", optional_argument, 0, 'p' }, { "pid", optional_argument, NULL, 'p' },
{ "user", optional_argument, 0, 'U' }, { "user", optional_argument, NULL, 'U' },
{ "cgroup", optional_argument, 0, 'C' }, { "cgroup", optional_argument, NULL, 'C' },
{ "fork", no_argument, 0, 'f' }, { "fork", no_argument, NULL, 'f' },
{ "mount-proc", optional_argument, 0, OPT_MOUNTPROC }, { "mount-proc", optional_argument, NULL, OPT_MOUNTPROC },
{ "map-root-user", no_argument, 0, 'r' }, { "map-root-user", no_argument, NULL, 'r' },
{ "propagation", required_argument, 0, OPT_PROPAGATION }, { "propagation", required_argument, NULL, OPT_PROPAGATION },
{ "setgroups", required_argument, 0, OPT_SETGROUPS }, { "setgroups", required_argument, NULL, OPT_SETGROUPS },
{ NULL, 0, 0, 0 } { NULL, 0, NULL, 0 }
}; };
int setgrpcmd = SETGROUPS_NONE; int setgrpcmd = SETGROUPS_NONE;

View File

@ -628,41 +628,41 @@ static void parse_args(int argc, char **argv, struct options *op)
RELOAD_OPTION, RELOAD_OPTION,
}; };
const struct option longopts[] = { const struct option longopts[] = {
{ "8bits", no_argument, 0, '8' }, { "8bits", no_argument, NULL, '8' },
{ "autologin", required_argument, 0, 'a' }, { "autologin", required_argument, NULL, 'a' },
{ "noreset", no_argument, 0, 'c' }, { "noreset", no_argument, NULL, 'c' },
{ "chdir", required_argument, 0, 'C' }, { "chdir", required_argument, NULL, 'C' },
{ "delay", required_argument, 0, 'd' }, { "delay", required_argument, NULL, 'd' },
{ "remote", no_argument, 0, 'E' }, { "remote", no_argument, NULL, 'E' },
{ "issue-file", required_argument, 0, 'f' }, { "issue-file", required_argument, NULL, 'f' },
{ "flow-control", no_argument, 0, 'h' }, { "flow-control", no_argument, NULL, 'h' },
{ "host", required_argument, 0, 'H' }, { "host", required_argument, NULL, 'H' },
{ "noissue", no_argument, 0, 'i' }, { "noissue", no_argument, NULL, 'i' },
{ "init-string", required_argument, 0, 'I' }, { "init-string", required_argument, NULL, 'I' },
{ "noclear", no_argument, 0, 'J' }, { "noclear", no_argument, NULL, 'J' },
{ "login-program", required_argument, 0, 'l' }, { "login-program", required_argument, NULL, 'l' },
{ "local-line", optional_argument, 0, 'L' }, { "local-line", optional_argument, NULL, 'L' },
{ "extract-baud", no_argument, 0, 'm' }, { "extract-baud", no_argument, NULL, 'm' },
{ "skip-login", no_argument, 0, 'n' }, { "skip-login", no_argument, NULL, 'n' },
{ "nonewline", no_argument, 0, 'N' }, { "nonewline", no_argument, NULL, 'N' },
{ "login-options", required_argument, 0, 'o' }, { "login-options", required_argument, NULL, 'o' },
{ "login-pause", no_argument, 0, 'p' }, { "login-pause", no_argument, NULL, 'p' },
{ "nice", required_argument, 0, 'P' }, { "nice", required_argument, NULL, 'P' },
{ "chroot", required_argument, 0, 'r' }, { "chroot", required_argument, NULL, 'r' },
{ "hangup", no_argument, 0, 'R' }, { "hangup", no_argument, NULL, 'R' },
{ "keep-baud", no_argument, 0, 's' }, { "keep-baud", no_argument, NULL, 's' },
{ "timeout", required_argument, 0, 't' }, { "timeout", required_argument, NULL, 't' },
{ "detect-case", no_argument, 0, 'U' }, { "detect-case", no_argument, NULL, 'U' },
{ "wait-cr", no_argument, 0, 'w' }, { "wait-cr", no_argument, NULL, 'w' },
{ "nohints", no_argument, 0, NOHINTS_OPTION }, { "nohints", no_argument, NULL, NOHINTS_OPTION },
{ "nohostname", no_argument, 0, NOHOSTNAME_OPTION }, { "nohostname", no_argument, NULL, NOHOSTNAME_OPTION },
{ "long-hostname", no_argument, 0, LONGHOSTNAME_OPTION }, { "long-hostname", no_argument, NULL, LONGHOSTNAME_OPTION },
{ "reload", no_argument, 0, RELOAD_OPTION }, { "reload", no_argument, NULL, RELOAD_OPTION },
{ "version", no_argument, 0, VERSION_OPTION }, { "version", no_argument, NULL, VERSION_OPTION },
{ "help", no_argument, 0, HELP_OPTION }, { "help", no_argument, NULL, HELP_OPTION },
{ "erase-chars", required_argument, 0, ERASE_CHARS_OPTION }, { "erase-chars", required_argument, NULL, ERASE_CHARS_OPTION },
{ "kill-chars", required_argument, 0, KILL_CHARS_OPTION }, { "kill-chars", required_argument, NULL, KILL_CHARS_OPTION },
{ NULL, 0, 0, 0 } { NULL, 0, NULL, 0 }
}; };
while ((c = getopt_long(argc, argv, while ((c = getopt_long(argc, argv,

View File

@ -93,10 +93,10 @@ int main(int argc, char *argv[])
int ch, fd, verbose = FALSE, ret; int ch, fd, verbose = FALSE, ret;
static const struct option longopts[] = { static const struct option longopts[] = {
{ "verbose", no_argument, 0, 'v' }, { "verbose", no_argument, NULL, 'v' },
{ "version", no_argument, 0, 'V' }, { "version", no_argument, NULL, 'V' },
{ "help", no_argument, 0, 'h' }, { "help", no_argument, NULL, 'h' },
{ NULL, 0, 0, 0 } { NULL, 0, NULL, 0 }
}; };
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");

View File

@ -1166,7 +1166,7 @@ static void init_terminal(struct setterm_control *ctl)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
struct setterm_control ctl = { 0 }; struct setterm_control ctl = { NULL };
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR); bindtextdomain(PACKAGE, LOCALEDIR);

View File

@ -182,12 +182,12 @@ int main(int argc, char **argv)
int mvecsz = 0; int mvecsz = 0;
static const struct option longopts[] = { static const struct option longopts[] = {
{ "nobanner", no_argument, 0, 'n' }, { "nobanner", no_argument, NULL, 'n' },
{ "timeout", required_argument, 0, 't' }, { "timeout", required_argument, NULL, 't' },
{ "group", required_argument, 0, 'g' }, { "group", required_argument, NULL, 'g' },
{ "version", no_argument, 0, 'V' }, { "version", no_argument, NULL, 'V' },
{ "help", no_argument, 0, 'h' }, { "help", no_argument, NULL, 'h' },
{ NULL, 0, 0, 0 } { NULL, 0, NULL, 0 }
}; };
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");

View File

@ -173,15 +173,15 @@ int main(int argc, char **argv)
int ret = EXIT_SUCCESS; int ret = EXIT_SUCCESS;
static const struct option longopts[] = { static const struct option longopts[] = {
{ "no-backspaces", no_argument, 0, 'b' }, { "no-backspaces", no_argument, NULL, 'b' },
{ "fine", no_argument, 0, 'f' }, { "fine", no_argument, NULL, 'f' },
{ "pass", no_argument, 0, 'p' }, { "pass", no_argument, NULL, 'p' },
{ "tabs", no_argument, 0, 'h' }, { "tabs", no_argument, NULL, 'h' },
{ "spaces", no_argument, 0, 'x' }, { "spaces", no_argument, NULL, 'x' },
{ "lines", required_argument, 0, 'l' }, { "lines", required_argument, NULL, 'l' },
{ "version", no_argument, 0, 'V' }, { "version", no_argument, NULL, 'V' },
{ "help", no_argument, 0, 'H' }, { "help", no_argument, NULL, 'H' },
{ NULL, 0, 0, 0 } { NULL, 0, NULL, 0 }
}; };
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");

View File

@ -224,7 +224,7 @@ static void colcrt(struct colcrt_control *ctl)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
struct colcrt_control ctl = { 0 }; struct colcrt_control ctl = { NULL };
int opt; int opt;
enum { NO_UL_OPTION = CHAR_MAX + 1 }; enum { NO_UL_OPTION = CHAR_MAX + 1 };

View File

@ -158,9 +158,9 @@ int main(int argc, char **argv)
int opt; int opt;
static const struct option longopts[] = { static const struct option longopts[] = {
{"version", no_argument, 0, 'V'}, {"version", no_argument, NULL, 'V'},
{"help", no_argument, 0, 'h'}, {"help", no_argument, NULL, 'h'},
{NULL, 0, 0, 0} {NULL, 0, NULL, 0}
}; };
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");

View File

@ -152,15 +152,15 @@ int main(int argc, char **argv)
static const struct option longopts[] = static const struct option longopts[] =
{ {
{ "columns", 1, 0, 'c' }, /* deprecated */ { "columns", required_argument, NULL, 'c' }, /* deprecated */
{ "fillrows", 0, 0, 'x' }, { "fillrows", no_argument, NULL, 'x' },
{ "help", 0, 0, 'h' }, { "help", no_argument, NULL, 'h' },
{ "output-separator", 1, 0, 'o' }, { "output-separator", required_argument, NULL, 'o' },
{ "output-width", 1, 0, 'c' }, { "output-width", required_argument, NULL, 'c' },
{ "separator", 1, 0, 's' }, { "separator", required_argument, NULL, 's' },
{ "table", 0, 0, 't' }, { "table", no_argument, NULL, 't' },
{ "version", 0, 0, 'V' }, { "version", no_argument, NULL, 'V' },
{ NULL, 0, 0, 0 }, { NULL, 0, NULL, 0 },
}; };
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");

View File

@ -1481,7 +1481,7 @@ void do_shell(char *filename)
putsout(shell_line); putsout(shell_line);
else { else {
ttyin(cmdbuf, sizeof(cmdbuf) - 2, '!'); ttyin(cmdbuf, sizeof(cmdbuf) - 2, '!');
expanded = 0; expanded = NULL;
rc = expand(&expanded, cmdbuf); rc = expand(&expanded, cmdbuf);
if (expanded) { if (expanded) {
if (strlen(expanded) < sizeof(shell_line)) if (strlen(expanded) < sizeof(shell_line))
@ -1634,7 +1634,7 @@ void execute(char *filename, char *cmd, ...)
signal(SIGQUIT, SIG_IGN); signal(SIGQUIT, SIG_IGN);
if (catch_susp) if (catch_susp)
signal(SIGTSTP, SIG_DFL); signal(SIGTSTP, SIG_DFL);
while (wait(0) > 0) ; while (wait(NULL) > 0) ;
signal(SIGINT, end_it); signal(SIGINT, end_it);
signal(SIGQUIT, onquit); signal(SIGQUIT, onquit);
if (catch_susp) if (catch_susp)

View File

@ -106,9 +106,9 @@ int main(int argc, char *argv[])
int ch, rval = EXIT_SUCCESS; int ch, rval = EXIT_SUCCESS;
static const struct option longopts[] = { static const struct option longopts[] = {
{ "version", no_argument, 0, 'V' }, { "version", no_argument, NULL, 'V' },
{ "help", no_argument, 0, 'h' }, { "help", no_argument, NULL, 'h' },
{ NULL, 0, 0, 0 } { NULL, 0, NULL, 0 }
}; };
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");

View File

@ -66,7 +66,7 @@ static void tailf(const char *filename, size_t lines, struct stat *st)
fd = open(filename, O_RDONLY); fd = open(filename, O_RDONLY);
if (fd < 0) if (fd < 0)
err(EXIT_FAILURE, _("cannot open %s"), filename); 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; i = (size_t) st->st_size - 1;
/* humans do not think last new line in a file should be counted, /* 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; struct stat st;
static const struct option longopts[] = { static const struct option longopts[] = {
{ "lines", required_argument, 0, 'n' }, { "lines", required_argument, NULL, 'n' },
{ "version", no_argument, 0, 'V' }, { "version", no_argument, NULL, 'V' },
{ "help", no_argument, 0, 'h' }, { "help", no_argument, NULL, 'h' },
{ NULL, 0, 0, 0 } { NULL, 0, NULL, 0 }
}; };
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");

View File

@ -157,11 +157,11 @@ int main(int argc, char **argv)
FILE *f; FILE *f;
static const struct option longopts[] = { static const struct option longopts[] = {
{ "terminal", required_argument, 0, 't' }, { "terminal", required_argument, NULL, 't' },
{ "indicated", no_argument, 0, 'i' }, { "indicated", no_argument, NULL, 'i' },
{ "version", no_argument, 0, 'V' }, { "version", no_argument, NULL, 'V' },
{ "help", no_argument, 0, 'h' }, { "help", no_argument, NULL, 'h' },
{ NULL, 0, 0, 0 } { NULL, 0, NULL, 0 }
}; };
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");