From: Pádraig Brady
Date: Sun, 18 Jan 2026 15:55:38 +0000 (+0000)
Subject: maint: prefer NULL to nullptr
X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=71ea30a7422125dd644f8f0c389dda98aee907fc;p=thirdparty%2Fcoreutils.git
maint: prefer NULL to nullptr
NULL is best for C as discussed at:
https://bugs.gnu.org/66221#53
* bootstrap.conf: Remove dependency on nullptr.
* s/nullptr/NULL/.
---
diff --git a/bootstrap.conf b/bootstrap.conf
index 501fc7cf00..07ab7e7e6f 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -202,7 +202,6 @@ gnulib_modules="
mpsort
nproc
nstrftime
- nullptr
obstack
open
openat-safer
diff --git a/gl/lib/heap.c b/gl/lib/heap.c
index 7fb4751a94..567e021902 100644
--- a/gl/lib/heap.c
+++ b/gl/lib/heap.c
@@ -50,7 +50,7 @@ heap_alloc (int (*compare) (void const *, void const *), idx_t n_reserve)
heap->array = xnmalloc (n_reserve, sizeof *(heap->array));
- heap->array[0] = nullptr;
+ heap->array[0] = NULL;
heap->capacity = n_reserve;
heap->count = 0;
heap->compare = compare ? compare : heap_default_compare;
@@ -96,7 +96,7 @@ heap_remove_top (struct heap *heap)
void *top;
if (heap->count == 0)
- return nullptr;
+ return NULL;
top = heap->array[1];
heap->array[1] = heap->array[heap->count--];
diff --git a/gl/lib/randint.c b/gl/lib/randint.c
index b4788f063d..bd3ce38217 100644
--- a/gl/lib/randint.c
+++ b/gl/lib/randint.c
@@ -35,8 +35,8 @@ int
main (int argc, char **argv)
{
randint i;
- randint n = strtoumax (argv[1], nullptr, 10);
- randint choices = strtoumax (argv[2], nullptr, 10);
+ randint n = strtoumax (argv[1], NULL, 10);
+ randint choices = strtoumax (argv[2], NULL, 10);
char const *name = argv[3];
struct randint_source *ints = randint_all_new (name, SIZE_MAX);
@@ -77,14 +77,14 @@ randint_new (struct randread_source *source)
}
/* Create a new randint_source by creating a randread_source from
- NAME and ESTIMATED_BYTES. Return nullptr (setting errno) if
+ NAME and ESTIMATED_BYTES. Return NULL (setting errno) if
unsuccessful. */
struct randint_source *
randint_all_new (char const *name, size_t bytes_bound)
{
struct randread_source *source = randread_new (name, bytes_bound);
- return (source ? randint_new (source) : nullptr);
+ return (source ? randint_new (source) : NULL);
}
/* Return the random data source of *S. */
diff --git a/gl/lib/randperm.c b/gl/lib/randperm.c
index cbc5c794f8..7c77f4d748 100644
--- a/gl/lib/randperm.c
+++ b/gl/lib/randperm.c
@@ -98,7 +98,7 @@ typedef Hash_table sparse_map;
static sparse_map *
sparse_new (size_t size_hint)
{
- return hash_initialize (size_hint, nullptr, sparse_hash_, sparse_cmp_, free);
+ return hash_initialize (size_hint, NULL, sparse_hash_, sparse_cmp_, free);
}
/* Swap the values for I and J. If a value is not already present
@@ -143,7 +143,7 @@ sparse_free (sparse_map *sv)
/* From R, allocate and return a malloc'd array of the first H elements
of a random permutation of N elements. H must not exceed N.
- Return nullptr if H is zero. */
+ Return NULL if H is zero. */
size_t *
randperm_new (struct randint_source *r, size_t h, size_t n)
@@ -153,7 +153,7 @@ randperm_new (struct randint_source *r, size_t h, size_t n)
switch (h)
{
case 0:
- v = nullptr;
+ v = NULL;
break;
case 1:
@@ -198,13 +198,13 @@ randperm_new (struct randint_source *r, size_t h, size_t n)
if (sparse)
{
sv = sparse_new (h * 2);
- if (sv == nullptr)
+ if (sv == NULL)
xalloc_die ();
v = xnmalloc (h, sizeof *v);
}
else
{
- sv = nullptr; /* To placate GCC's -Wuninitialized. */
+ sv = NULL; /* To placate GCC's -Wuninitialized. */
v = xnmalloc (n, sizeof *v);
for (i = 0; i < n; i++)
v[i] = i;
diff --git a/gl/lib/randread.c b/gl/lib/randread.c
index cbe54e3916..be0267a64e 100644
--- a/gl/lib/randread.c
+++ b/gl/lib/randread.c
@@ -167,21 +167,21 @@ randread_free_body (struct randread_source *s)
default handler. Unless a non-default handler is used, NAME's
lifetime should be at least that of the returned value.
- Return nullptr (setting errno) on failure. */
+ Return NULL (setting errno) on failure. */
struct randread_source *
randread_new (char const *name, size_t bytes_bound)
{
if (bytes_bound == 0)
- return simple_new (nullptr, nullptr);
+ return simple_new (NULL, NULL);
else
{
- FILE *source = nullptr;
+ FILE *source = NULL;
struct randread_source *s;
if (name)
if (! (source = fopen_safer (name, "rb")))
- return nullptr;
+ return NULL;
s = simple_new (source, name);
@@ -206,7 +206,7 @@ randread_new (char const *name, size_t bytes_bound)
int e = errno;
randread_free_body (s);
errno = e;
- return nullptr;
+ return NULL;
}
isaac_seed (&s->buf.isaac.state);
}
diff --git a/gl/lib/root-dev-ino.c b/gl/lib/root-dev-ino.c
index d183488871..87f404e437 100644
--- a/gl/lib/root-dev-ino.c
+++ b/gl/lib/root-dev-ino.c
@@ -23,14 +23,14 @@
#include
/* Call lstat to get the device and inode numbers for '/'.
- Upon failure, return nullptr. Otherwise, set the members of
+ Upon failure, return NULL. Otherwise, set the members of
*ROOT_D_I accordingly and return ROOT_D_I. */
struct dev_ino *
get_root_dev_ino (struct dev_ino *root_d_i)
{
struct stat statbuf;
if (lstat ("/", &statbuf))
- return nullptr;
+ return NULL;
root_d_i->st_ino = statbuf.st_ino;
root_d_i->st_dev = statbuf.st_dev;
return root_d_i;
diff --git a/gl/lib/smack.h b/gl/lib/smack.h
index 58e5ca45e8..e0ed63d4f4 100644
--- a/gl/lib/smack.h
+++ b/gl/lib/smack.h
@@ -37,7 +37,7 @@ static inline bool
is_smack_enabled (void)
{
#ifdef HAVE_SMACK
- return smack_smackfs_path () != nullptr;
+ return smack_smackfs_path () != NULL;
#else
return false;
#endif
diff --git a/gl/lib/xdectoint.c b/gl/lib/xdectoint.c
index 0a7c0d7cab..c367be9b1e 100644
--- a/gl/lib/xdectoint.c
+++ b/gl/lib/xdectoint.c
@@ -44,7 +44,7 @@ __xnumtoint (char const *n_str, int base, __xdectoint_t min, __xdectoint_t max,
int flags)
{
__xdectoint_t tnum, r;
- strtol_error s_err = __xstrtol (n_str, nullptr, base, &tnum, suffixes);
+ strtol_error s_err = __xstrtol (n_str, NULL, base, &tnum, suffixes);
/* Errno value to report if there is an overflow. */
int overflow_errno;
diff --git a/gl/lib/xfts.c b/gl/lib/xfts.c
index 2145996ff3..9c5f10d6bc 100644
--- a/gl/lib/xfts.c
+++ b/gl/lib/xfts.c
@@ -33,7 +33,7 @@ xfts_open (char * const *argv, int options,
int (*compar) (const FTSENT **, const FTSENT **))
{
FTS *fts = fts_open (argv, options | FTS_CWDFD, compar);
- if (fts == nullptr)
+ if (fts == NULL)
{
/* This can fail in two ways: out of memory or with errno==EINVAL,
which indicates it was called with invalid bit_flags. */
diff --git a/gl/tests/test-fadvise.c b/gl/tests/test-fadvise.c
index 10cd8bec2d..ad561f55b8 100644
--- a/gl/tests/test-fadvise.c
+++ b/gl/tests/test-fadvise.c
@@ -36,7 +36,7 @@ main (void)
fdadvise (fileno (stdin), 0, 0, FADVISE_RANDOM);
/* Ignored. */
- fadvise (nullptr, FADVISE_RANDOM);
+ fadvise (NULL, FADVISE_RANDOM);
/* Invalid. */
fdadvise (42, 0, 0, FADVISE_RANDOM);
diff --git a/gl/tests/test-rand-isaac.c b/gl/tests/test-rand-isaac.c
index 5274962e60..f53fffc426 100644
--- a/gl/tests/test-rand-isaac.c
+++ b/gl/tests/test-rand-isaac.c
@@ -581,7 +581,7 @@ main (int argc, char **argv)
/* If invoked with a positive argument, run a benchmark;
if with a negative, run a do-nothing benchmark. */
- for (iterations = argc <= 1 ? 0 : strtol (argv[1], nullptr, 10);
+ for (iterations = argc <= 1 ? 0 : strtol (argv[1], NULL, 10);
iterations != 0;
iterations += (iterations < 0 ? 1 : -1))
if (0 <= iterations)
diff --git a/src/basename.c b/src/basename.c
index 1aed79cb88..dff06fef15 100644
--- a/src/basename.c
+++ b/src/basename.c
@@ -29,12 +29,12 @@
static struct option const longopts[] =
{
- {"multiple", no_argument, nullptr, 'a'},
- {"suffix", required_argument, nullptr, 's'},
- {"zero", no_argument, nullptr, 'z'},
+ {"multiple", no_argument, NULL, 'a'},
+ {"suffix", required_argument, NULL, 's'},
+ {"zero", no_argument, NULL, 'z'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
void
@@ -121,7 +121,7 @@ main (int argc, char **argv)
{
bool multiple_names = false;
bool use_nuls = false;
- char const *suffix = nullptr;
+ char const *suffix = NULL;
initialize_main (&argc, &argv);
set_program_name (argv[0]);
@@ -133,7 +133,7 @@ main (int argc, char **argv)
while (true)
{
- int c = getopt_long (argc, argv, "+as:z", longopts, nullptr);
+ int c = getopt_long (argc, argv, "+as:z", longopts, NULL);
if (c == -1)
break;
@@ -180,7 +180,7 @@ main (int argc, char **argv)
}
else
perform_basename (argv[optind],
- optind + 2 == argc ? argv[optind + 1] : nullptr,
+ optind + 2 == argc ? argv[optind + 1] : NULL,
use_nuls);
return EXIT_SUCCESS;
diff --git a/src/basenc.c b/src/basenc.c
index b5a27e49e2..1804fc83fa 100644
--- a/src/basenc.c
+++ b/src/basenc.c
@@ -90,7 +90,7 @@ static struct option const long_options[] =
#endif
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
void
@@ -833,7 +833,7 @@ z85_length (idx_t len)
static bool
isuz85 (unsigned char ch)
{
- return c_isalnum (ch) || strchr (".-:+=^!/*?&<>()[]{}@%$#", ch) != nullptr;
+ return c_isalnum (ch) || strchr (".-:+=^!/*?&<>()[]{}@%$#", ch) != NULL;
}
static char const z85_encoding[85] ATTRIBUTE_NONSTRING =
@@ -1224,7 +1224,7 @@ base58_length (idx_t len)
static void
base58_encode_ctx_init (struct base_encode_context *ctx)
{
- ctx->ctx.base58.buf = nullptr;
+ ctx->ctx.base58.buf = NULL;
ctx->ctx.base58.size = 0;
ctx->ctx.base58.capacity = 0;
}
@@ -1300,7 +1300,7 @@ base58_encode_ctx_finalize (struct base_encode_context *ctx,
*out, outlen);
free (ctx->ctx.base58.buf);
- ctx->ctx.base58.buf = nullptr;
+ ctx->ctx.base58.buf = NULL;
return true;
}
@@ -1311,7 +1311,7 @@ base58_decode_ctx_init (struct base_decode_context *ctx)
{
ctx->ctx.base58.size = 0;
ctx->ctx.base58.capacity = 0;
- ctx->ctx.base58.buf = nullptr;
+ ctx->ctx.base58.buf = NULL;
}
static bool
@@ -1414,7 +1414,7 @@ base58_decode_ctx_finalize (struct base_decode_context *ctx,
*out, outlen);
free (ctx->ctx.base58.buf);
- ctx->ctx.base58.buf = nullptr;
+ ctx->ctx.base58.buf = NULL;
return ret;
}
@@ -1481,7 +1481,7 @@ do_encode (FILE *in, char const *infile, FILE *out, idx_t wrap_column)
#if BASE_TYPE == 42
/* Initialize encoding context if needed (for base58) */
struct base_encode_context encode_ctx;
- bool use_ctx = (base_encode_ctx_init != nullptr);
+ bool use_ctx = (base_encode_ctx_init != NULL);
if (use_ctx)
base_encode_ctx_init (&encode_ctx);
#endif
@@ -1553,7 +1553,7 @@ do_decode (FILE *in, char const *infile, FILE *out, bool ignore_garbage)
outbuf = xmalloc (DEC_BLOCKSIZE);
#if BASE_TYPE == 42
- ctx.inbuf = nullptr;
+ ctx.inbuf = NULL;
#endif
base_decode_ctx_init (&ctx);
@@ -1636,7 +1636,7 @@ main (int argc, char **argv)
atexit (close_stdout);
- while ((opt = getopt_long (argc, argv, "diw:", long_options, nullptr)) != -1)
+ while ((opt = getopt_long (argc, argv, "diw:", long_options, NULL)) != -1)
switch (opt)
{
case 'd':
@@ -1646,7 +1646,7 @@ main (int argc, char **argv)
case 'w':
{
intmax_t w;
- strtol_error s_err = xstrtoimax (optarg, nullptr, 10, &w, "");
+ strtol_error s_err = xstrtoimax (optarg, NULL, 10, &w, "");
if (LONGINT_OVERFLOW < s_err || w < 0)
error (EXIT_FAILURE, 0, "%s: %s",
_("invalid wrap size"), quote (optarg));
@@ -1805,7 +1805,7 @@ main (int argc, char **argv)
else
{
input_fh = fopen (infile, "rb");
- if (input_fh == nullptr)
+ if (input_fh == NULL)
error (EXIT_FAILURE, errno, "%s", quotef (infile));
}
diff --git a/src/blake2/b2sum.c b/src/blake2/b2sum.c
index 5d69ff8d4c..2d96b93a5f 100644
--- a/src/blake2/b2sum.c
+++ b/src/blake2/b2sum.c
@@ -267,12 +267,12 @@ int main( int argc, char **argv )
while( 1 )
{
int option_index = 0;
- char *end = nullptr;
+ char *end = NULL;
unsigned long outbits;
static struct option long_options[] = {
{ "help", no_argument, 0, 0 },
{ "tag", no_argument, 0, 0 },
- { nullptr, 0, nullptr, 0 }
+ { NULL, 0, NULL, 0 }
};
c = getopt_long( argc, argv, "a:l:", long_options, &option_index );
@@ -349,7 +349,7 @@ int main( int argc, char **argv )
for( i = optind; i < argc; ++i )
{
- FILE *f = nullptr;
+ FILE *f = NULL;
if( argv[i][0] == '-' && argv[i][1] == '\0' )
f = stdin;
else
diff --git a/src/cat.c b/src/cat.c
index b3996f40bc..6c37b9a982 100644
--- a/src/cat.c
+++ b/src/cat.c
@@ -514,7 +514,7 @@ copy_cat (void)
unsupported or the input file seems empty. */
for (bool some_copied = false; ; some_copied = true)
- switch (copy_file_range (input_desc, nullptr, STDOUT_FILENO, nullptr,
+ switch (copy_file_range (input_desc, NULL, STDOUT_FILENO, NULL,
copy_max, 0))
{
case 0:
@@ -550,16 +550,16 @@ main (int argc, char **argv)
static struct option const long_options[] =
{
- {"number-nonblank", no_argument, nullptr, 'b'},
- {"number", no_argument, nullptr, 'n'},
- {"squeeze-blank", no_argument, nullptr, 's'},
- {"show-nonprinting", no_argument, nullptr, 'v'},
- {"show-ends", no_argument, nullptr, 'E'},
- {"show-tabs", no_argument, nullptr, 'T'},
- {"show-all", no_argument, nullptr, 'A'},
+ {"number-nonblank", no_argument, NULL, 'b'},
+ {"number", no_argument, NULL, 'n'},
+ {"squeeze-blank", no_argument, NULL, 's'},
+ {"show-nonprinting", no_argument, NULL, 'v'},
+ {"show-ends", no_argument, NULL, 'E'},
+ {"show-tabs", no_argument, NULL, 'T'},
+ {"show-all", no_argument, NULL, 'A'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
initialize_main (&argc, &argv);
@@ -577,7 +577,7 @@ main (int argc, char **argv)
/* Parse command line options. */
int c;
- while ((c = getopt_long (argc, argv, "benstuvAET", long_options, nullptr))
+ while ((c = getopt_long (argc, argv, "benstuvAET", long_options, NULL))
!= -1)
{
switch (c)
@@ -740,7 +740,7 @@ main (int argc, char **argv)
out_isreg && S_ISREG (istat_buf.st_mode) ? copy_cat () : 0;
if (copy_cat_status != 0)
{
- inbuf = nullptr;
+ inbuf = NULL;
ok &= 0 < copy_cat_status;
}
else
diff --git a/src/chcon.c b/src/chcon.c
index 85a057e693..c9434c7cd2 100644
--- a/src/chcon.c
+++ b/src/chcon.c
@@ -46,7 +46,7 @@ static bool recurse;
static bool verbose;
/* Pointer to the device and inode numbers of '/', when --recursive.
- Otherwise nullptr. */
+ Otherwise NULL. */
static struct dev_ino *root_dev_ino;
/* The name of the context file is being given. */
@@ -70,20 +70,20 @@ enum
static struct option const long_options[] =
{
- {"recursive", no_argument, nullptr, 'R'},
- {"dereference", no_argument, nullptr, DEREFERENCE_OPTION},
- {"no-dereference", no_argument, nullptr, 'h'},
- {"no-preserve-root", no_argument, nullptr, NO_PRESERVE_ROOT},
- {"preserve-root", no_argument, nullptr, PRESERVE_ROOT},
- {"reference", required_argument, nullptr, REFERENCE_FILE_OPTION},
- {"user", required_argument, nullptr, 'u'},
- {"role", required_argument, nullptr, 'r'},
- {"type", required_argument, nullptr, 't'},
- {"range", required_argument, nullptr, 'l'},
- {"verbose", no_argument, nullptr, 'v'},
+ {"recursive", no_argument, NULL, 'R'},
+ {"dereference", no_argument, NULL, DEREFERENCE_OPTION},
+ {"no-dereference", no_argument, NULL, 'h'},
+ {"no-preserve-root", no_argument, NULL, NO_PRESERVE_ROOT},
+ {"preserve-root", no_argument, NULL, PRESERVE_ROOT},
+ {"reference", required_argument, NULL, REFERENCE_FILE_OPTION},
+ {"user", required_argument, NULL, 'u'},
+ {"role", required_argument, NULL, 'r'},
+ {"type", required_argument, NULL, 't'},
+ {"range", required_argument, NULL, 'l'},
+ {"verbose", no_argument, NULL, 'v'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
/* Given a security context, CONTEXT, derive a context_t (*RET),
@@ -139,12 +139,12 @@ compute_context_from_mask (char const *context, context_t *ret)
static int
change_file_context (int fd, char const *file)
{
- char *file_context = nullptr;
+ char *file_context = NULL;
context_t context IF_LINT (= NULL);
char const * context_string;
int errors = 0;
- if (specified_context == nullptr)
+ if (specified_context == NULL)
{
int status = (affect_symlink_referent
? getfileconat (fd, file, &file_context)
@@ -160,7 +160,7 @@ change_file_context (int fd, char const *file)
/* If the file doesn't have a context, and we're not setting all of
the context components, there isn't really an obvious default.
Thus, we just give up. */
- if (file_context == nullptr)
+ if (file_context == NULL)
{
error (0, 0, _("can't apply partial context to unlabeled file %s"),
quoteaf (file));
@@ -180,7 +180,7 @@ change_file_context (int fd, char const *file)
context_string = specified_context;
}
- if (file_context == nullptr || ! streq (context_string, file_context))
+ if (file_context == NULL || ! streq (context_string, file_context))
{
int fail = (affect_symlink_referent
? setfileconat (fd, file, context_string)
@@ -194,7 +194,7 @@ change_file_context (int fd, char const *file)
}
}
- if (specified_context == nullptr)
+ if (specified_context == NULL)
{
context_free (context);
freecon (file_context);
@@ -314,14 +314,14 @@ process_files (char **files, int bit_flags)
{
bool ok = true;
- FTS *fts = xfts_open (files, bit_flags, nullptr);
+ FTS *fts = xfts_open (files, bit_flags, NULL);
while (true)
{
FTSENT *ent;
ent = fts_read (fts);
- if (ent == nullptr)
+ if (ent == NULL)
{
if (errno != 0)
{
@@ -422,7 +422,7 @@ main (int argc, char **argv)
bool ok;
bool preserve_root = false;
bool component_specified = false;
- char *reference_file = nullptr;
+ char *reference_file = NULL;
int optc;
initialize_main (&argc, &argv);
@@ -434,7 +434,7 @@ main (int argc, char **argv)
atexit (close_stdout);
while ((optc = getopt_long (argc, argv, "HLPRhvu:r:t:l:",
- long_options, nullptr))
+ long_options, NULL))
!= -1)
{
switch (optc)
@@ -544,7 +544,7 @@ main (int argc, char **argv)
if (reference_file)
{
- char *ref_context = nullptr;
+ char *ref_context = NULL;
if (getfilecon (reference_file, &ref_context) < 0)
error (EXIT_FAILURE, errno, _("failed to get security context of %s"),
@@ -555,7 +555,7 @@ main (int argc, char **argv)
else if (component_specified)
{
/* FIXME: it's already null, so this is a no-op. */
- specified_context = nullptr;
+ specified_context = NULL;
}
else
{
@@ -576,13 +576,13 @@ main (int argc, char **argv)
{
static struct dev_ino dev_ino_buf;
root_dev_ino = get_root_dev_ino (&dev_ino_buf);
- if (root_dev_ino == nullptr)
+ if (root_dev_ino == NULL)
error (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
quoteaf ("/"));
}
else
{
- root_dev_ino = nullptr;
+ root_dev_ino = NULL;
}
ok = process_files (argv + optind, bit_flags | FTS_NOSTAT);
diff --git a/src/chmod.c b/src/chmod.c
index e779ad697d..1e52dc3df6 100644
--- a/src/chmod.c
+++ b/src/chmod.c
@@ -90,7 +90,7 @@ static bool diagnose_surprises;
static enum Verbosity verbosity = V_off;
/* Pointer to the device and inode numbers of '/', when --recursive.
- Otherwise nullptr. */
+ Otherwise NULL. */
static struct dev_ino *root_dev_ino;
/* For long options that have no equivalent short option, use a
@@ -105,19 +105,19 @@ enum
static struct option const long_options[] =
{
- {"changes", no_argument, nullptr, 'c'},
- {"dereference", no_argument, nullptr, DEREFERENCE_OPTION},
- {"recursive", no_argument, nullptr, 'R'},
- {"no-dereference", no_argument, nullptr, 'h'},
- {"no-preserve-root", no_argument, nullptr, NO_PRESERVE_ROOT},
- {"preserve-root", no_argument, nullptr, PRESERVE_ROOT},
- {"quiet", no_argument, nullptr, 'f'},
- {"reference", required_argument, nullptr, REFERENCE_FILE_OPTION},
- {"silent", no_argument, nullptr, 'f'},
- {"verbose", no_argument, nullptr, 'v'},
+ {"changes", no_argument, NULL, 'c'},
+ {"dereference", no_argument, NULL, DEREFERENCE_OPTION},
+ {"recursive", no_argument, NULL, 'R'},
+ {"no-dereference", no_argument, NULL, 'h'},
+ {"no-preserve-root", no_argument, NULL, NO_PRESERVE_ROOT},
+ {"preserve-root", no_argument, NULL, PRESERVE_ROOT},
+ {"quiet", no_argument, NULL, 'f'},
+ {"reference", required_argument, NULL, REFERENCE_FILE_OPTION},
+ {"silent", no_argument, NULL, 'f'},
+ {"verbose", no_argument, NULL, 'v'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
/* Return true if the chmodable permission bits of FILE changed.
@@ -305,7 +305,7 @@ process_file (FTS *fts, FTSENT *ent)
{
ch.old_mode = file_stats->st_mode;
ch.new_mode = mode_adjust (ch.old_mode, S_ISDIR (ch.old_mode) != 0,
- umask_value, change, nullptr);
+ umask_value, change, NULL);
bool follow_symlink = !!dereference;
if (dereference == -1) /* -H with/without -R, -P without -R. */
follow_symlink = ent->fts_level == FTS_ROOTLEVEL;
@@ -341,7 +341,7 @@ process_file (FTS *fts, FTSENT *ent)
{
mode_t naively_expected_mode =
mode_adjust (ch.old_mode, S_ISDIR (ch.old_mode) != 0,
- 0, change, nullptr);
+ 0, change, NULL);
if (ch.new_mode & ~naively_expected_mode)
{
char new_perms[12];
@@ -372,14 +372,14 @@ process_files (char **files, int bit_flags)
{
bool ok = true;
- FTS *fts = xfts_open (files, bit_flags, nullptr);
+ FTS *fts = xfts_open (files, bit_flags, NULL);
while (true)
{
FTSENT *ent;
ent = fts_read (fts);
- if (ent == nullptr)
+ if (ent == NULL)
{
if (errno != 0)
{
@@ -460,12 +460,12 @@ Each MODE is of the form '[ugoa]*([-+=]([rwxXst]*|[ugo]))+|[-+=][0-7]+'.\n\
int
main (int argc, char **argv)
{
- char *mode = nullptr;
+ char *mode = NULL;
idx_t mode_len = 0;
idx_t mode_alloc = 0;
bool ok;
bool preserve_root = false;
- char const *reference_file = nullptr;
+ char const *reference_file = NULL;
int c;
int bit_flags = FTS_COMFOLLOW | FTS_PHYSICAL;
@@ -482,7 +482,7 @@ main (int argc, char **argv)
while ((c = getopt_long (argc, argv,
("HLPRcfhvr::w::x::X::s::t::u::g::o::a::,::+::=::"
"0::1::2::3::4::5::6::7::"),
- long_options, nullptr))
+ long_options, NULL))
!= -1)
{
switch (c)
@@ -636,13 +636,13 @@ main (int argc, char **argv)
{
static struct dev_ino dev_ino_buf;
root_dev_ino = get_root_dev_ino (&dev_ino_buf);
- if (root_dev_ino == nullptr)
+ if (root_dev_ino == NULL)
error (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
quoteaf ("/"));
}
else
{
- root_dev_ino = nullptr;
+ root_dev_ino = NULL;
}
bit_flags |= FTS_DEFER_STAT;
diff --git a/src/chown-core.c b/src/chown-core.c
index fd643425cc..910568481c 100644
--- a/src/chown-core.c
+++ b/src/chown-core.c
@@ -58,12 +58,12 @@ extern void
chopt_init (struct Chown_option *chopt)
{
chopt->verbosity = V_off;
- chopt->root_dev_ino = nullptr;
+ chopt->root_dev_ino = NULL;
chopt->affect_symlink_referent = true;
chopt->recurse = false;
chopt->force_silent = false;
- chopt->user_name = nullptr;
- chopt->group_name = nullptr;
+ chopt->user_name = NULL;
+ chopt->group_name = NULL;
}
extern void
@@ -122,7 +122,7 @@ uid_to_name (uid_t uid)
static char *
user_group_str (char const *user, char const *group)
{
- char *spec = nullptr;
+ char *spec = NULL;
if (user)
{
@@ -165,8 +165,8 @@ describe_change (char const *file, enum Change_status changed,
}
spec = user_group_str (user, group);
- old_spec = user_group_str (user ? old_user : nullptr,
- group ? old_group : nullptr);
+ old_spec = user_group_str (user ? old_user : NULL,
+ group ? old_group : NULL);
switch (changed)
{
@@ -189,7 +189,7 @@ describe_change (char const *file, enum Change_status changed,
: _("failed to change ownership of %s\n"));
free (old_spec);
old_spec = spec;
- spec = nullptr;
+ spec = NULL;
}
break;
case CH_NO_CHANGE_REQUESTED:
@@ -367,7 +367,7 @@ change_file_owner (FTS *fts, FTSENT *ent,
if (!ok)
{
do_chown = false;
- file_stats = nullptr;
+ file_stats = NULL;
}
else if (required_uid == (uid_t) -1 && required_gid == (gid_t) -1
&& chopt->verbosity == V_off
@@ -496,15 +496,15 @@ change_file_owner (FTS *fts, FTSENT *ent,
: !changed ? CH_NO_CHANGE_REQUESTED
: CH_SUCCEEDED);
char *old_usr = (file_stats
- ? uid_to_name (file_stats->st_uid) : nullptr);
+ ? uid_to_name (file_stats->st_uid) : NULL);
char *old_grp = (file_stats
- ? gid_to_name (file_stats->st_gid) : nullptr);
+ ? gid_to_name (file_stats->st_gid) : NULL);
char *new_usr = chopt->user_name
? chopt->user_name : uid != -1
- ? uid_to_str (uid) : nullptr;
+ ? uid_to_str (uid) : NULL;
char *new_grp = chopt->group_name
? chopt->group_name : gid != -1
- ? gid_to_str (gid) : nullptr;
+ ? gid_to_str (gid) : NULL;
describe_change (file_full_name, ch_status,
old_usr, old_grp,
new_usr, new_grp);
@@ -547,14 +547,14 @@ chown_files (char **files, int bit_flags,
? 0
: FTS_NOSTAT);
- FTS *fts = xfts_open (files, bit_flags | stat_flags, nullptr);
+ FTS *fts = xfts_open (files, bit_flags | stat_flags, NULL);
while (true)
{
FTSENT *ent;
ent = fts_read (fts);
- if (ent == nullptr)
+ if (ent == NULL)
{
if (errno != 0)
{
diff --git a/src/chown-core.h b/src/chown-core.h
index e38771076a..8927f68e06 100644
--- a/src/chown-core.h
+++ b/src/chown-core.h
@@ -50,7 +50,7 @@ struct Chown_option
bool recurse;
/* Pointer to the device and inode numbers of '/', when --recursive.
- Need not be freed. Otherwise nullptr. */
+ Need not be freed. Otherwise NULL. */
struct dev_ino *root_dev_ino;
/* This corresponds to the --dereference (opposite of -h) option. */
diff --git a/src/chown.c b/src/chown.c
index f37b388ad9..e9f3919e88 100644
--- a/src/chown.c
+++ b/src/chown.c
@@ -53,20 +53,20 @@ enum
static struct option const long_options[] =
{
- {"recursive", no_argument, nullptr, 'R'},
- {"changes", no_argument, nullptr, 'c'},
- {"dereference", no_argument, nullptr, DEREFERENCE_OPTION},
- {"from", required_argument, nullptr, FROM_OPTION},
- {"no-dereference", no_argument, nullptr, 'h'},
- {"no-preserve-root", no_argument, nullptr, NO_PRESERVE_ROOT},
- {"preserve-root", no_argument, nullptr, PRESERVE_ROOT},
- {"quiet", no_argument, nullptr, 'f'},
- {"silent", no_argument, nullptr, 'f'},
- {"reference", required_argument, nullptr, REFERENCE_FILE_OPTION},
- {"verbose", no_argument, nullptr, 'v'},
+ {"recursive", no_argument, NULL, 'R'},
+ {"changes", no_argument, NULL, 'c'},
+ {"dereference", no_argument, NULL, DEREFERENCE_OPTION},
+ {"from", required_argument, NULL, FROM_OPTION},
+ {"no-dereference", no_argument, NULL, 'h'},
+ {"no-preserve-root", no_argument, NULL, NO_PRESERVE_ROOT},
+ {"preserve-root", no_argument, NULL, PRESERVE_ROOT},
+ {"quiet", no_argument, NULL, 'f'},
+ {"silent", no_argument, NULL, 'f'},
+ {"reference", required_argument, NULL, REFERENCE_FILE_OPTION},
+ {"verbose", no_argument, NULL, 'v'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
void
@@ -194,7 +194,7 @@ main (int argc, char **argv)
chopt_init (&chopt);
- while ((optc = getopt_long (argc, argv, "HLPRcfhv", long_options, nullptr))
+ while ((optc = getopt_long (argc, argv, "HLPRcfhv", long_options, NULL))
!= -1)
{
switch (optc)
@@ -237,7 +237,7 @@ main (int argc, char **argv)
bool warn;
char const *e = parse_user_spec_warn (optarg,
&required_uid, &required_gid,
- nullptr, nullptr, &warn);
+ NULL, NULL, &warn);
if (e)
error (warn ? 0 : EXIT_FAILURE, 0, "%s: %s", e, quote (optarg));
break;
@@ -339,7 +339,7 @@ main (int argc, char **argv)
{
static struct dev_ino dev_ino_buf;
chopt.root_dev_ino = get_root_dev_ino (&dev_ino_buf);
- if (chopt.root_dev_ino == nullptr)
+ if (chopt.root_dev_ino == NULL)
error (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
quoteaf ("/"));
}
diff --git a/src/chroot.c b/src/chroot.c
index fec320787c..8db28ecf25 100644
--- a/src/chroot.c
+++ b/src/chroot.c
@@ -55,12 +55,12 @@ enum
static struct option const long_opts[] =
{
- {"groups", required_argument, nullptr, GROUPS},
- {"userspec", required_argument, nullptr, USERSPEC},
- {"skip-chdir", no_argument, nullptr, SKIP_CHDIR},
+ {"groups", required_argument, NULL, GROUPS},
+ {"userspec", required_argument, NULL, USERSPEC},
+ {"skip-chdir", no_argument, NULL, SKIP_CHDIR},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
#if ! HAVE_SETGROUPS
@@ -95,19 +95,19 @@ static int
parse_additional_groups (char const *groups, GETGROUPS_T **pgids,
idx_t *pn_gids, bool show_errors)
{
- GETGROUPS_T *gids = nullptr;
+ GETGROUPS_T *gids = NULL;
idx_t n_gids_allocated = 0;
idx_t n_gids = 0;
char *buffer = xstrdup (groups);
int ret = 0;
for (char const *tmp = strtok (buffer, ","); tmp;
- tmp = strtok (nullptr, ","))
+ tmp = strtok (NULL, ","))
{
struct group *g;
uintmax_t value;
- if (xstrtoumax (tmp, nullptr, 10, &value, "") == LONGINT_OK
+ if (xstrtoumax (tmp, NULL, 10, &value, "") == LONGINT_OK
&& value <= MAXGID)
{
while (isspace (to_uchar (*tmp)))
@@ -116,20 +116,20 @@ parse_additional_groups (char const *groups, GETGROUPS_T **pgids,
{
/* Handle the case where the name is numeric. */
g = getgrnam (tmp);
- if (g != nullptr)
+ if (g != NULL)
value = g->gr_gid;
}
/* Flag that we've got a group from the number. */
- g = (struct group *) (intptr_t) ! nullptr;
+ g = (struct group *) (intptr_t) ! NULL;
}
else
{
g = getgrnam (tmp);
- if (g != nullptr)
+ if (g != NULL)
value = g->gr_gid;
}
- if (g == nullptr)
+ if (g == NULL)
{
ret = -1;
@@ -219,15 +219,15 @@ main (int argc, char **argv)
int c;
/* Input user and groups spec. */
- char *userspec = nullptr;
- char const *username = nullptr;
- char const *groups = nullptr;
+ char *userspec = NULL;
+ char const *username = NULL;
+ char const *groups = NULL;
bool skip_chdir = false;
/* Parsed user and group IDs. */
uid_t uid = -1;
gid_t gid = -1;
- GETGROUPS_T *out_gids = nullptr;
+ GETGROUPS_T *out_gids = NULL;
idx_t n_gids = 0;
initialize_main (&argc, &argv);
@@ -239,7 +239,7 @@ main (int argc, char **argv)
initialize_exit_failure (EXIT_CANCELED);
atexit (close_stdout);
- while ((c = getopt_long (argc, argv, "+", long_opts, nullptr)) != -1)
+ while ((c = getopt_long (argc, argv, "+", long_opts, NULL)) != -1)
{
switch (c)
{
@@ -297,7 +297,7 @@ main (int argc, char **argv)
Within chroot lookup is the main justification for having
the --user option supported by the chroot command itself. */
if (userspec)
- ignore_value (parse_user_spec (userspec, &uid, &gid, nullptr, nullptr));
+ ignore_value (parse_user_spec (userspec, &uid, &gid, NULL, NULL));
/* If no gid is supplied or looked up, do so now.
Also lookup the username for use with getgroups. */
@@ -336,11 +336,11 @@ main (int argc, char **argv)
{
/* No command. Run an interactive shell. */
char *shell = getenv ("SHELL");
- if (shell == nullptr)
+ if (shell == NULL)
shell = bad_cast ("/bin/sh");
argv[0] = shell;
argv[1] = bad_cast ("-i");
- argv[2] = nullptr;
+ argv[2] = NULL;
}
else
{
@@ -354,7 +354,7 @@ main (int argc, char **argv)
{
bool warn;
char const *err = parse_user_spec_warn (userspec, &uid, &gid,
- nullptr, nullptr, &warn);
+ NULL, NULL, &warn);
if (err)
error (warn ? 0 : EXIT_CANCELED, 0, "%s", (err));
}
@@ -379,7 +379,7 @@ main (int argc, char **argv)
}
GETGROUPS_T *gids = out_gids;
- GETGROUPS_T *in_gids = nullptr;
+ GETGROUPS_T *in_gids = NULL;
if (groups && *groups)
{
if (parse_additional_groups (groups, &in_gids, &n_gids, !n_gids) != 0)
diff --git a/src/cksum.c b/src/cksum.c
index 8c9f8ac84b..c6e4378589 100644
--- a/src/cksum.c
+++ b/src/cksum.c
@@ -337,7 +337,7 @@ static char const *const algorithm_args[] =
{
"bsd", "sysv", "crc", "crc32b", "md5", "sha1",
"sha224", "sha256", "sha384", "sha512", /* Legacy naming */
- "sha2", "sha3", "blake2b", "sm3", nullptr
+ "sha2", "sha3", "blake2b", "sm3", NULL
};
static enum Algorithm const algorithm_types[] =
{
@@ -351,7 +351,7 @@ static char const *const algorithm_tags[] =
{
"BSD", "SYSV", "CRC", "CRC32B", "MD5", "SHA1",
"SHA224", "SHA256", "SHA384", "SHA512",
- "SHA2", "SHA3", "BLAKE2b", "SM3", nullptr
+ "SHA2", "SHA3", "BLAKE2b", "SM3", NULL
};
static int const algorithm_bits[] =
{
@@ -422,57 +422,57 @@ enum
#if HASH_ALGO_CKSUM
static struct option const legacy_long_options[] =
{
- { "check", no_argument, nullptr, 'c' },
- { "ignore-missing", no_argument, nullptr, IGNORE_MISSING_OPTION },
- { "quiet", no_argument, nullptr, QUIET_OPTION },
- { "status", no_argument, nullptr, STATUS_OPTION },
- { "warn", no_argument, nullptr, 'w' },
- { "strict", no_argument, nullptr, STRICT_OPTION },
- { "tag", no_argument, nullptr, TAG_OPTION },
- { "zero", no_argument, nullptr, 'z' },
-
- { "binary", no_argument, nullptr, 'b' }, /* Deprecated. */
- { "text", no_argument, nullptr, 't' }, /* Deprecated. */
+ { "check", no_argument, NULL, 'c' },
+ { "ignore-missing", no_argument, NULL, IGNORE_MISSING_OPTION },
+ { "quiet", no_argument, NULL, QUIET_OPTION },
+ { "status", no_argument, NULL, STATUS_OPTION },
+ { "warn", no_argument, NULL, 'w' },
+ { "strict", no_argument, NULL, STRICT_OPTION },
+ { "tag", no_argument, NULL, TAG_OPTION },
+ { "zero", no_argument, NULL, 'z' },
+
+ { "binary", no_argument, NULL, 'b' }, /* Deprecated. */
+ { "text", no_argument, NULL, 't' }, /* Deprecated. */
{ GETOPT_HELP_OPTION_DECL },
{ GETOPT_VERSION_OPTION_DECL },
- { nullptr, 0, nullptr, 0 }
+ { NULL, 0, NULL, 0 }
};
#endif
static struct option const long_options[] =
{
#if HASH_ALGO_BLAKE2 || HASH_ALGO_CKSUM
- { "length", required_argument, nullptr, 'l'},
+ { "length", required_argument, NULL, 'l'},
#endif
#if !HASH_ALGO_SUM
- { "check", no_argument, nullptr, 'c' },
- { "ignore-missing", no_argument, nullptr, IGNORE_MISSING_OPTION},
- { "quiet", no_argument, nullptr, QUIET_OPTION },
- { "status", no_argument, nullptr, STATUS_OPTION },
- { "warn", no_argument, nullptr, 'w' },
- { "strict", no_argument, nullptr, STRICT_OPTION },
- { "tag", no_argument, nullptr, TAG_OPTION },
- { "zero", no_argument, nullptr, 'z' },
+ { "check", no_argument, NULL, 'c' },
+ { "ignore-missing", no_argument, NULL, IGNORE_MISSING_OPTION},
+ { "quiet", no_argument, NULL, QUIET_OPTION },
+ { "status", no_argument, NULL, STATUS_OPTION },
+ { "warn", no_argument, NULL, 'w' },
+ { "strict", no_argument, NULL, STRICT_OPTION },
+ { "tag", no_argument, NULL, TAG_OPTION },
+ { "zero", no_argument, NULL, 'z' },
# if HASH_ALGO_CKSUM
- { "algorithm", required_argument, nullptr, 'a'},
- { "base64", no_argument, nullptr, BASE64_OPTION },
- { "debug", no_argument, nullptr, DEBUG_PROGRAM_OPTION},
- { "raw", no_argument, nullptr, RAW_OPTION},
- { "untagged", no_argument, nullptr, UNTAG_OPTION },
+ { "algorithm", required_argument, NULL, 'a'},
+ { "base64", no_argument, NULL, BASE64_OPTION },
+ { "debug", no_argument, NULL, DEBUG_PROGRAM_OPTION},
+ { "raw", no_argument, NULL, RAW_OPTION},
+ { "untagged", no_argument, NULL, UNTAG_OPTION },
# endif
- { "binary", no_argument, nullptr, 'b' }, /* Deprecated. */
- { "text", no_argument, nullptr, 't' }, /* Deprecated. */
+ { "binary", no_argument, NULL, 'b' }, /* Deprecated. */
+ { "text", no_argument, NULL, 't' }, /* Deprecated. */
#else
- {"sysv", no_argument, nullptr, 's'}, /* Not in cksum. */
+ {"sysv", no_argument, NULL, 's'}, /* Not in cksum. */
#endif
{ GETOPT_HELP_OPTION_DECL },
{ GETOPT_VERSION_OPTION_DECL },
- { nullptr, 0, nullptr, 0 }
+ { NULL, 0, NULL, 0 }
};
void
@@ -686,7 +686,7 @@ problematic_chars (char const *s)
and each "\\\\" with a single backslash, NUL-terminate it and return S.
If S is not a valid escaped file name, i.e., if it ends with an odd number
of backslashes or if it contains a backslash followed by anything other
- than "n" or another backslash, return nullptr. */
+ than "n" or another backslash, return NULL. */
static char *
filename_unescape (char *s, size_t s_len)
@@ -701,7 +701,7 @@ filename_unescape (char *s, size_t s_len)
if (i == s_len - 1)
{
/* File name ends with an unescaped backslash: invalid. */
- return nullptr;
+ return NULL;
}
++i;
switch (s[i])
@@ -717,13 +717,13 @@ filename_unescape (char *s, size_t s_len)
break;
default:
/* Only '\', 'n' or 'r' may follow a backslash. */
- return nullptr;
+ return NULL;
}
break;
case '\0':
/* The file name may not contain a NUL. */
- return nullptr;
+ return NULL;
default:
*dst++ = s[i];
@@ -799,7 +799,7 @@ bsd_split_3 (char *s, size_t s_len,
*file_name = s;
- if (escaped_filename && filename_unescape (s, i) == nullptr)
+ if (escaped_filename && filename_unescape (s, i) == NULL)
return false;
s[i++] = '\0';
@@ -930,7 +930,7 @@ split_3 (char *s, size_t s_len,
++i;
uintmax_t length;
char *siend;
- if (xstrtoumax (s + i, &siend, 0, &length, nullptr) != LONGINT_OK)
+ if (xstrtoumax (s + i, &siend, 0, &length, NULL) != LONGINT_OK)
return false;
# if HASH_ALGO_CKSUM
else if (cksum_algorithm == sha2 || cksum_algorithm == sha3)
@@ -1084,7 +1084,7 @@ split_3 (char *s, size_t s_len,
*file_name = &s[i];
if (escaped_filename)
- return filename_unescape (&s[i], s_len - i) != nullptr;
+ return filename_unescape (&s[i], s_len - i) != NULL;
return true;
}
@@ -1163,7 +1163,7 @@ digest_file (char const *filename, int *binary, unsigned char *bin_result,
else
{
fp = fopen (filename, O_BINARY ? (*binary ? "rb" : "rt") : "r");
- if (fp == nullptr)
+ if (fp == NULL)
{
if (ignore_missing && errno == ENOENT)
{
@@ -1344,7 +1344,7 @@ digest_check (char const *checkfile_name)
else
{
checkfile_stream = fopen (checkfile_name, "r");
- if (checkfile_stream == nullptr)
+ if (checkfile_stream == NULL)
{
error (0, errno, "%s", quotef (checkfile_name));
return false;
@@ -1352,7 +1352,7 @@ digest_check (char const *checkfile_name)
}
line_number = 0;
- line = nullptr;
+ line = NULL;
line_chars_allocated = 0;
do
{
@@ -1561,7 +1561,7 @@ main (int argc, char **argv)
/* Line buffer stdout to ensure lines are written atomically and immediately
so that processes running in parallel do not intersperse their output. */
- setvbuf (stdout, nullptr, _IOLBF, 0);
+ setvbuf (stdout, NULL, _IOLBF, 0);
#if HASH_ALGO_SUM
char const *short_opts = "rs";
@@ -1575,7 +1575,7 @@ main (int argc, char **argv)
char const *short_opts = "bctwz";
#endif
- while ((opt = getopt_long (argc, argv, short_opts, long_opts, nullptr))
+ while ((opt = getopt_long (argc, argv, short_opts, long_opts, NULL))
!= -1)
switch (opt)
{
diff --git a/src/cksum_crc.c b/src/cksum_crc.c
index 968866d0b3..d12f3c6075 100644
--- a/src/cksum_crc.c
+++ b/src/cksum_crc.c
@@ -156,7 +156,7 @@ pclmul_supported (void)
# endif
# endif
- return nullptr;
+ return NULL;
}
static cksum_fp_t
@@ -177,7 +177,7 @@ avx2_supported (void)
return cksum_avx2;
# endif
- return nullptr;
+ return NULL;
}
static cksum_fp_t
@@ -200,7 +200,7 @@ avx512_supported (void)
return cksum_avx512;
# endif
- return nullptr;
+ return NULL;
}
static cksum_fp_t
@@ -219,7 +219,7 @@ vmull_supported (void)
return cksum_vmull;
# endif
- return nullptr;
+ return NULL;
}
static bool
diff --git a/src/comm.c b/src/comm.c
index 7a9d6de377..a73020061d 100644
--- a/src/comm.c
+++ b/src/comm.c
@@ -85,14 +85,14 @@ enum
static struct option const long_options[] =
{
- {"check-order", no_argument, nullptr, CHECK_ORDER_OPTION},
- {"nocheck-order", no_argument, nullptr, NOCHECK_ORDER_OPTION},
- {"output-delimiter", required_argument, nullptr, OUTPUT_DELIMITER_OPTION},
- {"total", no_argument, nullptr, TOTAL_OPTION},
- {"zero-terminated", no_argument, nullptr, 'z'},
+ {"check-order", no_argument, NULL, CHECK_ORDER_OPTION},
+ {"nocheck-order", no_argument, NULL, NOCHECK_ORDER_OPTION},
+ {"output-delimiter", required_argument, NULL, OUTPUT_DELIMITER_OPTION},
+ {"total", no_argument, NULL, TOTAL_OPTION},
+ {"zero-terminated", no_argument, NULL, 'z'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
@@ -434,7 +434,7 @@ main (int argc, char **argv)
check_input_order = CHECK_ORDER_DEFAULT;
total_option = false;
- while ((c = getopt_long (argc, argv, "123z", long_options, nullptr)) != -1)
+ while ((c = getopt_long (argc, argv, "123z", long_options, NULL)) != -1)
switch (c)
{
case '1':
diff --git a/src/copy-file-data.c b/src/copy-file-data.c
index 5bc816f7ac..d76ccc0db2 100644
--- a/src/copy-file-data.c
+++ b/src/copy-file-data.c
@@ -131,7 +131,7 @@ sparse_copy (int src_fd, int dest_fd, char **abuf, idx_t buf_size,
(SSIZE_MAX, SIZE_MAX) truncated to a value that is
surely aligned well. */
ssize_t copy_max = MIN (SSIZE_MAX, SIZE_MAX) >> 30 << 30;
- ssize_t n_copied = copy_file_range (src_fd, nullptr, dest_fd, nullptr,
+ ssize_t n_copied = copy_file_range (src_fd, NULL, dest_fd, NULL,
MIN (max_n_read, copy_max), 0);
if (n_copied == 0)
{
@@ -148,7 +148,7 @@ sparse_copy (int src_fd, int dest_fd, char **abuf, idx_t buf_size,
{
/* Donât treat EFBIG as a reportable error from copy_file_range.
If the input is at EOF and the output position is 2**63 - 1,
- copy_file_range (ifd, nullptr, ofd, nullptr, 2146435072, 0)
+ copy_file_range (ifd, NULL, ofd, NULL, 2146435072, 0)
incorrectly fails with EFBIG. Problem observed on Ubuntu 25.10
x86-64 with Linux kernel 6.17.0-8-generic #8-Ubuntu. */
if (errno == EFBIG)
@@ -282,7 +282,7 @@ sparse_copy (int src_fd, int dest_fd, char **abuf, idx_t buf_size,
static bool
write_zeros (int fd, off_t n_bytes, char **abuf, idx_t buf_size)
{
- char *zeros = nullptr;
+ char *zeros = NULL;
while (n_bytes)
{
idx_t n = MIN (buf_size, n_bytes);
@@ -424,7 +424,7 @@ lseek_copy (int src_fd, int dest_fd, char **abuf, idx_t buf_size,
= sparse_copy (src_fd, dest_fd, abuf, buf_size,
allow_reflink, src_name, dst_name,
ext_len,
- sparse_mode == SPARSE_ALWAYS ? hole_size : nullptr,
+ sparse_mode == SPARSE_ALWAYS ? hole_size : NULL,
debug);
if (n_read < 0)
return -1;
@@ -598,7 +598,7 @@ copy_file_data (int ifd, struct stat const *ist, off_t ipos, char const *iname,
buf_size -= buf_size % blcm;
}
- char *buf = nullptr;
+ char *buf = NULL;
intmax_t result;
off_t hole_size = 0;
@@ -618,7 +618,7 @@ copy_file_data (int ifd, struct stat const *ist, off_t ipos, char const *iname,
result = sparse_copy (ifd, ofd, &buf, buf_size,
x->reflink_mode != REFLINK_NEVER,
iname, oname, ibytes,
- make_holes ? &hole_size : nullptr,
+ make_holes ? &hole_size : NULL,
debug);
if (0 <= result && 0 < hole_size)
diff --git a/src/copy.c b/src/copy.c
index 661e47aa77..198f762e9f 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -327,7 +327,7 @@ copy_attr (char const *src_path, int src_fd,
bool some_errors = (!all_errors && !x->reduce_diagnostics);
int (*check) (char const *, struct error_context *)
= (x->preserve_security_context || x->set_security_context
- ? check_selinux_attr : nullptr);
+ ? check_selinux_attr : NULL);
# if 4 < __GNUC__ + (8 <= __GNUC_MINOR__)
/* Pacify gcc -Wsuggest-attribute=format through at least GCC 13.2.1. */
@@ -341,7 +341,7 @@ copy_attr (char const *src_path, int src_fd,
.quote = copy_attr_quote,
.quote_free = copy_attr_free
})
- : nullptr);
+ : NULL);
# if 4 < __GNUC__ + (8 <= __GNUC_MINOR__)
# pragma GCC diagnostic pop
# endif
@@ -390,7 +390,7 @@ copy_dir (char const *src_name_in, char const *dst_name_in,
bool ok = true;
name_space = savedir (src_name_in, SAVEDIR_SORT_FASTREAD);
- if (name_space == nullptr)
+ if (name_space == NULL)
{
/* This diagnostic is a bit vague because savedir can fail in
several different ways. */
@@ -408,8 +408,8 @@ copy_dir (char const *src_name_in, char const *dst_name_in,
while (*namep != '\0')
{
bool local_copy_into_self;
- char *src_name = file_name_concat (src_name_in, namep, nullptr);
- char *dst_name = file_name_concat (dst_name_in, namep, nullptr);
+ char *src_name = file_name_concat (src_name_in, namep, NULL);
+ char *dst_name = file_name_concat (dst_name_in, namep, NULL);
bool first_dir_created = *first_dir_created_per_command_line_arg;
bool rename_succeeded;
@@ -1444,7 +1444,7 @@ dest_info_init (struct cp_options *x)
{
x->dest_info
= hash_initialize (DEST_INFO_INITIAL_CAPACITY,
- nullptr,
+ NULL,
triple_hash,
triple_compare,
triple_free);
@@ -1468,7 +1468,7 @@ src_info_init (struct cp_options *x)
*/
x->src_info
= hash_initialize (DEST_INFO_INITIAL_CAPACITY,
- nullptr,
+ NULL,
triple_hash_no_name,
triple_compare,
triple_free);
@@ -1513,11 +1513,11 @@ emit_verbose (char const *format, char const *src, char const *dst,
putchar ('\n');
}
-/* A wrapper around "setfscreatecon (nullptr)" that exits upon failure. */
+/* A wrapper around "setfscreatecon (NULL)" that exits upon failure. */
static void
restore_default_fscreatecon_or_die (void)
{
- if (setfscreatecon (nullptr) != 0)
+ if (setfscreatecon (NULL) != 0)
error (EXIT_FAILURE, errno,
_("failed to restore the default file creation context"));
}
@@ -1555,7 +1555,7 @@ create_hard_link (char const *src_name, int src_dirfd, char const *src_relname,
if (0 < err)
{
- char *a_src_name = nullptr;
+ char *a_src_name = NULL;
if (!src_name)
src_name = a_src_name = subst_suffix (dst_name, dst_relname,
src_relname);
@@ -1638,8 +1638,8 @@ copy_internal (char const *src_name, char const *dst_name,
mode_t dst_mode_bits;
mode_t omitted_permissions;
bool restore_dst_mode = false;
- char *earlier_file = nullptr;
- char *dst_backup = nullptr;
+ char *earlier_file = NULL;
+ char *dst_backup = NULL;
char const *drelname = *dst_relname ? dst_relname : ".";
bool delayed_ok;
bool copied_as_regular = false;
@@ -1815,7 +1815,7 @@ copy_internal (char const *src_name, char const *dst_name,
{
/* Note we currently replace DST_NAME unconditionally,
even if it was a newer separate file. */
- if (! create_hard_link (nullptr, dst_dirfd, earlier_file,
+ if (! create_hard_link (NULL, dst_dirfd, earlier_file,
dst_name, dst_dirfd, dst_relname,
true,
x->verbose, dereference))
@@ -1998,7 +1998,7 @@ skip:
struct stat *dst_lstat_sb
= (have_dst_lstat ? &dst_sb
: fstatat (dst_dirfd, drelname, &tmp_buf, AT_SYMLINK_NOFOLLOW) < 0
- ? nullptr : &tmp_buf);
+ ? NULL : &tmp_buf);
/* Never copy through a symlink we've just created. */
if (dst_lstat_sb
@@ -2050,7 +2050,7 @@ skip:
We'll use that info to detect this problem: cp -R dir dir. */
if (rename_errno == 0 || x->exchange)
- earlier_file = nullptr;
+ earlier_file = NULL;
else if (x->recursive && S_ISDIR (src_mode))
{
if (command_line_arg)
@@ -2133,7 +2133,7 @@ skip:
}
else
{
- if (! create_hard_link (nullptr, dst_dirfd, earlier_file,
+ if (! create_hard_link (NULL, dst_dirfd, earlier_file,
dst_name, dst_dirfd, dst_relname,
true, x->verbose, dereference))
goto un_backup;
@@ -2381,7 +2381,7 @@ skip:
if (x->move_mode)
printf (_("created directory %s\n"), quoteaf (dst_name));
else
- emit_verbose ("%s -> %s", src_name, dst_name, nullptr);
+ emit_verbose ("%s -> %s", src_name, dst_name, NULL);
}
}
else
@@ -2529,7 +2529,7 @@ skip:
{
char *src_link_val = areadlink_with_size (src_name, src_sb.st_size);
dest_is_symlink = true;
- if (src_link_val == nullptr)
+ if (src_link_val == NULL)
{
error (0, errno, _("cannot read symbolic link %s"),
quoteaf (src_name));
@@ -2755,7 +2755,7 @@ un_backup:
remove the entry associating the source dev/ino with the
destination file name, so we don't try to 'preserve' a link
to a file we didn't create. */
- if (earlier_file == nullptr)
+ if (earlier_file == NULL)
forget_created (src_sb.st_ino, src_sb.st_dev);
if (dst_backup)
@@ -2816,7 +2816,7 @@ copy (char const *src_name, char const *dst_name,
bool first_dir_created_per_command_line_arg = false;
return copy_internal (src_name, dst_name, dst_dirfd, dst_relname,
- nonexistent_dst, nullptr, nullptr,
+ nonexistent_dst, NULL, NULL,
options, true,
&first_dir_created_per_command_line_arg,
copy_into_self, rename_succeeded);
diff --git a/src/copy.h b/src/copy.h
index a78d29fdcc..0f3616c218 100644
--- a/src/copy.h
+++ b/src/copy.h
@@ -294,7 +294,7 @@ struct cp_options
rm -rf a b c; mkdir a b c; touch a/f b/f; mv a/f b/f c
For now, it protects only regular files when copying (i.e., not renaming).
When renaming, it protects all non-directories.
- Use dest_info_init to initialize it, or set it to nullptr to disable
+ Use dest_info_init to initialize it, or set it to NULL to disable
this feature. */
Hash_table *dest_info;
diff --git a/src/coreutils.c b/src/coreutils.c
index a6497e2070..5ff5c3d4cb 100644
--- a/src/coreutils.c
+++ b/src/coreutils.c
@@ -49,7 +49,7 @@ static struct option const long_options[] =
{
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
@@ -93,7 +93,7 @@ Use: '%s --coreutils-prog=PROGRAM_NAME --help' for individual program help.\n"),
static void
launch_program (char const *prog_name, int prog_argc, char **prog_argv)
{
- int (*prog_main) (int, char **) = nullptr;
+ int (*prog_main) (int, char **) = NULL;
/* Ensure that at least one parameter was passed. */
if (!prog_argc || !prog_argv || !prog_argv[0] || !prog_name)
@@ -151,7 +151,7 @@ main (int argc, char **argv)
size_t nskip = 0;
if (argc >= 2)
{
- char *arg_name = nullptr;
+ char *arg_name = NULL;
/* If calling coreutils directly, the "script" name isn't passed.
Distinguish the two cases with a -shebang suffix. */
@@ -194,7 +194,7 @@ main (int argc, char **argv)
textdomain (PACKAGE);
atexit (close_stdout);
- if ((optc = getopt_long (argc, argv, "", long_options, nullptr)) != -1)
+ if ((optc = getopt_long (argc, argv, "", long_options, NULL)) != -1)
switch (optc)
{
case_GETOPT_HELP_CHAR;
diff --git a/src/cp-hash.c b/src/cp-hash.c
index 339ed6206d..1d5159838a 100644
--- a/src/cp-hash.c
+++ b/src/cp-hash.c
@@ -86,7 +86,7 @@ forget_created (ino_t ino, dev_t dev)
probe.st_ino = ino;
probe.st_dev = dev;
- probe.name = nullptr;
+ probe.name = NULL;
ent = hash_remove (src_to_dest, &probe);
if (ent)
@@ -94,7 +94,7 @@ forget_created (ino_t ino, dev_t dev)
}
/* If INO/DEV correspond to an already-copied source file, return the
- name of the corresponding destination file. Otherwise, return nullptr. */
+ name of the corresponding destination file. Otherwise, return NULL. */
extern char *
src_to_dest_lookup (ino_t ino, dev_t dev)
@@ -104,12 +104,12 @@ src_to_dest_lookup (ino_t ino, dev_t dev)
ent.st_ino = ino;
ent.st_dev = dev;
e = hash_lookup (src_to_dest, &ent);
- return e ? e->name : nullptr;
+ return e ? e->name : NULL;
}
/* Add file NAME, copied from inode number INO and device number DEV,
to the list of files we have copied.
- Return nullptr if inserted, otherwise a non-null pointer. */
+ Return NULL if inserted, otherwise a non-null pointer. */
extern char *
remember_copied (char const *name, ino_t ino, dev_t dev)
@@ -123,7 +123,7 @@ remember_copied (char const *name, ino_t ino, dev_t dev)
ent->st_dev = dev;
ent_from_table = hash_insert (src_to_dest, ent);
- if (ent_from_table == nullptr)
+ if (ent_from_table == NULL)
{
/* Insertion failed due to lack of memory. */
xalloc_die ();
@@ -139,17 +139,17 @@ remember_copied (char const *name, ino_t ino, dev_t dev)
}
/* New key; insertion succeeded. */
- return nullptr;
+ return NULL;
}
/* Initialize the hash table. */
extern void
hash_init (void)
{
- src_to_dest = hash_initialize (INITIAL_TABLE_SIZE, nullptr,
+ src_to_dest = hash_initialize (INITIAL_TABLE_SIZE, NULL,
src_to_dest_hash,
src_to_dest_compare,
src_to_dest_free);
- if (src_to_dest == nullptr)
+ if (src_to_dest == NULL)
xalloc_die ();
}
diff --git a/src/cp.c b/src/cp.c
index af28c44f3f..bc43850a67 100644
--- a/src/cp.c
+++ b/src/cp.c
@@ -84,7 +84,7 @@ static bool remove_trailing_slashes;
static char const *const sparse_type_string[] =
{
- "never", "auto", "always", nullptr
+ "never", "auto", "always", NULL
};
static enum Sparse_type const sparse_type[] =
{
@@ -94,7 +94,7 @@ ARGMATCH_VERIFY (sparse_type_string, sparse_type);
static char const *const reflink_type_string[] =
{
- "auto", "always", "never", nullptr
+ "auto", "always", "never", NULL
};
static enum Reflink_type const reflink_type[] =
{
@@ -104,7 +104,7 @@ ARGMATCH_VERIFY (reflink_type_string, reflink_type);
static char const *const update_type_string[] =
{
- "all", "none", "none-fail", "older", nullptr
+ "all", "none", "none-fail", "older", NULL
};
static enum Update_type const update_type[] =
{
@@ -114,40 +114,40 @@ ARGMATCH_VERIFY (update_type_string, update_type);
static struct option const long_opts[] =
{
- {"archive", no_argument, nullptr, 'a'},
- {"attributes-only", no_argument, nullptr, ATTRIBUTES_ONLY_OPTION},
- {"backup", optional_argument, nullptr, 'b'},
- {"copy-contents", no_argument, nullptr, COPY_CONTENTS_OPTION},
- {"debug", no_argument, nullptr, DEBUG_OPTION},
- {"dereference", no_argument, nullptr, 'L'},
- {"force", no_argument, nullptr, 'f'},
- {"interactive", no_argument, nullptr, 'i'},
- {"link", no_argument, nullptr, 'l'},
- {"no-clobber", no_argument, nullptr, 'n'}, /* Deprecated. */
- {"no-dereference", no_argument, nullptr, 'P'},
- {"no-preserve", required_argument, nullptr, NO_PRESERVE_ATTRIBUTES_OPTION},
- {"no-target-directory", no_argument, nullptr, 'T'},
- {"one-file-system", no_argument, nullptr, 'x'},
- {"parents", no_argument, nullptr, PARENTS_OPTION},
- {"path", no_argument, nullptr, PARENTS_OPTION}, /* Deprecated. */
- {"preserve", optional_argument, nullptr, PRESERVE_ATTRIBUTES_OPTION},
- {"recursive", no_argument, nullptr, 'R'},
- {"remove-destination", no_argument, nullptr, UNLINK_DEST_BEFORE_OPENING},
- {"sparse", required_argument, nullptr, SPARSE_OPTION},
- {"reflink", optional_argument, nullptr, REFLINK_OPTION},
- {"strip-trailing-slashes", no_argument, nullptr,
+ {"archive", no_argument, NULL, 'a'},
+ {"attributes-only", no_argument, NULL, ATTRIBUTES_ONLY_OPTION},
+ {"backup", optional_argument, NULL, 'b'},
+ {"copy-contents", no_argument, NULL, COPY_CONTENTS_OPTION},
+ {"debug", no_argument, NULL, DEBUG_OPTION},
+ {"dereference", no_argument, NULL, 'L'},
+ {"force", no_argument, NULL, 'f'},
+ {"interactive", no_argument, NULL, 'i'},
+ {"link", no_argument, NULL, 'l'},
+ {"no-clobber", no_argument, NULL, 'n'}, /* Deprecated. */
+ {"no-dereference", no_argument, NULL, 'P'},
+ {"no-preserve", required_argument, NULL, NO_PRESERVE_ATTRIBUTES_OPTION},
+ {"no-target-directory", no_argument, NULL, 'T'},
+ {"one-file-system", no_argument, NULL, 'x'},
+ {"parents", no_argument, NULL, PARENTS_OPTION},
+ {"path", no_argument, NULL, PARENTS_OPTION}, /* Deprecated. */
+ {"preserve", optional_argument, NULL, PRESERVE_ATTRIBUTES_OPTION},
+ {"recursive", no_argument, NULL, 'R'},
+ {"remove-destination", no_argument, NULL, UNLINK_DEST_BEFORE_OPENING},
+ {"sparse", required_argument, NULL, SPARSE_OPTION},
+ {"reflink", optional_argument, NULL, REFLINK_OPTION},
+ {"strip-trailing-slashes", no_argument, NULL,
STRIP_TRAILING_SLASHES_OPTION},
- {"suffix", required_argument, nullptr, 'S'},
- {"symbolic-link", no_argument, nullptr, 's'},
- {"target-directory", required_argument, nullptr, 't'},
- {"update", optional_argument, nullptr, 'u'},
- {"verbose", no_argument, nullptr, 'v'},
- {"keep-directory-symlink", no_argument, nullptr,
+ {"suffix", required_argument, NULL, 'S'},
+ {"symbolic-link", no_argument, NULL, 's'},
+ {"target-directory", required_argument, NULL, 't'},
+ {"update", optional_argument, NULL, 'u'},
+ {"verbose", no_argument, NULL, 'v'},
+ {"keep-directory-symlink", no_argument, NULL,
KEEP_DIRECTORY_SYMLINK_OPTION},
{GETOPT_SELINUX_CONTEXT_OPTION_DECL},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
void
@@ -407,7 +407,7 @@ make_dir_parents_private (char const *const_dir, size_t src_offset,
{
idx_t dirlen = dir_len (const_dir);
- *attr_list = nullptr;
+ *attr_list = NULL;
/* Succeed immediately if the parent of CONST_DIR must already exist,
as the target directory has already been checked. */
@@ -516,7 +516,7 @@ make_dir_parents_private (char const *const_dir, size_t src_offset,
}
else
{
- if (verbose_fmt_string != nullptr)
+ if (verbose_fmt_string != NULL)
printf (verbose_fmt_string, src, dir);
}
@@ -724,7 +724,7 @@ do_copy (int n_files, char **file, char const *target_directory,
parent_exists =
(make_dir_parents_private
(dst_name, arg_in_concat - dst_name, target_dirfd,
- (x->verbose ? "%s -> %s\n" : nullptr),
+ (x->verbose ? "%s -> %s\n" : NULL),
&attr_list, &new_dst, x));
}
else
@@ -753,7 +753,7 @@ do_copy (int n_files, char **file, char const *target_directory,
bool copy_into_self;
ok &= copy (arg, dst_name, target_dirfd, dst_relname,
- new_dst, x, ©_into_self, nullptr);
+ new_dst, x, ©_into_self, NULL);
if (parents_option)
ok &= re_protect (dst_name, arg_in_concat, target_dirfd,
@@ -810,7 +810,7 @@ do_copy (int n_files, char **file, char const *target_directory,
}
bool unused;
- ok = copy (source, dest, AT_FDCWD, dest, -new_dst, x, &unused, nullptr);
+ ok = copy (source, dest, AT_FDCWD, dest, -new_dst, x, &unused, NULL);
}
return ok;
@@ -838,7 +838,7 @@ cp_option_init (struct cp_options *x)
x->explicit_no_preserve_mode = false;
x->preserve_security_context = false; /* -a or --preserve=context. */
x->require_preserve_context = false; /* --preserve=context. */
- x->set_security_context = nullptr; /* -Z, set sys default context. */
+ x->set_security_context = NULL; /* -Z, set sys default context. */
x->preserve_xattr = false;
x->reduce_diagnostics = false;
x->require_preserve_xattr = false;
@@ -862,10 +862,10 @@ cp_option_init (struct cp_options *x)
in general one cannot do that safely, give the current semantics of
open's O_EXCL flag, (which POSIX doesn't even allow cp to use, btw).
But POSIX requires it. */
- x->open_dangling_dest_symlink = getenv ("POSIXLY_CORRECT") != nullptr;
+ x->open_dangling_dest_symlink = getenv ("POSIXLY_CORRECT") != NULL;
- x->dest_info = nullptr;
- x->src_info = nullptr;
+ x->dest_info = NULL;
+ x->src_info = NULL;
}
/* Given a string, ARG, containing a comma-separated list of arguments
@@ -893,7 +893,7 @@ decode_preserve_arg (char const *arg, struct cp_options *x, bool on_off)
static char const *const preserve_args[] =
{
"mode", "timestamps",
- "ownership", "links", "context", "xattr", "all", nullptr
+ "ownership", "links", "context", "xattr", "all", NULL
};
ARGMATCH_VERIFY (preserve_args, preserve_vals);
@@ -966,13 +966,13 @@ int
main (int argc, char **argv)
{
bool make_backups = false;
- char const *backup_suffix = nullptr;
- char *version_control_string = nullptr;
+ char const *backup_suffix = NULL;
+ char *version_control_string = NULL;
struct cp_options x;
bool copy_contents = false;
- char *target_directory = nullptr;
+ char *target_directory = NULL;
bool no_target_directory = false;
- char const *scontext = nullptr;
+ char const *scontext = NULL;
initialize_main (&argc, &argv);
set_program_name (argv[0]);
@@ -987,7 +987,7 @@ main (int argc, char **argv)
int c;
while ((c = getopt_long (argc, argv, "abdfHilLnprst:uvxPRS:TZ",
- long_opts, nullptr))
+ long_opts, NULL))
!= -1)
{
switch (c)
@@ -998,7 +998,7 @@ main (int argc, char **argv)
break;
case REFLINK_OPTION:
- if (optarg == nullptr)
+ if (optarg == NULL)
x.reflink_mode = REFLINK_ALWAYS;
else
x.reflink_mode = XARGMATCH ("--reflink", optarg,
@@ -1076,7 +1076,7 @@ main (int argc, char **argv)
break;
case PRESERVE_ATTRIBUTES_OPTION:
- if (optarg == nullptr)
+ if (optarg == NULL)
{
/* Fall through to the case for 'p' below. */
}
@@ -1155,7 +1155,7 @@ main (int argc, char **argv)
else
{
x.set_security_context = selabel_open (SELABEL_CTX_FILE,
- nullptr, 0);
+ NULL, 0);
if (! x.set_security_context)
error (0, errno, _("warning: ignoring --context"));
}
@@ -1248,7 +1248,7 @@ main (int argc, char **argv)
/* FIXME: This handles new files. But what about existing files?
I.e., if updating a tree, new files would have the specified context,
but shouldn't existing files be updated for consistency like this?
- if (scontext && !restorecon (nullptr, dst_path, 0))
+ if (scontext && !restorecon (NULL, dst_path, 0))
error (...);
*/
if (scontext && setfscreatecon (scontext) < 0)
diff --git a/src/csplit.c b/src/csplit.c
index b6a135f1ef..a28f2fa5fa 100644
--- a/src/csplit.c
+++ b/src/csplit.c
@@ -112,10 +112,10 @@ static void delete_all_files (bool);
static void save_line_to_file (const struct cstring *line);
/* Start of buffer list. */
-static struct buffer_record *head = nullptr;
+static struct buffer_record *head = NULL;
/* Partially read line. */
-static char *hold_area = nullptr;
+static char *hold_area = NULL;
/* Number of bytes in 'hold_area'. */
static idx_t hold_count = 0;
@@ -130,13 +130,13 @@ static intmax_t current_line = 0;
static bool have_read_eof = false;
/* Name of output files. */
-static char *volatile filename_space = nullptr;
+static char *volatile filename_space = NULL;
/* Prefix part of output file names. */
-static char const *volatile prefix = nullptr;
+static char const *volatile prefix = NULL;
/* Suffix part of output file names. */
-static char *volatile suffix = nullptr;
+static char *volatile suffix = NULL;
/* Number of digits to use in output file names. */
static int volatile digits = 2;
@@ -148,10 +148,10 @@ static int volatile files_created = 0;
static intmax_t bytes_written;
/* Output file pointer. */
-static FILE *output_stream = nullptr;
+static FILE *output_stream = NULL;
/* Output file name. */
-static char *output_filename = nullptr;
+static char *output_filename = NULL;
/* Perhaps it would be cleaner to pass arg values instead of indexes. */
static char **global_argv;
@@ -187,17 +187,17 @@ enum
static struct option const longopts[] =
{
- {"digits", required_argument, nullptr, 'n'},
- {"quiet", no_argument, nullptr, 'q'}, /* Deprecated. */
- {"silent", no_argument, nullptr, 's'},
- {"keep-files", no_argument, nullptr, 'k'},
- {"elide-empty-files", no_argument, nullptr, 'z'},
- {"prefix", required_argument, nullptr, 'f'},
- {"suffix-format", required_argument, nullptr, 'b'},
- {"suppress-matched", no_argument, nullptr, SUPPRESS_MATCHED_OPTION},
+ {"digits", required_argument, NULL, 'n'},
+ {"quiet", no_argument, NULL, 'q'}, /* Deprecated. */
+ {"silent", no_argument, NULL, 's'},
+ {"keep-files", no_argument, NULL, 'k'},
+ {"elide-empty-files", no_argument, NULL, 'z'},
+ {"prefix", required_argument, NULL, 'f'},
+ {"suffix-format", required_argument, NULL, 'b'},
+ {"suppress-matched", no_argument, NULL, SUPPRESS_MATCHED_OPTION},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
/* Optionally remove files created so far; then exit.
@@ -212,7 +212,7 @@ cleanup (void)
sigprocmask (SIG_BLOCK, &caught_signals, &oldset);
delete_all_files (false);
- sigprocmask (SIG_SETMASK, &oldset, nullptr);
+ sigprocmask (SIG_SETMASK, &oldset, NULL);
}
static _Noreturn void
@@ -291,7 +291,7 @@ new_line_control (void)
{
struct line *p = xmalloc (sizeof *p);
- p->next = nullptr;
+ p->next = NULL;
clear_line_control (p);
return p;
@@ -306,7 +306,7 @@ keep_new_line (struct buffer_record *b, char *line_start, idx_t line_len)
struct line *l;
/* If there is no existing area to keep line info, get some. */
- if (b->line_start == nullptr)
+ if (b->line_start == NULL)
b->line_start = b->curr_line = new_line_control ();
/* If existing area for lines is full, get more. */
@@ -407,13 +407,13 @@ get_new_buffer (idx_t min_size)
{
struct buffer_record *new_buffer = xmalloc (sizeof *new_buffer);
new_buffer->bytes_alloc = 0;
- new_buffer->buffer = xpalloc (nullptr, &new_buffer->bytes_alloc, min_size,
+ new_buffer->buffer = xpalloc (NULL, &new_buffer->bytes_alloc, min_size,
-1, 1);
new_buffer->bytes_used = 0;
new_buffer->start_line = new_buffer->first_available = last_line_number + 1;
new_buffer->num_lines = 0;
- new_buffer->line_start = new_buffer->curr_line = nullptr;
- new_buffer->next = nullptr;
+ new_buffer->line_start = new_buffer->curr_line = NULL;
+ new_buffer->next = NULL;
return new_buffer;
}
@@ -424,10 +424,10 @@ get_new_buffer (idx_t min_size)
static void
save_buffer (struct buffer_record *buf)
{
- buf->next = nullptr;
+ buf->next = NULL;
buf->curr_line = buf->line_start;
- if (head == nullptr)
+ if (head == NULL)
head = buf;
else
{
@@ -500,7 +500,7 @@ load_buffer (void)
static intmax_t
get_first_line_in_buffer (void)
{
- if (head == nullptr && !load_buffer ())
+ if (head == NULL && !load_buffer ())
return 0;
return head->first_available;
@@ -508,7 +508,7 @@ get_first_line_in_buffer (void)
/* Return a pointer to the logical first line in the buffer and make the
next line the logical first line.
- Return nullptr if there is no more input. */
+ Return NULL if there is no more input. */
static struct cstring *
remove_line (void)
@@ -516,7 +516,7 @@ remove_line (void)
/* If non-null, this is the buffer for which the previous call
returned the final line. So now, presuming that line has been
processed, we can free the buffer and reset this pointer. */
- static struct buffer_record *prev_buf = nullptr;
+ static struct buffer_record *prev_buf = NULL;
struct cstring *line; /* Return value. */
struct line *l; /* For convenience. */
@@ -524,11 +524,11 @@ remove_line (void)
if (prev_buf)
{
free_buffer (prev_buf);
- prev_buf = nullptr;
+ prev_buf = NULL;
}
- if (head == nullptr && !load_buffer ())
- return nullptr;
+ if (head == NULL && !load_buffer ())
+ return NULL;
if (current_line < head->first_available)
current_line = head->first_available;
@@ -544,7 +544,7 @@ remove_line (void)
{
/* Go on to the next line record. */
head->curr_line = l->next;
- if (head->curr_line == nullptr || head->curr_line->used == 0)
+ if (head->curr_line == NULL || head->curr_line->used == 0)
{
/* Go on to the next data block.
but first record the current one so we can free it
@@ -558,16 +558,16 @@ remove_line (void)
}
/* Search the buffers for line LINENUM, reading more input if necessary.
- Return a pointer to the line, or nullptr if it is not found in the file. */
+ Return a pointer to the line, or NULL if it is not found in the file. */
static struct cstring *
find_line (intmax_t linenum)
{
- if (head == nullptr && !load_buffer ())
- return nullptr;
+ if (head == NULL && !load_buffer ())
+ return NULL;
if (linenum < head->start_line)
- return nullptr;
+ return NULL;
for (struct buffer_record *b = head;;)
{
@@ -587,8 +587,8 @@ find_line (intmax_t linenum)
}
return &l->starts[offset];
}
- if (b->next == nullptr && !load_buffer ())
- return nullptr;
+ if (b->next == NULL && !load_buffer ())
+ return NULL;
b = b->next; /* Try the next data block. */
}
}
@@ -598,7 +598,7 @@ find_line (intmax_t linenum)
static bool
no_more_lines (void)
{
- return find_line (current_line + 1) == nullptr;
+ return find_line (current_line + 1) == NULL;
}
/* Open NAME as standard input. */
@@ -637,7 +637,7 @@ write_to_file (intmax_t last_line, bool ignore, int argnum)
for (intmax_t i = 0; i < lines; i++)
{
line = remove_line ();
- if (line == nullptr)
+ if (line == NULL)
{
error (0, 0, _("%s: line number out of range"),
quote (global_argv[argnum]));
@@ -655,7 +655,7 @@ dump_rest_of_file (void)
{
struct cstring *line;
- while ((line = remove_line ()) != nullptr)
+ while ((line = remove_line ()) != NULL)
save_line_to_file (line);
}
@@ -702,7 +702,7 @@ process_line_count (const struct control *p, intmax_t repetition)
while (linenum++ < last_line_to_save)
{
struct cstring *line = remove_line ();
- if (line == nullptr)
+ if (line == NULL)
handle_line_error (p, repetition);
save_line_to_file (line);
}
@@ -761,7 +761,7 @@ process_regexp (struct control *p, intmax_t repetition)
while (true)
{
line = find_line (++current_line);
- if (line == nullptr)
+ if (line == NULL)
{
if (p->repeat_forever)
{
@@ -779,7 +779,7 @@ process_regexp (struct control *p, intmax_t repetition)
if (line->str[line_len - 1] == '\n')
line_len--;
ret = re_search (&p->re_compiled, line->str, line_len,
- 0, line_len, nullptr);
+ 0, line_len, NULL);
if (ret == -2)
{
error (0, 0, _("error in regular expression search"));
@@ -801,7 +801,7 @@ process_regexp (struct control *p, intmax_t repetition)
while (true)
{
line = find_line (++current_line);
- if (line == nullptr)
+ if (line == NULL)
{
if (p->repeat_forever)
{
@@ -819,7 +819,7 @@ process_regexp (struct control *p, intmax_t repetition)
if (line->str[line_len - 1] == '\n')
line_len--;
ret = re_search (&p->re_compiled, line->str, line_len,
- 0, line_len, nullptr);
+ 0, line_len, NULL);
if (ret == -2)
{
error (0, 0, _("error in regular expression search"));
@@ -911,10 +911,10 @@ create_output_file (void)
sigset_t oldset;
sigprocmask (SIG_BLOCK, &caught_signals, &oldset);
output_stream = fopen (output_filename, "w");
- fopen_ok = (output_stream != nullptr);
+ fopen_ok = (output_stream != NULL);
fopen_errno = errno;
files_created = nfiles + fopen_ok;
- sigprocmask (SIG_SETMASK, &oldset, nullptr);
+ sigprocmask (SIG_SETMASK, &oldset, NULL);
}
if (! fopen_ok)
@@ -955,13 +955,13 @@ close_output_file (void)
if (ferror (output_stream))
{
error (0, 0, _("write error for %s"), quoteaf (output_filename));
- output_stream = nullptr;
+ output_stream = NULL;
cleanup_fatal ();
}
if (fclose (output_stream) != 0)
{
error (0, errno, "%s", quotef (output_filename));
- output_stream = nullptr;
+ output_stream = NULL;
cleanup_fatal ();
}
if (bytes_written == 0 && elide_empty_files)
@@ -975,7 +975,7 @@ close_output_file (void)
unlink_ok = (unlink (output_filename) == 0);
unlink_errno = errno;
files_created--;
- sigprocmask (SIG_SETMASK, &oldset, nullptr);
+ sigprocmask (SIG_SETMASK, &oldset, NULL);
if (! unlink_ok && unlink_errno != ENOENT)
error (0, unlink_errno, "%s", quotef (output_filename));
@@ -985,7 +985,7 @@ close_output_file (void)
if (!suppress_count)
fprintf (stdout, "%jd\n", bytes_written);
}
- output_stream = nullptr;
+ output_stream = NULL;
}
}
@@ -999,7 +999,7 @@ save_line_to_file (const struct cstring *line)
if (l != line->len)
{
error (0, errno, _("write error for %s"), quoteaf (output_filename));
- output_stream = nullptr;
+ output_stream = NULL;
cleanup_fatal ();
}
bytes_written += line->len;
@@ -1032,7 +1032,7 @@ new_control_record (void)
static void
check_for_offset (struct control *p, char const *str, char const *num)
{
- if (xstrtoimax (num, nullptr, 10, &p->offset, "") != LONGINT_OK)
+ if (xstrtoimax (num, NULL, 10, &p->offset, "") != LONGINT_OK)
error (EXIT_FAILURE, 0, _("%s: integer expected after delimiter"),
quote (str));
}
@@ -1058,7 +1058,7 @@ parse_repeat_count (int argnum, struct control *p, char *str)
else
{
uintmax_t val;
- if (xstrtoumax (str + 1, nullptr, 10, &val, "") != LONGINT_OK
+ if (xstrtoumax (str + 1, NULL, 10, &val, "") != LONGINT_OK
|| ckd_add (&p->repeat, val, 0))
{
error (EXIT_FAILURE, 0,
@@ -1086,7 +1086,7 @@ extract_regexp (int argnum, bool ignore, char const *str)
char const *err;
closing_delim = strrchr (str + 1, delim);
- if (closing_delim == nullptr)
+ if (closing_delim == NULL)
error (EXIT_FAILURE, 0,
_("%s: closing delimiter '%c' missing"), str, delim);
@@ -1096,10 +1096,10 @@ extract_regexp (int argnum, bool ignore, char const *str)
p->ignore = ignore;
p->regexpr = true;
- p->re_compiled.buffer = nullptr;
+ p->re_compiled.buffer = NULL;
p->re_compiled.allocated = 0;
p->re_compiled.fastmap = xmalloc (UCHAR_MAX + 1);
- p->re_compiled.translate = nullptr;
+ p->re_compiled.translate = NULL;
re_syntax_options =
RE_SYNTAX_POSIX_BASIC & ~RE_CONTEXT_INVALID_DUP & ~RE_NO_EMPTY_RANGES;
err = re_compile_pattern (str + 1, len, &p->re_compiled);
@@ -1136,7 +1136,7 @@ parse_patterns (int argc, int start, char **argv)
p->argnum = i;
uintmax_t val;
- if (xstrtoumax (argv[i], nullptr, 10, &val, "") != LONGINT_OK
+ if (xstrtoumax (argv[i], NULL, 10, &val, "") != LONGINT_OK
|| INTMAX_MAX < val)
error (EXIT_FAILURE, 0, _("%s: invalid pattern"), quote (argv[i]));
if (val == 0)
@@ -1273,7 +1273,7 @@ max_out (char *format)
error (EXIT_FAILURE, 0,
_("missing %% conversion specification in suffix"));
- int maxlen = snprintf (nullptr, 0, format, INT_MAX);
+ int maxlen = snprintf (NULL, 0, format, INT_MAX);
if (! (0 <= maxlen && maxlen <= IDX_MAX))
xalloc_die ();
return maxlen;
@@ -1293,14 +1293,14 @@ main (int argc, char **argv)
atexit (close_stdout);
global_argv = argv;
- controls = nullptr;
+ controls = NULL;
control_used = 0;
suppress_count = false;
remove_files = true;
suppress_matched = false;
prefix = DEFAULT_PREFIX;
- while ((optc = getopt_long (argc, argv, "f:b:kn:sqz", longopts, nullptr))
+ while ((optc = getopt_long (argc, argv, "f:b:kn:sqz", longopts, NULL))
!= -1)
switch (optc)
{
@@ -1373,7 +1373,7 @@ main (int argc, char **argv)
sigemptyset (&caught_signals);
for (int i = 0; i < nsigs; i++)
{
- sigaction (term_sig[i], nullptr, &act);
+ sigaction (term_sig[i], NULL, &act);
if (act.sa_handler != SIG_IGN)
sigaddset (&caught_signals, term_sig[i]);
}
@@ -1384,7 +1384,7 @@ main (int argc, char **argv)
for (int i = 0; i < nsigs; i++)
if (sigismember (&caught_signals, term_sig[i]))
- sigaction (term_sig[i], &act, nullptr);
+ sigaction (term_sig[i], &act, NULL);
}
split_file ();
diff --git a/src/cut.c b/src/cut.c
index 1287c33179..a045e6b8ea 100644
--- a/src/cut.c
+++ b/src/cut.c
@@ -108,17 +108,17 @@ enum
static struct option const longopts[] =
{
- {"bytes", required_argument, nullptr, 'b'},
- {"characters", required_argument, nullptr, 'c'},
- {"fields", required_argument, nullptr, 'f'},
- {"delimiter", required_argument, nullptr, 'd'},
- {"only-delimited", no_argument, nullptr, 's'},
- {"output-delimiter", required_argument, nullptr, OUTPUT_DELIMITER_OPTION},
- {"complement", no_argument, nullptr, COMPLEMENT_OPTION},
- {"zero-terminated", no_argument, nullptr, 'z'},
+ {"bytes", required_argument, NULL, 'b'},
+ {"characters", required_argument, NULL, 'c'},
+ {"fields", required_argument, NULL, 'f'},
+ {"delimiter", required_argument, NULL, 'd'},
+ {"only-delimited", no_argument, NULL, 's'},
+ {"output-delimiter", required_argument, NULL, OUTPUT_DELIMITER_OPTION},
+ {"complement", no_argument, NULL, COMPLEMENT_OPTION},
+ {"zero-terminated", no_argument, NULL, 'z'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
void
@@ -310,7 +310,7 @@ cut_fields (FILE *stream)
if (len < 0)
{
free (field_1_buffer);
- field_1_buffer = nullptr;
+ field_1_buffer = NULL;
if (ferror (stream) || feof (stream))
break;
xalloc_die ();
@@ -450,7 +450,7 @@ cut_file (char const *file, void (*cut_stream) (FILE *))
else
{
stream = fopen (file, "r");
- if (stream == nullptr)
+ if (stream == NULL)
{
error (0, errno, "%s", quotef (file));
return false;
@@ -483,7 +483,7 @@ main (int argc, char **argv)
bool ok;
bool delim_specified = false;
bool byte_mode = false;
- char *spec_list_string = nullptr;
+ char *spec_list_string = NULL;
initialize_main (&argc, &argv);
set_program_name (argv[0]);
@@ -499,7 +499,7 @@ main (int argc, char **argv)
delim = '\0';
have_read_stdin = false;
- while ((optc = getopt_long (argc, argv, "b:c:d:f:nsz", longopts, nullptr))
+ while ((optc = getopt_long (argc, argv, "b:c:d:f:nsz", longopts, NULL))
!= -1)
{
switch (optc)
@@ -576,7 +576,7 @@ main (int argc, char **argv)
if (!delim_specified)
delim = '\t';
- if (output_delimiter_string == nullptr)
+ if (output_delimiter_string == NULL)
{
output_delimiter_default[0] = delim;
output_delimiter_string = output_delimiter_default;
diff --git a/src/date.c b/src/date.c
index c90f245a7f..9a05cbc2eb 100644
--- a/src/date.c
+++ b/src/date.c
@@ -60,7 +60,7 @@ static char const *const time_spec_string[] =
/* Put "hours" and "minutes" first, since they aren't valid for
--rfc-3339. */
"hours", "minutes",
- "date", "seconds", "ns", nullptr
+ "date", "seconds", "ns", NULL
};
static enum Time_spec const time_spec[] =
{
@@ -85,23 +85,23 @@ static char const short_options[] = "d:f:I::r:Rs:u";
static struct option const long_options[] =
{
- {"date", required_argument, nullptr, 'd'},
- {"debug", no_argument, nullptr, DEBUG_DATE_PARSING_OPTION},
- {"file", required_argument, nullptr, 'f'},
- {"iso-8601", optional_argument, nullptr, 'I'},
- {"reference", required_argument, nullptr, 'r'},
- {"resolution", no_argument, nullptr, RESOLUTION_OPTION},
- {"rfc-email", no_argument, nullptr, 'R'},
- {"rfc-822", no_argument, nullptr, 'R'}, /* Deprecated. */
- {"rfc-2822", no_argument, nullptr, 'R'}, /* Deprecated. */
- {"rfc-3339", required_argument, nullptr, RFC_3339_OPTION},
- {"set", required_argument, nullptr, 's'},
- {"uct", no_argument, nullptr, 'u'}, /* Deprecated. */
- {"utc", no_argument, nullptr, 'u'},
- {"universal", no_argument, nullptr, 'u'},
+ {"date", required_argument, NULL, 'd'},
+ {"debug", no_argument, NULL, DEBUG_DATE_PARSING_OPTION},
+ {"file", required_argument, NULL, 'f'},
+ {"iso-8601", optional_argument, NULL, 'I'},
+ {"reference", required_argument, NULL, 'r'},
+ {"resolution", no_argument, NULL, RESOLUTION_OPTION},
+ {"rfc-email", no_argument, NULL, 'R'},
+ {"rfc-822", no_argument, NULL, 'R'}, /* Deprecated. */
+ {"rfc-2822", no_argument, NULL, 'R'}, /* Deprecated. */
+ {"rfc-3339", required_argument, NULL, RFC_3339_OPTION},
+ {"set", required_argument, NULL, 's'},
+ {"uct", no_argument, NULL, 'u'}, /* Deprecated. */
+ {"utc", no_argument, NULL, 'u'},
+ {"universal", no_argument, NULL, 'u'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
/* flags for parse_datetime2 */
@@ -307,12 +307,12 @@ res_width (long int res)
/* Return a newly allocated copy of FORMAT with each "%-N" adjusted to
be "%9N", "%6N", or whatever other resolution is appropriate for
- the current platform. If no "%-N" appears, return nullptr. */
+ the current platform. If no "%-N" appears, return NULL. */
static char *
adjust_resolution (char const *format)
{
- char *copy = nullptr;
+ char *copy = NULL;
for (char const *f = format; *f; f++)
if (f[0] == '%')
@@ -345,7 +345,7 @@ set_LC_TIME (char const *locale)
(in order to distinguish the default locale from the C locale on platforms
like macOS). */
char const *all = getenv ("LC_ALL");
- if (all != nullptr && *all != '\0')
+ if (all != NULL && *all != '\0')
{
/* Setting LC_TIME when LC_ALL is set would have no effect. Therefore we
have to unset LC_ALL and sets its value to all locale categories that
@@ -361,8 +361,8 @@ set_LC_TIME (char const *locale)
/* Set LC_TIME as an environment variable. */
char const *value = getenv ("LC_TIME");
- char *ret = (value == nullptr || *value == '\0' ? nullptr : xstrdup (value));
- if (locale != nullptr)
+ char *ret = (value == NULL || *value == '\0' ? NULL : xstrdup (value));
+ if (locale != NULL)
xsetenv ("LC_TIME", locale, 1);
else
unsetenv ("LC_TIME");
@@ -416,11 +416,11 @@ batch_convert (char const *input_filename,
else
{
in_stream = fopen (input_filename, "r");
- if (in_stream == nullptr)
+ if (in_stream == NULL)
error (EXIT_FAILURE, errno, "%s", quotef (input_filename));
}
- char *line = nullptr;
+ char *line = NULL;
size_t buflen = 0;
bool ok = true;
while (true)
@@ -435,7 +435,7 @@ batch_convert (char const *input_filename,
}
struct timespec when;
- if (! parse_datetime2 (&when, line, nullptr,
+ if (! parse_datetime2 (&when, line, NULL,
parse_datetime_flags, tz, tzstring))
{
if (line[line_length - 1] == '\n')
@@ -463,14 +463,14 @@ batch_convert (char const *input_filename,
int
main (int argc, char **argv)
{
- char const *datestr = nullptr;
- char const *set_datestr = nullptr;
+ char const *datestr = NULL;
+ char const *set_datestr = NULL;
bool set_date = false;
- char const *format = nullptr;
+ char const *format = NULL;
bool format_in_c_locale = false;
bool get_resolution = false;
- char *batch_file = nullptr;
- char *reference = nullptr;
+ char *batch_file = NULL;
+ char *reference = NULL;
bool discarded_datestr = false;
bool discarded_set_datestr = false;
@@ -483,7 +483,7 @@ main (int argc, char **argv)
atexit (close_stdout);
int optc;
- while ((optc = getopt_long (argc, argv, short_options, long_options, nullptr))
+ while ((optc = getopt_long (argc, argv, short_options, long_options, NULL))
!= -1)
{
switch (optc)
@@ -637,7 +637,7 @@ main (int argc, char **argv)
timezone_t tz = tzalloc (tzstring);
bool ok = true;
- if (batch_file != nullptr)
+ if (batch_file != NULL)
ok = batch_convert (batch_file, format_res, format_in_c_locale,
tz, tzstring);
else
@@ -668,7 +668,7 @@ main (int argc, char **argv)
else
{
/* (option_specified_date || set_date) */
- if (reference != nullptr)
+ if (reference != NULL)
{
struct stat refstats;
if (stat (reference, &refstats) != 0)
@@ -685,7 +685,7 @@ main (int argc, char **argv)
{
if (set_datestr)
datestr = set_datestr;
- valid_date = parse_datetime2 (&when, datestr, nullptr,
+ valid_date = parse_datetime2 (&when, datestr, NULL,
parse_datetime_flags,
tz, tzstring);
}
diff --git a/src/dd.c b/src/dd.c
index 045fdf7c01..acb268aa40 100644
--- a/src/dd.c
+++ b/src/dd.c
@@ -110,11 +110,11 @@ enum
STATUS_PROGRESS = 4
};
-/* The name of the input file, or nullptr for the standard input. */
-static char const *input_file = nullptr;
+/* The name of the input file, or NULL for the standard input. */
+static char const *input_file = NULL;
-/* The name of the output file, or nullptr for the standard output. */
-static char const *output_file = nullptr;
+/* The name of the output file, or NULL for the standard output. */
+static char const *output_file = NULL;
/* The page size on this host. */
static idx_t page_size;
@@ -855,7 +855,7 @@ install_signal_handlers (void)
sigemptyset (&caught_signals);
if (catch_siginfo)
sigaddset (&caught_signals, SIGINFO);
- sigaction (SIGINT, nullptr, &act);
+ sigaction (SIGINT, NULL, &act);
if (act.sa_handler != SIG_IGN)
sigaddset (&caught_signals, SIGINT);
act.sa_mask = caught_signals;
@@ -867,14 +867,14 @@ install_signal_handlers (void)
handle EINTR explicitly in iftruncate etc.
to avoid blocking on uncommitted read/write calls. */
act.sa_flags = 0;
- sigaction (SIGINFO, &act, nullptr);
+ sigaction (SIGINFO, &act, NULL);
}
if (sigismember (&caught_signals, SIGINT))
{
act.sa_handler = interrupt_handler;
act.sa_flags = SA_NODEFER | SA_RESETHAND;
- sigaction (SIGINT, &act, nullptr);
+ sigaction (SIGINT, &act, NULL);
}
}
@@ -942,7 +942,7 @@ process_signals (void)
if (infos)
info_signal_count = infos - 1;
- sigprocmask (SIG_SETMASK, &oldset, nullptr);
+ sigprocmask (SIG_SETMASK, &oldset, NULL);
if (interrupt)
cleanup ();
@@ -1464,7 +1464,7 @@ scanargs (int argc, char *const *argv)
char const *name = argv[i];
char const *val = strchr (name, '=');
- if (val == nullptr)
+ if (val == NULL)
{
diagnose (0, _("unrecognized operand %s"), quoteaf (name));
usage (EXIT_FAILURE);
@@ -1494,7 +1494,7 @@ scanargs (int argc, char *const *argv)
bool has_B = !!strchr (val, 'B');
intmax_t n_min = 0;
intmax_t n_max = INTMAX_MAX;
- idx_t *converted_idx = nullptr;
+ idx_t *converted_idx = NULL;
/* Maximum blocksize. Keep it smaller than IDX_MAX, so that
it fits into blocksize vars even if 1 is added for conv=swab.
@@ -2396,7 +2396,7 @@ main (int argc, char **argv)
parse_gnu_standard_options_only (argc, argv, PROGRAM_NAME, PACKAGE, Version,
true, usage, AUTHORS,
- (char const *) nullptr);
+ (char const *) NULL);
close_stdout_required = false;
/* Initialize translation table to identity translation. */
@@ -2408,7 +2408,7 @@ main (int argc, char **argv)
apply_translations ();
- if (input_file == nullptr)
+ if (input_file == NULL)
{
input_file = _("standard input");
set_fd_flags (STDIN_FILENO, input_flags, input_file);
@@ -2425,7 +2425,7 @@ main (int argc, char **argv)
input_offset = MAX (0, offset);
input_seek_errno = errno;
- if (output_file == nullptr)
+ if (output_file == NULL)
{
output_file = _("standard output");
set_fd_flags (STDOUT_FILENO, output_flags, output_file);
diff --git a/src/df.c b/src/df.c
index d9bac5a7bf..ae30660ff3 100644
--- a/src/df.c
+++ b/src/df.c
@@ -166,7 +166,7 @@ struct field_data_t
display_field_t field;
char const *arg;
field_type_t field_type;
- char const *caption;/* nullptr means use default header of this field. */
+ char const *caption;/* NULL means use default header of this field. */
int width; /* Auto adjusted (up) widths used to align columns. */
bool align_right; /* Whether to right-align columns, not left-align. */
bool used;
@@ -253,23 +253,23 @@ enum
static struct option const long_options[] =
{
- {"all", no_argument, nullptr, 'a'},
- {"block-size", required_argument, nullptr, 'B'},
- {"inodes", no_argument, nullptr, 'i'},
- {"human-readable", no_argument, nullptr, 'h'},
- {"si", no_argument, nullptr, 'H'},
- {"local", no_argument, nullptr, 'l'},
- {"output", optional_argument, nullptr, OUTPUT_OPTION},
- {"portability", no_argument, nullptr, 'P'},
- {"print-type", no_argument, nullptr, 'T'},
- {"sync", no_argument, nullptr, SYNC_OPTION},
- {"no-sync", no_argument, nullptr, NO_SYNC_OPTION},
- {"total", no_argument, nullptr, TOTAL_OPTION},
- {"type", required_argument, nullptr, 't'},
- {"exclude-type", required_argument, nullptr, 'x'},
+ {"all", no_argument, NULL, 'a'},
+ {"block-size", required_argument, NULL, 'B'},
+ {"inodes", no_argument, NULL, 'i'},
+ {"human-readable", no_argument, NULL, 'h'},
+ {"si", no_argument, NULL, 'H'},
+ {"local", no_argument, NULL, 'l'},
+ {"output", optional_argument, NULL, OUTPUT_OPTION},
+ {"portability", no_argument, NULL, 'P'},
+ {"print-type", no_argument, NULL, 'T'},
+ {"sync", no_argument, NULL, SYNC_OPTION},
+ {"no-sync", no_argument, NULL, NO_SYNC_OPTION},
+ {"total", no_argument, NULL, TOTAL_OPTION},
+ {"type", required_argument, NULL, 't'},
+ {"exclude-type", required_argument, NULL, 'x'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
/* Stat FILE and put the results into *ST. Return 0 if successful, an
@@ -413,7 +413,7 @@ alloc_field (int f, char const *c)
if (ncolumns == ncolumns_alloc)
columns = xpalloc (columns, &ncolumns_alloc, 1, -1, sizeof *columns);
columns[ncolumns++] = &field_data[f];
- if (c != nullptr)
+ if (c != NULL)
field_data[f].caption = c;
affirm (!field_data[f].used);
@@ -475,7 +475,7 @@ decode_output_arg (char const *arg)
case IPCENT_FIELD:
case TARGET_FIELD:
case FILE_FIELD:
- alloc_field (field, nullptr);
+ alloc_field (field, NULL);
break;
case SIZE_FIELD:
@@ -504,48 +504,48 @@ get_field_list (void)
switch (header_mode)
{
case DEFAULT_MODE:
- alloc_field (SOURCE_FIELD, nullptr);
+ alloc_field (SOURCE_FIELD, NULL);
if (print_type)
- alloc_field (FSTYPE_FIELD, nullptr);
- alloc_field (SIZE_FIELD, nullptr);
- alloc_field (USED_FIELD, nullptr);
- alloc_field (AVAIL_FIELD, nullptr);
- alloc_field (PCENT_FIELD, nullptr);
- alloc_field (TARGET_FIELD, nullptr);
+ alloc_field (FSTYPE_FIELD, NULL);
+ alloc_field (SIZE_FIELD, NULL);
+ alloc_field (USED_FIELD, NULL);
+ alloc_field (AVAIL_FIELD, NULL);
+ alloc_field (PCENT_FIELD, NULL);
+ alloc_field (TARGET_FIELD, NULL);
break;
case HUMAN_MODE:
- alloc_field (SOURCE_FIELD, nullptr);
+ alloc_field (SOURCE_FIELD, NULL);
if (print_type)
- alloc_field (FSTYPE_FIELD, nullptr);
+ alloc_field (FSTYPE_FIELD, NULL);
alloc_field (SIZE_FIELD, N_("Size"));
- alloc_field (USED_FIELD, nullptr);
+ alloc_field (USED_FIELD, NULL);
alloc_field (AVAIL_FIELD, N_("Avail"));
- alloc_field (PCENT_FIELD, nullptr);
- alloc_field (TARGET_FIELD, nullptr);
+ alloc_field (PCENT_FIELD, NULL);
+ alloc_field (TARGET_FIELD, NULL);
break;
case INODES_MODE:
- alloc_field (SOURCE_FIELD, nullptr);
+ alloc_field (SOURCE_FIELD, NULL);
if (print_type)
- alloc_field (FSTYPE_FIELD, nullptr);
- alloc_field (ITOTAL_FIELD, nullptr);
- alloc_field (IUSED_FIELD, nullptr);
- alloc_field (IAVAIL_FIELD, nullptr);
- alloc_field (IPCENT_FIELD, nullptr);
- alloc_field (TARGET_FIELD, nullptr);
+ alloc_field (FSTYPE_FIELD, NULL);
+ alloc_field (ITOTAL_FIELD, NULL);
+ alloc_field (IUSED_FIELD, NULL);
+ alloc_field (IAVAIL_FIELD, NULL);
+ alloc_field (IPCENT_FIELD, NULL);
+ alloc_field (TARGET_FIELD, NULL);
break;
case POSIX_MODE:
- alloc_field (SOURCE_FIELD, nullptr);
+ alloc_field (SOURCE_FIELD, NULL);
if (print_type)
- alloc_field (FSTYPE_FIELD, nullptr);
- alloc_field (SIZE_FIELD, nullptr);
- alloc_field (USED_FIELD, nullptr);
- alloc_field (AVAIL_FIELD, nullptr);
+ alloc_field (FSTYPE_FIELD, NULL);
+ alloc_field (SIZE_FIELD, NULL);
+ alloc_field (USED_FIELD, NULL);
+ alloc_field (AVAIL_FIELD, NULL);
alloc_field (PCENT_FIELD, N_("Capacity"));
- alloc_field (TARGET_FIELD, nullptr);
+ alloc_field (TARGET_FIELD, NULL);
break;
case OUTPUT_MODE:
@@ -638,7 +638,7 @@ ATTRIBUTE_PURE
static bool
selected_fstype (char const *fstype)
{
- if (fs_select_list == nullptr || fstype == nullptr)
+ if (fs_select_list == NULL || fstype == NULL)
return true;
for (const struct fs_type_list *fsp = fs_select_list; fsp;
fsp = fsp->fs_next)
@@ -653,7 +653,7 @@ ATTRIBUTE_PURE
static bool
excluded_fstype (char const *fstype)
{
- if (fs_exclude_list == nullptr || fstype == nullptr)
+ if (fs_exclude_list == NULL || fstype == NULL)
return false;
for (const struct fs_type_list *fsp = fs_exclude_list; fsp;
fsp = fsp->fs_next)
@@ -680,14 +680,14 @@ devlist_compare (void const *x, void const *y)
static struct devlist *
devlist_for_dev (dev_t dev)
{
- if (devlist_table == nullptr)
- return nullptr;
+ if (devlist_table == NULL)
+ return NULL;
struct devlist dev_entry;
dev_entry.dev_num = dev;
struct devlist *found = hash_lookup (devlist_table, &dev_entry);
- if (found == nullptr)
- return nullptr;
+ if (found == NULL)
+ return NULL;
/* Return the last devlist entry we have seen with this dev_num */
return found->seen_last;
@@ -704,22 +704,22 @@ static void
filter_mount_list (bool devices_only)
{
/* Temporary list to keep entries ordered. */
- struct devlist *device_list = nullptr;
+ struct devlist *device_list = NULL;
int mount_list_size = 0;
for (struct mount_entry *me = mount_list; me; me = me->me_next)
mount_list_size++;
- devlist_table = hash_initialize (mount_list_size, nullptr,
- devlist_hash, devlist_compare, nullptr);
- if (devlist_table == nullptr)
+ devlist_table = hash_initialize (mount_list_size, NULL,
+ devlist_hash, devlist_compare, NULL);
+ if (devlist_table == NULL)
xalloc_die ();
/* Sort all 'wanted' entries into the list device_list. */
for (struct mount_entry *me = mount_list; me;)
{
struct stat buf;
- struct mount_entry *discard_me = nullptr;
+ struct mount_entry *discard_me = NULL;
/* Avoid stating remote file systems as that may hang.
On Linux we probably have me_dev populated from /proc/self/mountinfo,
@@ -744,8 +744,8 @@ filter_mount_list (bool devices_only)
bool target_nearer_root = strlen (seen_dev->me->me_mountdir)
> strlen (me->me_mountdir);
/* With bind mounts, prefer items nearer the root of the source */
- bool source_below_root = seen_dev->me->me_mntroot != nullptr
- && me->me_mntroot != nullptr
+ bool source_below_root = seen_dev->me->me_mntroot != NULL
+ && me->me_mntroot != NULL
&& (strlen (seen_dev->me->me_mntroot)
< strlen (me->me_mntroot));
if (! print_grand_total
@@ -800,7 +800,7 @@ filter_mount_list (bool devices_only)
device_list = devlist;
struct devlist *hash_entry = hash_insert (devlist_table, devlist);
- if (hash_entry == nullptr)
+ if (hash_entry == NULL)
xalloc_die ();
/* Ensure lookups use this latest devlist. */
hash_entry->seen_last = devlist;
@@ -812,7 +812,7 @@ filter_mount_list (bool devices_only)
/* Finally rebuild the mount_list from the devlist. */
if (! devices_only)
{
- mount_list = nullptr;
+ mount_list = NULL;
while (device_list)
{
/* Add the mount entry. */
@@ -824,13 +824,13 @@ filter_mount_list (bool devices_only)
device_list = next;
}
hash_free (devlist_table);
- devlist_table = nullptr;
+ devlist_table = NULL;
}
}
/* Search a mount entry list for device id DEV.
- Return the corresponding mount entry if found or nullptr if not. */
+ Return the corresponding mount entry if found or NULL if not. */
ATTRIBUTE_PURE
static struct mount_entry const *
@@ -840,7 +840,7 @@ me_for_dev (dev_t dev)
if (dl)
return dl->me;
- return nullptr;
+ return NULL;
}
/* Return true if N is a known integer value. On many file systems,
@@ -1121,7 +1121,7 @@ get_dev (char const *device, char const *mount_point, char const *file,
v = &inode_values;
break;
case OTHER_FLD:
- v = nullptr;
+ v = NULL;
break;
default:
affirm (!"bad field_type");
@@ -1231,11 +1231,11 @@ get_dev (char const *device, char const *mount_point, char const *file,
}
/* Scan the mount list returning the _last_ device found for MOUNT.
- nullptr is returned if MOUNT not found. The result is malloced. */
+ NULL is returned if MOUNT not found. The result is malloced. */
static char *
last_device_for_mount (char const *mount)
{
- struct mount_entry const *le = nullptr;
+ struct mount_entry const *le = NULL;
for (struct mount_entry const *me = mount_list; me; me = me->me_next)
{
@@ -1253,7 +1253,7 @@ last_device_for_mount (char const *mount)
return xstrdup (le->me_devname);
}
else
- return nullptr;
+ return NULL;
}
/* If DEVICE corresponds to a mount point, show its usage
@@ -1261,7 +1261,7 @@ last_device_for_mount (char const *mount)
static bool
get_device (char const *device)
{
- struct mount_entry const *best_match = nullptr;
+ struct mount_entry const *best_match = NULL;
bool best_match_accessible = false;
bool eclipsed_device = false;
char const *file = device;
@@ -1319,9 +1319,9 @@ get_device (char const *device)
if (best_match)
{
- get_dev (best_match->me_devname, best_match->me_mountdir, file, nullptr,
+ get_dev (best_match->me_devname, best_match->me_mountdir, file, NULL,
best_match->me_type, best_match->me_dummy,
- best_match->me_remote, nullptr, false);
+ best_match->me_remote, NULL, false);
return true;
}
else if (eclipsed_device)
@@ -1342,7 +1342,7 @@ static void
get_point (char const *point, const struct stat *statp)
{
struct stat device_stats;
- struct mount_entry const *best_match = nullptr;
+ struct mount_entry const *best_match = NULL;
/* Calculate the real absolute file name for POINT, and use that to find
the mount point. This avoids statting unavailable mount points,
@@ -1374,7 +1374,7 @@ get_point (char const *point, const struct stat *statp)
if (best_match
&& (stat (best_match->me_mountdir, &device_stats) != 0
|| device_stats.st_dev != statp->st_dev))
- best_match = nullptr;
+ best_match = NULL;
if (! best_match)
for (struct mount_entry *me = mount_list; me; me = me->me_next)
@@ -1415,7 +1415,7 @@ get_point (char const *point, const struct stat *statp)
if (best_match)
get_dev (best_match->me_devname, best_match->me_mountdir, point, point,
best_match->me_type, best_match->me_dummy, best_match->me_remote,
- nullptr, false);
+ NULL, false);
else
{
/* We couldn't find the mount entry corresponding to POINT. Go ahead and
@@ -1426,8 +1426,8 @@ get_point (char const *point, const struct stat *statp)
char *mp = find_mount_point (point, statp);
if (mp)
{
- get_dev (nullptr, mp, point, nullptr, nullptr,
- false, false, nullptr, false);
+ get_dev (NULL, mp, point, NULL, NULL,
+ false, false, NULL, false);
free (mp);
}
}
@@ -1455,8 +1455,8 @@ get_all_entries (void)
filter_mount_list (show_all_fs);
for (struct mount_entry *me = mount_list; me; me = me->me_next)
- get_dev (me->me_devname, me->me_mountdir, nullptr, nullptr, me->me_type,
- me->me_dummy, me->me_remote, nullptr, true);
+ get_dev (me->me_devname, me->me_mountdir, NULL, NULL, me->me_type,
+ me->me_dummy, me->me_remote, NULL, true);
}
/* Add FSTYPE to the list of file system types to display. */
@@ -1554,7 +1554,7 @@ field names are: 'source', 'fstype', 'itotal', 'iused', 'iavail', 'ipcent',\n\
int
main (int argc, char **argv)
{
- struct stat *stats = nullptr;
+ struct stat *stats = NULL;
initialize_main (&argc, &argv);
set_program_name (argv[0]);
@@ -1564,8 +1564,8 @@ main (int argc, char **argv)
atexit (close_stdout);
- fs_select_list = nullptr;
- fs_exclude_list = nullptr;
+ fs_select_list = NULL;
+ fs_exclude_list = NULL;
show_all_fs = false;
show_listed_fs = false;
human_output_opts = -1;
@@ -1752,19 +1752,19 @@ main (int argc, char **argv)
{
error (0, err, "%s", quotef (argv[i]));
exit_status = EXIT_FAILURE;
- argv[i] = nullptr;
+ argv[i] = NULL;
}
}
}
mount_list =
- read_file_system_list ((fs_select_list != nullptr
- || fs_exclude_list != nullptr
+ read_file_system_list ((fs_select_list != NULL
+ || fs_exclude_list != NULL
|| print_type
|| field_data[FSTYPE_FIELD].used
|| show_local_fs));
- if (mount_list == nullptr)
+ if (mount_list == NULL)
{
/* Couldn't read the table of mounted file systems.
Fail if df was invoked with no file name arguments,
@@ -1774,8 +1774,8 @@ main (int argc, char **argv)
if ( ! (optind < argc)
|| (show_all_fs
|| show_local_fs
- || fs_select_list != nullptr
- || fs_exclude_list != nullptr))
+ || fs_select_list != NULL
+ || fs_exclude_list != NULL))
{
status = EXIT_FAILURE;
}
@@ -1807,7 +1807,7 @@ main (int argc, char **argv)
if (print_grand_total)
get_dev ("total",
(field_data[SOURCE_FIELD].used ? "-" : "total"),
- nullptr, nullptr, nullptr, false, false, &grand_fsu, false);
+ NULL, NULL, NULL, false, false, &grand_fsu, false);
print_table ();
}
diff --git a/src/dircolors.c b/src/dircolors.c
index a5704ce357..b601fadaf1 100644
--- a/src/dircolors.c
+++ b/src/dircolors.c
@@ -57,7 +57,7 @@ static char const *const slack_codes[] =
"CHR", "CHAR", "DOOR", "EXEC", "LEFT", "LEFTCODE", "RIGHT", "RIGHTCODE",
"END", "ENDCODE", "SUID", "SETUID", "SGID", "SETGID", "STICKY",
"OTHER_WRITABLE", "OWR", "STICKY_OTHER_WRITABLE", "OWT", "CAPABILITY",
- "MULTIHARDLINK", "CLRTOEOL", nullptr
+ "MULTIHARDLINK", "CLRTOEOL", NULL
};
static char const *const ls_codes[] =
@@ -65,7 +65,7 @@ static char const *const ls_codes[] =
"no", "no", "fi", "rs", "di", "ln", "ln", "ln", "or", "mi", "pi", "pi",
"so", "bd", "bd", "cd", "cd", "do", "ex", "lc", "lc", "rc", "rc", "ec", "ec",
"su", "su", "sg", "sg", "st", "ow", "ow", "tw", "tw", "ca", "mh", "cl",
- nullptr
+ NULL
};
static_assert (countof (slack_codes) == countof (ls_codes));
@@ -81,15 +81,15 @@ enum
static struct option const long_options[] =
{
- {"bourne-shell", no_argument, nullptr, 'b'},
- {"sh", no_argument, nullptr, 'b'},
- {"csh", no_argument, nullptr, 'c'},
- {"c-shell", no_argument, nullptr, 'c'},
- {"print-database", no_argument, nullptr, 'p'},
- {"print-ls-colors", no_argument, nullptr, PRINT_LS_COLORS_OPTION},
+ {"bourne-shell", no_argument, NULL, 'b'},
+ {"sh", no_argument, NULL, 'b'},
+ {"csh", no_argument, NULL, 'c'},
+ {"c-shell", no_argument, NULL, 'c'},
+ {"print-database", no_argument, NULL, 'p'},
+ {"print-ls-colors", no_argument, NULL, PRINT_LS_COLORS_OPTION},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
void
@@ -132,7 +132,7 @@ guess_shell_syntax (void)
char *shell;
shell = getenv ("SHELL");
- if (shell == nullptr || *shell == '\0')
+ if (shell == NULL || *shell == '\0')
return SHELL_SYNTAX_UNKNOWN;
shell = last_component (shell);
@@ -150,8 +150,8 @@ parse_line (char const *line, char **keyword, char **arg)
char const *keyword_start;
char const *arg_start;
- *keyword = nullptr;
- *arg = nullptr;
+ *keyword = NULL;
+ *arg = NULL;
for (p = line; c_isspace (*p); ++p)
continue;
@@ -267,7 +267,7 @@ dc_parse_stream (FILE *fp, char const *filename)
{
idx_t line_number = 0;
char const *next_G_line = G_line;
- char *input_line = nullptr;
+ char *input_line = NULL;
size_t input_line_size = 0;
char const *line;
char const *term;
@@ -279,12 +279,12 @@ dc_parse_stream (FILE *fp, char const *filename)
/* Get terminal type */
term = getenv ("TERM");
- if (term == nullptr || *term == '\0')
+ if (term == NULL || *term == '\0')
term = "none";
/* Also match $COLORTERM. */
colorterm = getenv ("COLORTERM");
- if (colorterm == nullptr)
+ if (colorterm == NULL)
colorterm = ""; /* Doesn't match default "?*" */
while (true)
@@ -318,10 +318,10 @@ dc_parse_stream (FILE *fp, char const *filename)
parse_line (line, &keywd, &arg);
- if (keywd == nullptr)
+ if (keywd == NULL)
continue;
- if (arg == nullptr)
+ if (arg == NULL)
{
error (0, 0, _("%s:%td: invalid line; missing second token"),
quotef (filename), line_number);
@@ -362,11 +362,11 @@ dc_parse_stream (FILE *fp, char const *filename)
{
int i;
- for (i = 0; slack_codes[i] != nullptr; ++i)
+ for (i = 0; slack_codes[i] != NULL; ++i)
if (c_strcasecmp (keywd, slack_codes[i]) == 0)
break;
- if (slack_codes[i] != nullptr)
+ if (slack_codes[i] != NULL)
append_entry (0, ls_codes[i], arg);
else
unrecognized = true;
@@ -396,7 +396,7 @@ dc_parse_file (char const *filename)
{
bool ok;
- if (! streq (filename, "-") && freopen (filename, "r", stdin) == nullptr)
+ if (! streq (filename, "-") && freopen (filename, "r", stdin) == NULL)
{
error (0, errno, "%s", quotef (filename));
return false;
@@ -429,7 +429,7 @@ main (int argc, char **argv)
atexit (close_stdout);
- while ((optc = getopt_long (argc, argv, "bcp", long_options, nullptr)) != -1)
+ while ((optc = getopt_long (argc, argv, "bcp", long_options, NULL)) != -1)
switch (optc)
{
case 'b': /* Bourne shell syntax. */
@@ -511,7 +511,7 @@ main (int argc, char **argv)
obstack_init (&lsc_obstack);
if (argc == 0)
- ok = dc_parse_stream (nullptr, nullptr);
+ ok = dc_parse_stream (NULL, NULL);
else
ok = dc_parse_file (argv[0]);
diff --git a/src/dirname.c b/src/dirname.c
index 5d1fb5c643..603ae820bd 100644
--- a/src/dirname.c
+++ b/src/dirname.c
@@ -33,10 +33,10 @@
static struct option const longopts[] =
{
- {"zero", no_argument, nullptr, 'z'},
+ {"zero", no_argument, NULL, 'z'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
void
@@ -88,7 +88,7 @@ main (int argc, char **argv)
while (true)
{
- int c = getopt_long (argc, argv, "z", longopts, nullptr);
+ int c = getopt_long (argc, argv, "z", longopts, NULL);
if (c == -1)
break;
diff --git a/src/du.c b/src/du.c
index a38c96174f..6a943682d3 100644
--- a/src/du.c
+++ b/src/du.c
@@ -170,10 +170,10 @@ enum time_type
static enum time_type time_type = time_mtime;
/* User specified date / time style */
-static char const *time_style = nullptr;
+static char const *time_style = NULL;
/* Format used to display date / time. Controlled by --time-style */
-static char const *time_format = nullptr;
+static char const *time_format = NULL;
/* The local time zone rules, as per the TZ environment variable. */
static timezone_t localtz;
@@ -208,40 +208,40 @@ enum
static struct option const long_options[] =
{
- {"all", no_argument, nullptr, 'a'},
- {"apparent-size", no_argument, nullptr, 'A'},
- {"block-size", required_argument, nullptr, 'B'},
- {"bytes", no_argument, nullptr, 'b'},
- {"count-links", no_argument, nullptr, 'l'},
+ {"all", no_argument, NULL, 'a'},
+ {"apparent-size", no_argument, NULL, 'A'},
+ {"block-size", required_argument, NULL, 'B'},
+ {"bytes", no_argument, NULL, 'b'},
+ {"count-links", no_argument, NULL, 'l'},
#if GNULIB_FTS_DEBUG
- {"-debug", no_argument, nullptr, FTS_DEBUG},
+ {"-debug", no_argument, NULL, FTS_DEBUG},
#endif
- {"dereference", no_argument, nullptr, 'L'},
- {"dereference-args", no_argument, nullptr, 'D'},
- {"exclude", required_argument, nullptr, EXCLUDE_OPTION},
- {"exclude-from", required_argument, nullptr, 'X'},
- {"files0-from", required_argument, nullptr, FILES0_FROM_OPTION},
- {"human-readable", no_argument, nullptr, 'h'},
- {"inodes", no_argument, nullptr, INODES_OPTION},
- {"si", no_argument, nullptr, HUMAN_SI_OPTION},
- {"max-depth", required_argument, nullptr, 'd'},
- {"null", no_argument, nullptr, '0'},
- {"no-dereference", no_argument, nullptr, 'P'},
- {"one-file-system", no_argument, nullptr, 'x'},
- {"separate-dirs", no_argument, nullptr, 'S'},
- {"summarize", no_argument, nullptr, 's'},
- {"total", no_argument, nullptr, 'c'},
- {"threshold", required_argument, nullptr, 't'},
- {"time", optional_argument, nullptr, TIME_OPTION},
- {"time-style", required_argument, nullptr, TIME_STYLE_OPTION},
+ {"dereference", no_argument, NULL, 'L'},
+ {"dereference-args", no_argument, NULL, 'D'},
+ {"exclude", required_argument, NULL, EXCLUDE_OPTION},
+ {"exclude-from", required_argument, NULL, 'X'},
+ {"files0-from", required_argument, NULL, FILES0_FROM_OPTION},
+ {"human-readable", no_argument, NULL, 'h'},
+ {"inodes", no_argument, NULL, INODES_OPTION},
+ {"si", no_argument, NULL, HUMAN_SI_OPTION},
+ {"max-depth", required_argument, NULL, 'd'},
+ {"null", no_argument, NULL, '0'},
+ {"no-dereference", no_argument, NULL, 'P'},
+ {"one-file-system", no_argument, NULL, 'x'},
+ {"separate-dirs", no_argument, NULL, 'S'},
+ {"summarize", no_argument, NULL, 's'},
+ {"total", no_argument, NULL, 'c'},
+ {"threshold", required_argument, NULL, 't'},
+ {"time", optional_argument, NULL, TIME_OPTION},
+ {"time-style", required_argument, NULL, TIME_STYLE_OPTION},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
static char const *const time_args[] =
{
- "atime", "access", "use", "ctime", "status", nullptr
+ "atime", "access", "use", "ctime", "status", NULL
};
static enum time_type const time_types[] =
{
@@ -261,7 +261,7 @@ enum time_style
static char const *const time_style_args[] =
{
- "full-iso", "long-iso", "iso", nullptr
+ "full-iso", "long-iso", "iso", NULL
};
static enum time_style const time_style_types[] =
{
@@ -668,14 +668,14 @@ du_files (char **files, int bit_flags)
if (*files)
{
- FTS *fts = xfts_open (files, bit_flags, nullptr);
+ FTS *fts = xfts_open (files, bit_flags, NULL);
while (true)
{
FTSENT *ent;
ent = fts_read (fts);
- if (ent == nullptr)
+ if (ent == NULL)
{
if (errno != 0)
{
@@ -715,7 +715,7 @@ main (int argc, char **argv)
char *cwd_only[2];
bool max_depth_specified = false;
bool ok = true;
- char *files_from = nullptr;
+ char *files_from = NULL;
/* Bit flags that control how fts works. */
int bit_flags = FTS_NOSTAT;
@@ -728,7 +728,7 @@ main (int argc, char **argv)
bool opt_summarize_only = false;
cwd_only[0] = bad_cast (".");
- cwd_only[1] = nullptr;
+ cwd_only[1] = NULL;
initialize_main (&argc, &argv);
set_program_name (argv[0]);
@@ -799,7 +799,7 @@ main (int argc, char **argv)
case 'd': /* --max-depth=N */
{
intmax_t tmp;
- if (xstrtoimax (optarg, nullptr, 0, &tmp, "") == LONGINT_OK
+ if (xstrtoimax (optarg, NULL, 0, &tmp, "") == LONGINT_OK
&& tmp <= IDX_MAX)
{
max_depth_specified = true;
@@ -830,7 +830,7 @@ main (int argc, char **argv)
case 't':
{
enum strtol_error e;
- e = xstrtoimax (optarg, nullptr, 0, &opt_threshold,
+ e = xstrtoimax (optarg, NULL, 0, &opt_threshold,
"kKmMGTPEZYRQ0");
if (e != LONGINT_OK)
xstrtol_fatal (e, oi, c, long_options, optarg);
@@ -1050,7 +1050,7 @@ main (int argc, char **argv)
bit_flags |= FTS_TIGHT_CYCLE_CHECK;
bit_flags |= symlink_deref_bits;
- static char *temp_argv[] = { nullptr, nullptr };
+ static char *temp_argv[] = { NULL, NULL };
while (true)
{
@@ -1094,7 +1094,7 @@ main (int argc, char **argv)
among many, knowing the record number may help.
FIXME: currently print the record number only with
--files0-from=FILE. Maybe do it for argv, too? */
- if (files_from == nullptr)
+ if (files_from == NULL)
error (0, 0, "%s", _("invalid zero-length file name"));
else
{
diff --git a/src/echo.c b/src/echo.c
index 52f11ef7b4..beabf589a3 100644
--- a/src/echo.c
+++ b/src/echo.c
@@ -141,7 +141,7 @@ main (int argc, char **argv)
if (streq (argv[1], "--version"))
{
version_etc (stdout, PROGRAM_NAME, PACKAGE_NAME, Version, AUTHORS,
- (char *) nullptr);
+ (char *) NULL);
return EXIT_SUCCESS;
}
}
diff --git a/src/env.c b/src/env.c
index 3999225998..070d9f1119 100644
--- a/src/env.c
+++ b/src/env.c
@@ -87,20 +87,20 @@ enum
static struct option const longopts[] =
{
- {"argv0", required_argument, nullptr, 'a'},
- {"ignore-environment", no_argument, nullptr, 'i'},
- {"null", no_argument, nullptr, '0'},
- {"unset", required_argument, nullptr, 'u'},
- {"chdir", required_argument, nullptr, 'C'},
- {"default-signal", optional_argument, nullptr, DEFAULT_SIGNAL_OPTION},
- {"ignore-signal", optional_argument, nullptr, IGNORE_SIGNAL_OPTION},
- {"block-signal", optional_argument, nullptr, BLOCK_SIGNAL_OPTION},
- {"list-signal-handling", no_argument, nullptr, LIST_SIGNAL_HANDLING_OPTION},
- {"debug", no_argument, nullptr, 'v'},
- {"split-string", required_argument, nullptr, 'S'},
+ {"argv0", required_argument, NULL, 'a'},
+ {"ignore-environment", no_argument, NULL, 'i'},
+ {"null", no_argument, NULL, '0'},
+ {"unset", required_argument, NULL, 'u'},
+ {"chdir", required_argument, NULL, 'C'},
+ {"default-signal", optional_argument, NULL, DEFAULT_SIGNAL_OPTION},
+ {"ignore-signal", optional_argument, NULL, IGNORE_SIGNAL_OPTION},
+ {"block-signal", optional_argument, NULL, BLOCK_SIGNAL_OPTION},
+ {"list-signal-handling", no_argument, NULL, LIST_SIGNAL_HANDLING_OPTION},
+ {"debug", no_argument, NULL, 'v'},
+ {"split-string", required_argument, NULL, 'S'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
void
@@ -189,7 +189,7 @@ unset_envvars (void)
}
}
-/* Return a pointer to the end of a valid ${VARNAME} string, or nullptr.
+/* Return a pointer to the end of a valid ${VARNAME} string, or NULL.
'str' should point to the '$' character.
First letter in VARNAME must be alpha or underscore,
rest of letters are alnum or underscore.
@@ -207,21 +207,21 @@ scan_varname (char const *str)
return end;
}
- return nullptr;
+ return NULL;
}
/* Return a pointer to a static buffer containing the VARNAME as
extracted from a '${VARNAME}' string.
The returned string will be NUL terminated.
The returned pointer should not be freed.
- Return nullptr if not a valid ${VARNAME} syntax. */
+ Return NULL if not a valid ${VARNAME} syntax. */
static char *
extract_varname (char const *str)
{
char const *p = scan_varname (str);
if (!p)
- return nullptr;
+ return NULL;
/* -2 and +2 (below) account for the '${' prefix. */
idx_t i = p - str - 2;
@@ -229,7 +229,7 @@ extract_varname (char const *str)
if (i >= vnlen)
{
free (varname);
- varname = xpalloc (nullptr, &vnlen, i + 1 - vnlen, -1, sizeof *varname);
+ varname = xpalloc (NULL, &vnlen, i + 1 - vnlen, -1, sizeof *varname);
}
memcpy (varname, str + 2, i);
@@ -497,7 +497,7 @@ build_argv (char const *str, int extra_argc, int *argc)
argv[1] = "-S-i -C/tmp A=B"
argv[2] = "foo"
argv[3] = "bar"
- argv[4] = nullptr
+ argv[4] = NULL
This function will modify argv to be:
argv[0] = "env"
argv[1] = "-i"
@@ -505,7 +505,7 @@ build_argv (char const *str, int extra_argc, int *argc)
argv[3] = "A=B"
argv[4] = "foo"
argv[5] = "bar"
- argv[6] = nullptr
+ argv[6] = NULL
argc will be updated from 4 to 6.
optind will be reset to 0 to force getopt_long to rescan all arguments. */
static void
@@ -565,7 +565,7 @@ parse_signal_action_params (char const *arg, bool set_default)
signals[signum] = set_default ? DEFAULT : IGNORE;
- opt_sig = strtok (nullptr, ",");
+ opt_sig = strtok (NULL, ",");
}
free (optarg_writable);
@@ -587,7 +587,7 @@ reset_signal_handlers (void)
bool set_to_default = (signals[i] == DEFAULT
|| signals[i] == DEFAULT_NOERR);
- int sig_err = sigaction (i, nullptr, &act);
+ int sig_err = sigaction (i, NULL, &act);
if (sig_err && !ignore_errors)
error (EXIT_CANCELED, errno,
@@ -596,7 +596,7 @@ reset_signal_handlers (void)
if (! sig_err)
{
act.sa_handler = set_to_default ? SIG_DFL : SIG_IGN;
- sig_err = sigaction (i, &act, nullptr);
+ sig_err = sigaction (i, &act, NULL);
if (sig_err && !ignore_errors)
error (EXIT_CANCELED, errno,
_("failed to set signal action for signal %d"), i);
@@ -659,7 +659,7 @@ parse_block_signal_params (char const *arg, bool block)
else
sigdelset (block ? &unblock_signals : &block_signals, signum);
- opt_sig = strtok (nullptr, ",");
+ opt_sig = strtok (NULL, ",");
}
free (optarg_writable);
@@ -673,12 +673,12 @@ set_signal_proc_mask (void)
sigemptyset (&set);
- if (sigprocmask (0, nullptr, &set))
+ if (sigprocmask (0, NULL, &set))
error (EXIT_CANCELED, errno, _("failed to get signal process mask"));
for (int i = 1; i <= SIGNUM_BOUND; i++)
{
- char const *debug_act = nullptr;
+ char const *debug_act = NULL;
if (sigismember (&block_signals, i))
{
@@ -701,7 +701,7 @@ set_signal_proc_mask (void)
}
}
- if (sigprocmask (SIG_SETMASK, &set, nullptr))
+ if (sigprocmask (SIG_SETMASK, &set, NULL))
error (EXIT_CANCELED, errno, _("failed to set signal process mask"));
}
@@ -711,13 +711,13 @@ list_signal_handling (void)
sigset_t set;
sigemptyset (&set);
- if (sigprocmask (0, nullptr, &set))
+ if (sigprocmask (0, NULL, &set))
error (EXIT_CANCELED, errno, _("failed to get signal process mask"));
for (int i = 1; i <= SIGNUM_BOUND; i++)
{
struct sigaction act;
- if (sigaction (i, nullptr, &act))
+ if (sigaction (i, NULL, &act))
continue;
char const *ignored = act.sa_handler == SIG_IGN ? "IGNORE" : "";
@@ -751,8 +751,8 @@ main (int argc, char **argv)
{
bool ignore_environment = false;
bool opt_nul_terminate_output = false;
- char const *newdir = nullptr;
- char *argv0 = nullptr;
+ char const *newdir = NULL;
+ char *argv0 = NULL;
initialize_main (&argc, &argv);
set_program_name (argv[0]);
@@ -766,7 +766,7 @@ main (int argc, char **argv)
initialize_signals ();
int optc;
- while ((optc = getopt_long (argc, argv, shortopts, longopts, nullptr)) != -1)
+ while ((optc = getopt_long (argc, argv, shortopts, longopts, NULL)) != -1)
{
switch (optc)
{
@@ -829,7 +829,7 @@ main (int argc, char **argv)
if (ignore_environment)
{
devmsg ("cleaning environ\n");
- static char *dummy_environ[] = { nullptr };
+ static char *dummy_environ[] = { NULL };
environ = dummy_environ;
}
else
diff --git a/src/expand-common.c b/src/expand-common.c
index b029b8670b..afe613dc6b 100644
--- a/src/expand-common.c
+++ b/src/expand-common.c
@@ -45,7 +45,7 @@ idx_t max_column_width;
/* Array of the explicit column numbers of the tab stops;
after 'tab_list' is exhausted, each additional tab is replaced
by a space. The first column is column 0. */
-static colno *tab_list = nullptr;
+static colno *tab_list = NULL;
/* The number of allocated entries in 'tab_list'. */
static idx_t n_tabs_allocated = 0;
@@ -55,12 +55,12 @@ static idx_t n_tabs_allocated = 0;
static idx_t first_free_tab = 0;
/* Null-terminated array of input filenames. */
-static char **file_list = nullptr;
+static char **file_list = NULL;
/* Default for 'file_list' if no files are given on the command line. */
static char *stdin_argv[] =
{
- (char *) "-", nullptr
+ (char *) "-", NULL
};
/* True if we have ever read standard input. */
@@ -141,7 +141,7 @@ parse_tab_stops (char const *stops)
colno tabval = 0;
bool extend_tabval = false;
bool increment_tabval = false;
- char const *num_start = nullptr;
+ char const *num_start = NULL;
bool ok = true;
for (; *stops; stops++)
@@ -344,7 +344,7 @@ set_file_list (char **list)
/* Close the old stream pointer FP if it is non-null,
and return a new one opened to read the next input file.
Open a filename of '-' as the standard input.
- Return nullptr if there are no more input files. */
+ Return NULL if there are no more input files. */
extern FILE *
next_file (FILE *fp)
@@ -368,7 +368,7 @@ next_file (FILE *fp)
}
}
- while ((file = *file_list++) != nullptr)
+ while ((file = *file_list++) != NULL)
{
if (streq (file, "-"))
{
@@ -386,7 +386,7 @@ next_file (FILE *fp)
error (0, errno, "%s", quotef (file));
exit_status = EXIT_FAILURE;
}
- return nullptr;
+ return NULL;
}
/* Close standard input if we have read from it. */
diff --git a/src/expand-common.h b/src/expand-common.h
index fa73ad15ac..af8fd5182f 100644
--- a/src/expand-common.h
+++ b/src/expand-common.h
@@ -62,7 +62,7 @@ set_file_list (char **file_list);
/* Close the old stream pointer FP if it is non-null,
and return a new one opened to read the next input file.
Open a filename of '-' as the standard input.
- Return nullptr if there are no more input files. */
+ Return NULL if there are no more input files. */
extern FILE *
next_file (FILE *fp);
diff --git a/src/expand.c b/src/expand.c
index cbb05369af..8539da3e47 100644
--- a/src/expand.c
+++ b/src/expand.c
@@ -50,11 +50,11 @@ static char const shortopts[] = "it:0::1::2::3::4::5::6::7::8::9::";
static struct option const longopts[] =
{
- {"tabs", required_argument, nullptr, 't'},
- {"initial", no_argument, nullptr, 'i'},
+ {"tabs", required_argument, NULL, 't'},
+ {"initial", no_argument, NULL, 'i'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
void
@@ -95,7 +95,7 @@ static void
expand (void)
{
/* Input stream. */
- FILE *fp = next_file (nullptr);
+ FILE *fp = next_file (NULL);
if (!fp)
return;
@@ -181,7 +181,7 @@ main (int argc, char **argv)
atexit (close_stdout);
convert_entire_line = true;
- while ((c = getopt_long (argc, argv, shortopts, longopts, nullptr)) != -1)
+ while ((c = getopt_long (argc, argv, shortopts, longopts, NULL)) != -1)
{
switch (c)
{
@@ -217,7 +217,7 @@ main (int argc, char **argv)
finalize_tab_stops ();
- set_file_list (optind < argc ? &argv[optind] : nullptr);
+ set_file_list (optind < argc ? &argv[optind] : NULL);
expand ();
diff --git a/src/expr.c b/src/expr.c
index f2b26fcc9e..b6e8230587 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -318,7 +318,7 @@ main (int argc, char **argv)
atexit (close_stdout);
parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, VERSION,
- usage, AUTHORS, (char const *) nullptr);
+ usage, AUTHORS, (char const *) NULL);
/* The above handles --help and --version.
Since there is no other invocation of getopt, handle '--' here. */
@@ -456,7 +456,7 @@ tostring (VALUE *v)
{
case integer:
{
- char *s = mpz_get_str (nullptr, 10, v->u.i);
+ char *s = mpz_get_str (NULL, 10, v->u.i);
mpz_clear (v->u.i);
v->u.s = s;
v->type = string;
@@ -518,7 +518,7 @@ getsize (mpz_t i)
static bool
nextarg (char const *str)
{
- if (*args == nullptr)
+ if (*args == NULL)
return false;
else
{
@@ -581,13 +581,13 @@ docolon (VALUE *sv, VALUE *pv)
tostring (pv);
re_regs.num_regs = 0;
- re_regs.start = nullptr;
- re_regs.end = nullptr;
+ re_regs.start = NULL;
+ re_regs.end = NULL;
- re_buffer.buffer = nullptr;
+ re_buffer.buffer = NULL;
re_buffer.allocated = 0;
re_buffer.fastmap = fastmap;
- re_buffer.translate = nullptr;
+ re_buffer.translate = NULL;
re_syntax_options =
RE_SYNTAX_POSIX_BASIC & ~RE_CONTEXT_INVALID_DUP & ~RE_NO_EMPTY_RANGES;
errmsg = re_compile_pattern (pv->u.s, strlen (pv->u.s), &re_buffer);
@@ -637,7 +637,7 @@ docolon (VALUE *sv, VALUE *pv)
free (re_regs.start);
free (re_regs.end);
}
- re_buffer.fastmap = nullptr;
+ re_buffer.fastmap = NULL;
regfree (&re_buffer);
return v;
}
diff --git a/src/factor.c b/src/factor.c
index f21e37495d..13dba11bdb 100644
--- a/src/factor.c
+++ b/src/factor.c
@@ -199,11 +199,11 @@ enum
static struct option const long_options[] =
{
- {"exponents", no_argument, nullptr, 'h'},
- {"-debug", no_argument, nullptr, DEV_DEBUG_OPTION},
+ {"exponents", no_argument, NULL, 'h'},
+ {"-debug", no_argument, NULL, DEV_DEBUG_OPTION},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
/* If true, use p^e output format. */
@@ -645,11 +645,11 @@ mpn_tdiv_qr (mp_limb_t *qp, mp_limb_t *rp, MAYBE_UNUSED mp_size_t qxn,
mp_limb_t const *dp, mp_size_t dn)
{
mpz_t q, r, n, d;
- mpz_inits (q, r, nullptr);
+ mpz_inits (q, r, NULL);
mpz_tdiv_qr (q, r, mpz_roinit_n (n, np, nn), mpz_roinit_n (d, dp, dn));
copy_mpn_from_mpz (qp, nn - dn + 1, q);
copy_mpn_from_mpz (rp, dn, r);
- mpz_clears (q, r, nullptr);
+ mpz_clears (q, r, NULL);
}
#endif
@@ -2002,7 +2002,7 @@ main (int argc, char **argv)
atexit (close_stdout);
int c;
- while ((c = getopt_long (argc, argv, "h", long_options, nullptr)) != -1)
+ while ((c = getopt_long (argc, argv, "h", long_options, NULL)) != -1)
{
switch (c)
{
diff --git a/src/find-mount-point.c b/src/find-mount-point.c
index 304b93045b..6624f7f75f 100644
--- a/src/find-mount-point.c
+++ b/src/find-mount-point.c
@@ -24,19 +24,19 @@
/* Return the root mountpoint of the file system on which FILE exists, in
malloced storage. FILE_STAT should be the result of stating FILE.
- Give a diagnostic and return nullptr if unable to determine the mount point.
+ Give a diagnostic and return NULL if unable to determine the mount point.
Exit if unable to restore current working directory. */
extern char *
find_mount_point (char const *file, struct stat const *file_stat)
{
struct saved_cwd cwd;
struct stat last_stat;
- char *mp = nullptr; /* The malloc'd mount point. */
+ char *mp = NULL; /* The malloc'd mount point. */
if (save_cwd (&cwd) != 0)
{
error (0, errno, _("cannot get current directory"));
- return nullptr;
+ return NULL;
}
if (S_ISDIR (file_stat->st_mode))
@@ -46,7 +46,7 @@ find_mount_point (char const *file, struct stat const *file_stat)
if (chdir (file) < 0)
{
error (0, errno, _("cannot change to directory %s"), quoteaf (file));
- return nullptr;
+ return NULL;
}
}
else
@@ -60,7 +60,7 @@ find_mount_point (char const *file, struct stat const *file_stat)
if (chdir (dir) < 0)
{
error (0, errno, _("cannot change to directory %s"), quoteaf (dir));
- return nullptr;
+ return NULL;
}
if (stat (".", &last_stat) < 0)
diff --git a/src/fmt.c b/src/fmt.c
index 8928a32b46..72b4d0adf2 100644
--- a/src/fmt.c
+++ b/src/fmt.c
@@ -116,9 +116,9 @@ typedef long int COST;
/* Extra ctype(3)-style macros. */
-#define isopen(c) (strchr ("(['`\"", c) != nullptr)
-#define isclose(c) (strchr (")]'\"", c) != nullptr)
-#define isperiod(c) (strchr (".?!", c) != nullptr)
+#define isopen(c) (strchr ("(['`\"", c) != NULL)
+#define isclose(c) (strchr (")]'\"", c) != NULL)
+#define isperiod(c) (strchr (".?!", c) != NULL)
/* Size of a tab stop, for expansion on input and re-introduction on
output. */
@@ -301,16 +301,16 @@ The option -WIDTH is an abbreviated form of --width=DIGITS.\n\
static struct option const long_options[] =
{
- {"crown-margin", no_argument, nullptr, 'c'},
- {"prefix", required_argument, nullptr, 'p'},
- {"split-only", no_argument, nullptr, 's'},
- {"tagged-paragraph", no_argument, nullptr, 't'},
- {"uniform-spacing", no_argument, nullptr, 'u'},
- {"width", required_argument, nullptr, 'w'},
- {"goal", required_argument, nullptr, 'g'},
+ {"crown-margin", no_argument, NULL, 'c'},
+ {"prefix", required_argument, NULL, 'p'},
+ {"split-only", no_argument, NULL, 's'},
+ {"tagged-paragraph", no_argument, NULL, 't'},
+ {"uniform-spacing", no_argument, NULL, 'u'},
+ {"width", required_argument, NULL, 'w'},
+ {"goal", required_argument, NULL, 'g'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0},
+ {NULL, 0, NULL, 0},
};
int
@@ -318,8 +318,8 @@ main (int argc, char **argv)
{
int optchar;
bool ok = true;
- char const *max_width_option = nullptr;
- char const *goal_width_option = nullptr;
+ char const *max_width_option = NULL;
+ char const *goal_width_option = NULL;
initialize_main (&argc, &argv);
set_program_name (argv[0]);
@@ -346,7 +346,7 @@ main (int argc, char **argv)
}
while ((optchar = getopt_long (argc, argv, "0123456789cstuw:p:g:",
- long_options, nullptr))
+ long_options, NULL))
!= -1)
switch (optchar)
{
@@ -404,7 +404,7 @@ main (int argc, char **argv)
/* Limit goal_width to max_width. */
goal_width = xdectoumax (goal_width_option, 0, max_width, "",
_("invalid width"), 0);
- if (max_width_option == nullptr)
+ if (max_width_option == NULL)
max_width = goal_width + 10;
}
else
@@ -433,7 +433,7 @@ main (int argc, char **argv)
{
FILE *in_stream;
in_stream = fopen (file, "r");
- if (in_stream != nullptr)
+ if (in_stream != NULL)
ok &= fmt (in_stream, file);
else
{
diff --git a/src/fold.c b/src/fold.c
index 21b6e92b07..09a7f144ae 100644
--- a/src/fold.c
+++ b/src/fold.c
@@ -58,13 +58,13 @@ static char const shortopts[] = "bcsw:0::1::2::3::4::5::6::7::8::9::";
static struct option const longopts[] =
{
- {"bytes", no_argument, nullptr, 'b'},
- {"characters", no_argument, nullptr, 'c'},
- {"spaces", no_argument, nullptr, 's'},
- {"width", required_argument, nullptr, 'w'},
+ {"bytes", no_argument, NULL, 'b'},
+ {"characters", no_argument, NULL, 'c'},
+ {"spaces", no_argument, NULL, 's'},
+ {"width", required_argument, NULL, 'w'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
void
@@ -165,7 +165,7 @@ fold_file (char const *filename, size_t width)
else
istream = fopen (filename, "r");
- if (istream == nullptr)
+ if (istream == NULL)
{
error (0, errno, "%s", quotef (filename));
return false;
@@ -293,7 +293,7 @@ main (int argc, char **argv)
break_spaces = have_read_stdin = false;
- while ((optc = getopt_long (argc, argv, shortopts, longopts, nullptr)) != -1)
+ while ((optc = getopt_long (argc, argv, shortopts, longopts, NULL)) != -1)
{
char optargbuf[2];
diff --git a/src/force-link.c b/src/force-link.c
index 5a55686d96..af2d485be8 100644
--- a/src/force-link.c
+++ b/src/force-link.c
@@ -44,7 +44,7 @@ enum { x_suffix_len = sizeof "XXXXXX" - 1 };
enum { smallsize = 256 };
/* Return a template for a file in the same directory as DSTNAME.
- Use BUF if the template fits, otherwise use malloc and return nullptr
+ Use BUF if the template fits, otherwise use malloc and return NULL
(setting errno) if unsuccessful. */
static char *
diff --git a/src/getlimits.c b/src/getlimits.c
index 97618fc632..6113988a25 100644
--- a/src/getlimits.c
+++ b/src/getlimits.c
@@ -145,7 +145,7 @@ main (int argc, char **argv)
parse_gnu_standard_options_only (argc, argv, PROGRAM_NAME, PACKAGE_NAME,
VERSION, true, usage, AUTHORS,
- (char const *) nullptr);
+ (char const *) NULL);
#define print_int(TYPE) \
sprintf (limit + 1, "%ju", (uintmax_t) TYPE##_MAX); \
diff --git a/src/group-list.c b/src/group-list.c
index 55c45660bd..4222f394d0 100644
--- a/src/group-list.c
+++ b/src/group-list.c
@@ -37,12 +37,12 @@ print_group_list (char const *username,
bool use_names, char delim)
{
bool ok = true;
- struct passwd *pwd = nullptr;
+ struct passwd *pwd = NULL;
if (username)
{
pwd = getpwuid (ruid);
- if (pwd == nullptr)
+ if (pwd == NULL)
ok = false;
}
@@ -90,13 +90,13 @@ print_group_list (char const *username,
extern bool
print_group (gid_t gid, bool use_name)
{
- struct group *grp = nullptr;
+ struct group *grp = NULL;
bool ok = true;
if (use_name)
{
grp = getgrgid (gid);
- if (grp == nullptr)
+ if (grp == NULL)
{
if (TYPE_SIGNED (gid_t))
{
diff --git a/src/groups.c b/src/groups.c
index 744729d5f7..a45dcbf435 100644
--- a/src/groups.c
+++ b/src/groups.c
@@ -40,7 +40,7 @@ static struct option const longopts[] =
{
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
void
@@ -77,7 +77,7 @@ main (int argc, char **argv)
/* Processing the arguments this way makes groups.c behave differently to
groups.sh if one of the arguments is "--". */
int optc;
- while ((optc = getopt_long (argc, argv, "", longopts, nullptr)) != -1)
+ while ((optc = getopt_long (argc, argv, "", longopts, NULL)) != -1)
{
switch (optc)
{
@@ -110,7 +110,7 @@ main (int argc, char **argv)
if (rgid == NO_GID && errno)
error (EXIT_FAILURE, errno, _("cannot get real GID"));
- if (!print_group_list (nullptr, ruid, rgid, egid, true, ' '))
+ if (!print_group_list (NULL, ruid, rgid, egid, true, ' '))
ok = false;
putchar ('\n');
}
@@ -120,7 +120,7 @@ main (int argc, char **argv)
for ( ; optind < argc; optind++)
{
struct passwd *pwd = getpwnam (argv[optind]);
- if (pwd == nullptr)
+ if (pwd == NULL)
{
error (0, 0, _("%s: no such user"), quote (argv[optind]));
ok = false;
diff --git a/src/head.c b/src/head.c
index c1e84d2329..4bc6110880 100644
--- a/src/head.c
+++ b/src/head.c
@@ -85,17 +85,17 @@ enum
static struct option const long_options[] =
{
- {"bytes", required_argument, nullptr, 'c'},
- {"lines", required_argument, nullptr, 'n'},
- {"-presume-input-pipe", no_argument, nullptr,
+ {"bytes", required_argument, NULL, 'c'},
+ {"lines", required_argument, NULL, 'n'},
+ {"-presume-input-pipe", no_argument, NULL,
PRESUME_INPUT_PIPE_OPTION}, /* do not document */
- {"quiet", no_argument, nullptr, 'q'},
- {"silent", no_argument, nullptr, 'q'},
- {"verbose", no_argument, nullptr, 'v'},
- {"zero-terminated", no_argument, nullptr, 'z'},
+ {"quiet", no_argument, NULL, 'q'},
+ {"silent", no_argument, NULL, 'q'},
+ {"verbose", no_argument, NULL, 'v'},
+ {"zero-terminated", no_argument, NULL, 'z'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
void
@@ -356,7 +356,7 @@ elide_tail_bytes_pipe (char const *filename, int fd, uintmax_t n_elide,
bool eof = false;
idx_t n_read;
- char **b = nullptr;
+ char **b = NULL;
idx_t remainder = n_elide % READ_BUFSIZE;
/* The number of buffers needed to hold n_elide bytes plus one
@@ -510,7 +510,7 @@ elide_tail_lines_pipe (char const *filename, int fd, uintmax_t n_elide,
first = last = xmalloc (sizeof (LBUFFER));
first->nbytes = first->nlines = 0;
- first->next = nullptr;
+ first->next = NULL;
tmp = xmalloc (sizeof (LBUFFER));
/* Always read into a fresh buffer.
@@ -531,7 +531,7 @@ elide_tail_lines_pipe (char const *filename, int fd, uintmax_t n_elide,
tmp->nbytes = n_read;
tmp->nlines = 0;
- tmp->next = nullptr;
+ tmp->next = NULL;
/* Count the number of newlines just read. */
{
@@ -686,7 +686,7 @@ elide_tail_lines_seekable (char const *pretty_filename, int fd,
{
char const *nl;
nl = memrchr (buffer, line_end, n);
- if (nl == nullptr)
+ if (nl == NULL)
break;
n = nl - buffer;
}
@@ -925,7 +925,7 @@ main (int argc, char **argv)
/* Initializer for file_list if no file-arguments
were specified on the command line. */
- static char const *const default_file_list[] = {"-", nullptr};
+ static char const *const default_file_list[] = {"-", NULL};
char const *const *file_list;
initialize_main (&argc, &argv);
@@ -1011,7 +1011,7 @@ main (int argc, char **argv)
}
while ((c = getopt_long (argc, argv, "c:n:qvz0123456789",
- long_options, nullptr))
+ long_options, NULL))
!= -1)
{
switch (c)
diff --git a/src/hostid.c b/src/hostid.c
index 6af091e540..f282e3cebe 100644
--- a/src/hostid.c
+++ b/src/hostid.c
@@ -62,7 +62,7 @@ main (int argc, char **argv)
parse_gnu_standard_options_only (argc, argv, PROGRAM_NAME, PACKAGE_NAME,
Version, true, usage, AUTHORS,
- (char const *) nullptr);
+ (char const *) NULL);
if (optind < argc)
{
diff --git a/src/hostname.c b/src/hostname.c
index 792bb9a889..4d6b094db0 100644
--- a/src/hostname.c
+++ b/src/hostname.c
@@ -84,7 +84,7 @@ main (int argc, char **argv)
parse_gnu_standard_options_only (argc, argv, PROGRAM_NAME, PACKAGE_NAME,
Version, true, usage, AUTHORS,
- (char const *) nullptr);
+ (char const *) NULL);
if (optind + 1 < argc)
{
@@ -103,7 +103,7 @@ main (int argc, char **argv)
else
{
hostname = xgethostname ();
- if (hostname == nullptr)
+ if (hostname == NULL)
error (EXIT_FAILURE, errno, _("cannot determine hostname"));
puts (hostname);
}
diff --git a/src/id.c b/src/id.c
index d2b3049bec..63a0d9e51d 100644
--- a/src/id.c
+++ b/src/id.c
@@ -64,7 +64,7 @@ static gid_t rgid, egid;
/* The SELinux context. Start with a known invalid value so print_full_info
knows when 'context' has not been set to a meaningful value. */
-static char *context = nullptr;
+static char *context = NULL;
static void print_user (uid_t uid);
static void print_full_info (char const *username);
@@ -72,16 +72,16 @@ static void print_stuff (char const *pw_name);
static struct option const longopts[] =
{
- {"context", no_argument, nullptr, 'Z'},
- {"group", no_argument, nullptr, 'g'},
- {"groups", no_argument, nullptr, 'G'},
- {"name", no_argument, nullptr, 'n'},
- {"real", no_argument, nullptr, 'r'},
- {"user", no_argument, nullptr, 'u'},
- {"zero", no_argument, nullptr, 'z'},
+ {"context", no_argument, NULL, 'Z'},
+ {"group", no_argument, NULL, 'g'},
+ {"groups", no_argument, NULL, 'G'},
+ {"name", no_argument, NULL, 'n'},
+ {"real", no_argument, NULL, 'r'},
+ {"user", no_argument, NULL, 'u'},
+ {"zero", no_argument, NULL, 'z'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
void
@@ -134,7 +134,7 @@ main (int argc, char **argv)
atexit (close_stdout);
- while ((optc = getopt_long (argc, argv, "agnruzGZ", longopts, nullptr)) != -1)
+ while ((optc = getopt_long (argc, argv, "agnruzGZ", longopts, NULL)) != -1)
{
switch (optc)
{
@@ -232,18 +232,18 @@ main (int argc, char **argv)
/* For each username/userid to get its pw_name field */
for (; optind < n_ids; optind++)
{
- char *pw_name = nullptr;
- struct passwd *pwd = nullptr;
+ char *pw_name = NULL;
+ struct passwd *pwd = NULL;
char const *spec = argv[optind];
/* Disallow an empty spec here as parse_user_spec() doesn't
give an error for that as it seems it's a valid way to
specify a noop or "reset special bits" depending on the system. */
if (*spec)
{
- if (! parse_user_spec (spec, &euid, nullptr, &pw_name, nullptr))
+ if (! parse_user_spec (spec, &euid, NULL, &pw_name, NULL))
pwd = pw_name ? getpwnam (pw_name) : getpwuid (euid);
}
- if (pwd == nullptr)
+ if (pwd == NULL)
{
error (0, errno, _("%s: no such user"), quote (spec));
ok &= false;
@@ -297,7 +297,7 @@ main (int argc, char **argv)
if (rgid == NO_GID && errno)
error (EXIT_FAILURE, errno, _("cannot get real GID"));
}
- print_stuff (nullptr);
+ print_stuff (NULL);
}
return ok ? EXIT_SUCCESS : EXIT_FAILURE;
@@ -308,12 +308,12 @@ main (int argc, char **argv)
static void
print_user (uid_t uid)
{
- struct passwd *pwd = nullptr;
+ struct passwd *pwd = NULL;
if (use_name)
{
pwd = getpwuid (uid);
- if (pwd == nullptr)
+ if (pwd == NULL)
{
error (0, 0, _("cannot find name for user ID %ju"), (uintmax_t) uid);
ok &= false;
diff --git a/src/install.c b/src/install.c
index 707576a6cd..498d79f617 100644
--- a/src/install.c
+++ b/src/install.c
@@ -61,14 +61,14 @@ static bool use_default_selinux_context = true;
# define endpwent() ((void) 0)
#endif
-/* The user name that will own the files, or nullptr to make the owner
+/* The user name that will own the files, or NULL to make the owner
the current user ID. */
static char *owner_name;
/* The user ID corresponding to 'owner_name'. */
static uid_t owner_id;
-/* The group name that will own the files, or nullptr to make the group
+/* The group name that will own the files, or NULL to make the group
the current group ID. */
static char *group_name;
@@ -113,25 +113,25 @@ enum
static struct option const long_options[] =
{
- {"backup", optional_argument, nullptr, 'b'},
- {"compare", no_argument, nullptr, 'C'},
+ {"backup", optional_argument, NULL, 'b'},
+ {"compare", no_argument, NULL, 'C'},
{GETOPT_SELINUX_CONTEXT_OPTION_DECL},
- {"debug", no_argument, nullptr, DEBUG_OPTION},
- {"directory", no_argument, nullptr, 'd'},
- {"group", required_argument, nullptr, 'g'},
- {"mode", required_argument, nullptr, 'm'},
- {"no-target-directory", no_argument, nullptr, 'T'},
- {"owner", required_argument, nullptr, 'o'},
- {"preserve-timestamps", no_argument, nullptr, 'p'},
- {"preserve-context", no_argument, nullptr, PRESERVE_CONTEXT_OPTION},
- {"strip", no_argument, nullptr, 's'},
- {"strip-program", required_argument, nullptr, STRIP_PROGRAM_OPTION},
- {"suffix", required_argument, nullptr, 'S'},
- {"target-directory", required_argument, nullptr, 't'},
- {"verbose", no_argument, nullptr, 'v'},
+ {"debug", no_argument, NULL, DEBUG_OPTION},
+ {"directory", no_argument, NULL, 'd'},
+ {"group", required_argument, NULL, 'g'},
+ {"mode", required_argument, NULL, 'm'},
+ {"no-target-directory", no_argument, NULL, 'T'},
+ {"owner", required_argument, NULL, 'o'},
+ {"preserve-timestamps", no_argument, NULL, 'p'},
+ {"preserve-context", no_argument, NULL, PRESERVE_CONTEXT_OPTION},
+ {"strip", no_argument, NULL, 's'},
+ {"strip-program", required_argument, NULL, STRIP_PROGRAM_OPTION},
+ {"suffix", required_argument, NULL, 'S'},
+ {"target-directory", required_argument, NULL, 't'},
+ {"verbose", no_argument, NULL, 'v'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
/* Compare content of opened files using file descriptors A_FD and B_FD. Return
@@ -213,11 +213,11 @@ need_copy (char const *src_name, char const *dest_name,
/* compare SELinux context if preserving */
if (selinux_enabled && x->preserve_security_context)
{
- char *file_scontext_raw = nullptr;
+ char *file_scontext_raw = NULL;
if (getfilecon_raw (src_name, &file_scontext_raw) == -1)
return true;
- char *to_scontext_raw = nullptr;
+ char *to_scontext_raw = NULL;
if (getfilecon_raw (dest_name, &to_scontext_raw) == -1)
{
freecon (file_scontext_raw);
@@ -290,11 +290,11 @@ cp_option_init (struct cp_options *x)
x->update = UPDATE_ALL;
x->require_preserve_context = false; /* Not used by install currently. */
x->preserve_security_context = false; /* Whether to copy context from src. */
- x->set_security_context = nullptr; /* Whether to set sys default context. */
+ x->set_security_context = NULL; /* Whether to set sys default context. */
x->preserve_xattr = false;
x->verbose = false;
- x->dest_info = nullptr;
- x->src_info = nullptr;
+ x->dest_info = NULL;
+ x->src_info = NULL;
}
static struct selabel_handle *
@@ -305,7 +305,7 @@ get_labeling_handle (void)
if (!initialized)
{
initialized = true;
- hnd = selabel_open (SELABEL_CTX_FILE, nullptr, 0);
+ hnd = selabel_open (SELABEL_CTX_FILE, NULL, 0);
if (!hnd)
error (0, errno, _("warning: security labeling handle failed"));
}
@@ -333,7 +333,7 @@ setdefaultfilecon (char const *file)
if (!hnd)
return;
- char *scontext_raw = nullptr;
+ char *scontext_raw = NULL;
if (selabel_lookup_raw (hnd, &scontext_raw, file, st.st_mode) != 0)
{
if (errno != ENOENT && ! ignorable_ctx_err (errno))
@@ -424,7 +424,7 @@ copy_file (char const *from, char const *to,
However, since !x->recursive, the call to "copy" will fail if FROM
is a directory. */
- return copy (from, to, to_dirfd, to_relname, 0, x, ©_into_self, nullptr);
+ return copy (from, to, to_dirfd, to_relname, 0, x, ©_into_self, NULL);
}
/* Set the attributes of file or directory NAME aka DIRFD+RELNAME.
@@ -488,7 +488,7 @@ static bool
strip (char const *name)
{
posix_spawnattr_t attr;
- posix_spawnattr_t *attrp = nullptr;
+ posix_spawnattr_t *attrp = NULL;
/* Try to use vfork for systems where it matters. */
if (posix_spawnattr_init (&attr) == 0)
@@ -500,15 +500,15 @@ strip (char const *name)
}
/* Construct the arguments to 'strip'. */
- char *concat_name = nullptr;
+ char *concat_name = NULL;
char const *safe_name = name;
if (name && *name == '-')
- safe_name = concat_name = file_name_concat (".", name, nullptr);
- char const *const argv[] = { strip_program, safe_name, nullptr };
+ safe_name = concat_name = file_name_concat (".", name, NULL);
+ char const *const argv[] = { strip_program, safe_name, NULL };
/* Run 'strip'. */
pid_t pid;
- int result = posix_spawnp (&pid, strip_program, nullptr, attrp,
+ int result = posix_spawnp (&pid, strip_program, NULL, attrp,
(char * const *) argv, environ);
bool ok = false;
@@ -547,10 +547,10 @@ get_ids (void)
if (owner_name)
{
struct passwd *pw = getpwnam (owner_name);
- if (pw == nullptr)
+ if (pw == NULL)
{
uintmax_t tmp;
- if (xstrtoumax (owner_name, nullptr, 0, &tmp, "") != LONGINT_OK
+ if (xstrtoumax (owner_name, NULL, 0, &tmp, "") != LONGINT_OK
|| ckd_add (&owner_id, tmp, 0))
error (EXIT_FAILURE, 0, _("invalid user %s"),
quoteaf (owner_name));
@@ -565,10 +565,10 @@ get_ids (void)
if (group_name)
{
struct group *gr = getgrnam (group_name);
- if (gr == nullptr)
+ if (gr == NULL)
{
uintmax_t tmp;
- if (xstrtoumax (group_name, nullptr, 0, &tmp, "") != LONGINT_OK
+ if (xstrtoumax (group_name, NULL, 0, &tmp, "") != LONGINT_OK
|| ckd_add (&group_id, tmp, 0))
error (EXIT_FAILURE, 0, _("invalid group %s"),
quoteaf (group_name));
@@ -788,16 +788,16 @@ install_file_in_dir (char const *from, char const *to_dir,
int
main (int argc, char **argv)
{
- char const *specified_mode = nullptr;
+ char const *specified_mode = NULL;
bool make_backups = false;
- char const *backup_suffix = nullptr;
- char *version_control_string = nullptr;
+ char const *backup_suffix = NULL;
+ char *version_control_string = NULL;
bool mkdir_and_install = false;
struct cp_options x;
- char const *target_directory = nullptr;
+ char const *target_directory = NULL;
bool no_target_directory = false;
bool strip_program_specified = false;
- char const *scontext = nullptr;
+ char const *scontext = NULL;
/* set iff kernel has extra selinux system calls */
selinux_enabled = (0 < is_selinux_enabled ());
@@ -811,15 +811,15 @@ main (int argc, char **argv)
cp_option_init (&x);
- owner_name = nullptr;
- group_name = nullptr;
+ owner_name = NULL;
+ group_name = NULL;
strip_files = false;
dir_arg = false;
umask (0);
int optc;
while ((optc = getopt_long (argc, argv, "bcCsDdg:m:o:pt:TvS:Z", long_options,
- nullptr))
+ NULL))
!= -1)
{
switch (optc)
@@ -1000,7 +1000,7 @@ main (int argc, char **argv)
struct mode_change *change = mode_compile (specified_mode);
if (!change)
error (EXIT_FAILURE, 0, _("invalid mode %s"), quote (specified_mode));
- mode = mode_adjust (0, false, 0, change, nullptr);
+ mode = mode_adjust (0, false, 0, change, NULL);
dir_mode = mode_adjust (0, true, 0, change, &dir_mode_bits);
free (change);
}
diff --git a/src/iopoll.c b/src/iopoll.c
index 346ca67009..5d87839a3b 100644
--- a/src/iopoll.c
+++ b/src/iopoll.c
@@ -116,9 +116,9 @@ iopoll_internal (int fdin, int fdout, bool block, bool broken_output)
struct timeval delay = {0};
ret = select (nfds,
- broken_output ? &fds : nullptr,
- broken_output ? nullptr : &fds,
- nullptr, block ? nullptr : &delay);
+ broken_output ? &fds : NULL,
+ broken_output ? NULL : &fds,
+ NULL, block ? NULL : &delay);
if (ret < 0)
continue;
diff --git a/src/join.c b/src/join.c
index 8e13d1df28..46e47037da 100644
--- a/src/join.c
+++ b/src/join.c
@@ -87,7 +87,7 @@ struct seq
};
/* The previous line read from each file. */
-static struct line *prevline[2] = {nullptr, nullptr};
+static struct line *prevline[2] = {NULL, NULL};
/* The number of lines read from each file. */
static uintmax_t line_no[2] = {0, 0};
@@ -98,7 +98,7 @@ static char *g_names[2];
/* This provides an extra line buffer for each file. We need these if we
try to read two consecutive lines into the same buffer, since we don't
want to overwrite the previous buffer before we check order. */
-static struct line *spareline[2] = {nullptr, nullptr};
+static struct line *spareline[2] = {NULL, NULL};
/* True if the LC_COLLATE locale is hard. */
static bool hard_LC_COLLATE;
@@ -162,14 +162,14 @@ enum
static struct option const longopts[] =
{
- {"ignore-case", no_argument, nullptr, 'i'},
- {"check-order", no_argument, nullptr, CHECK_ORDER_OPTION},
- {"nocheck-order", no_argument, nullptr, NOCHECK_ORDER_OPTION},
- {"zero-terminated", no_argument, nullptr, 'z'},
- {"header", no_argument, nullptr, HEADER_LINE_OPTION},
+ {"ignore-case", no_argument, NULL, 'i'},
+ {"check-order", no_argument, NULL, CHECK_ORDER_OPTION},
+ {"nocheck-order", no_argument, NULL, NOCHECK_ORDER_OPTION},
+ {"zero-terminated", no_argument, NULL, 'z'},
+ {"header", no_argument, NULL, HEADER_LINE_OPTION},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
/* Used to print non-joining lines */
@@ -316,12 +316,12 @@ xfields (struct line *line)
static void
freeline (struct line *line)
{
- if (line == nullptr)
+ if (line == NULL)
return;
free (line->fields);
- line->fields = nullptr;
+ line->fields = NULL;
free (line->buf.buffer);
- line->buf.buffer = nullptr;
+ line->buf.buffer = NULL;
}
/* Return <0 if the join field in LINE1 compares less than the one in LINE2;
@@ -348,7 +348,7 @@ keycmp (struct line const *line1, struct line const *line2,
}
else
{
- beg1 = nullptr;
+ beg1 = NULL;
len1 = 0;
}
@@ -359,7 +359,7 @@ keycmp (struct line const *line1, struct line const *line2,
}
else
{
- beg2 = nullptr;
+ beg2 = NULL;
len2 = 0;
}
@@ -502,7 +502,7 @@ initseq (struct seq *seq)
{
seq->count = 0;
seq->alloc = 0;
- seq->lines = nullptr;
+ seq->lines = NULL;
}
/* Read a line from FP and add it to SEQ. Return true if successful. */
@@ -514,7 +514,7 @@ getseq (FILE *fp, struct seq *seq, int whichfile)
{
seq->lines = xpalloc (seq->lines, &seq->alloc, 1, -1, sizeof *seq->lines);
for (idx_t i = seq->count; i < seq->alloc; i++)
- seq->lines[i] = nullptr;
+ seq->lines[i] = NULL;
}
if (get_line (fp, &seq->lines[seq->count], whichfile))
@@ -622,7 +622,7 @@ prjoin (struct line const *line1, struct line const *line2)
}
prfield (field, line);
o = o->next;
- if (o == nullptr)
+ if (o == NULL)
break;
fwrite (output_separator, 1, output_seplen, stdout);
}
@@ -684,8 +684,8 @@ join (FILE *fp1, FILE *fp2)
struct line const *hline1 = seq1.count ? seq1.lines[0] : &uni_blank;
struct line const *hline2 = seq2.count ? seq2.lines[0] : &uni_blank;
prjoin (hline1, hline2);
- prevline[0] = nullptr;
- prevline[1] = nullptr;
+ prevline[0] = NULL;
+ prevline[1] = NULL;
if (seq1.count)
advance_seq (fp1, &seq1, true, 1);
if (seq2.count)
@@ -769,7 +769,7 @@ join (FILE *fp1, FILE *fp2)
tail ends of both inputs to verify that they are in order. We
skip the rest of the tail once we have issued a warning for that
file, unless we actually need to print the unpairable lines. */
- struct line *line = nullptr;
+ struct line *line = NULL;
bool checktail = false;
if (check_input_order != CHECK_ORDER_DISABLED
@@ -826,7 +826,7 @@ add_field (int file, idx_t field)
o = xmalloc (sizeof *o);
o->file = file;
o->field = field;
- o->next = nullptr;
+ o->next = NULL;
/* Add to the end of the list so the fields are in the right order. */
outlist_end->next = o;
@@ -844,7 +844,7 @@ string_to_join_field (char const *str)
{
intmax_t val;
- strtol_error s_err = xstrtoimax (str, nullptr, 10, &val, "");
+ strtol_error s_err = xstrtoimax (str, NULL, 10, &val, "");
if (s_err == LONGINT_OVERFLOW || (s_err == LONGINT_OK && PTRDIFF_MAX < val))
val = PTRDIFF_MAX;
else if (s_err != LONGINT_OK || val <= 0)
@@ -1024,7 +1024,7 @@ main (int argc, char **argv)
check_input_order = CHECK_ORDER_DEFAULT;
while ((optc = getopt_long (argc, argv, "-a:e:i1:2:j:o:t:v:z",
- longopts, nullptr))
+ longopts, NULL))
!= -1)
{
optc_status = MUST_BE_OPERAND;
@@ -1038,7 +1038,7 @@ main (int argc, char **argv)
case 'a':
{
long int val;
- if (xstrtol (optarg, nullptr, 10, &val, "") != LONGINT_OK
+ if (xstrtol (optarg, NULL, 10, &val, "") != LONGINT_OK
|| (val != 1 && val != 2))
error (EXIT_FAILURE, 0,
_("invalid file number: %s"), quote (optarg));
diff --git a/src/kill.c b/src/kill.c
index a9a0f33cc9..742009a255 100644
--- a/src/kill.c
+++ b/src/kill.c
@@ -41,12 +41,12 @@ static char const short_options[] =
static struct option const long_options[] =
{
- {"list", no_argument, nullptr, 'l'},
- {"signal", required_argument, nullptr, 's'},
- {"table", no_argument, nullptr, 't'},
+ {"list", no_argument, NULL, 'l'},
+ {"signal", required_argument, NULL, 's'},
+ {"table", no_argument, NULL, 't'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
void
@@ -224,7 +224,7 @@ main (int argc, char **argv)
atexit (close_stdout);
- while ((optc = getopt_long (argc, argv, short_options, long_options, nullptr))
+ while ((optc = getopt_long (argc, argv, short_options, long_options, NULL))
!= -1)
switch (optc)
{
@@ -299,6 +299,6 @@ main (int argc, char **argv)
}
return (list
- ? list_signals (table, optind < argc ? argv + optind : nullptr)
+ ? list_signals (table, optind < argc ? argv + optind : NULL)
: send_signals (signum, argv + optind));
}
diff --git a/src/libstdbuf.c b/src/libstdbuf.c
index e595596e3c..edcb9916e4 100644
--- a/src/libstdbuf.c
+++ b/src/libstdbuf.c
@@ -35,7 +35,7 @@
the buffer size, and more problematically does not give any indication
that the new size request was ignored:
- setvbuf (stdout, nullptr, _IOFBF, 8192);
+ setvbuf (stdout, NULL, _IOFBF, 8192);
The ISO C99 standard section 7.19.5.6 on the setvbuf function says:
@@ -70,7 +70,7 @@
static void
apply_mode (FILE *stream, char const *stream_name, char const *envvar)
{
- char *buf = nullptr;
+ char *buf = NULL;
int setvbuf_mode;
unsigned long int size = 0;
@@ -99,7 +99,7 @@ apply_mode (FILE *stream, char const *stream_name, char const *envvar)
Huge sizes can cause problems with some stdio implementations. */
buf = (size <= ((unsigned long int) -2 < (size_t) -1 / 2
? (unsigned long int) -2 : (size_t) -1 / 2)
- ? malloc (size) : nullptr);
+ ? malloc (size) : NULL);
if (!buf)
{
/* We could defer the allocation to libc, however since
diff --git a/src/link.c b/src/link.c
index 58318ff637..1125084b78 100644
--- a/src/link.c
+++ b/src/link.c
@@ -66,7 +66,7 @@ main (int argc, char **argv)
parse_gnu_standard_options_only (argc, argv, PROGRAM_NAME, PACKAGE_NAME,
Version, true, usage, AUTHORS,
- (char const *) nullptr);
+ (char const *) NULL);
if (argc < optind + 2)
{
diff --git a/src/ln.c b/src/ln.c
index 1e5db02bb9..979071bcd8 100644
--- a/src/ln.c
+++ b/src/ln.c
@@ -90,22 +90,22 @@ enum { DEST_INFO_INITIAL_CAPACITY = 61 };
static struct option const long_options[] =
{
- {"backup", optional_argument, nullptr, 'b'},
- {"directory", no_argument, nullptr, 'F'},
- {"no-dereference", no_argument, nullptr, 'n'},
- {"no-target-directory", no_argument, nullptr, 'T'},
- {"force", no_argument, nullptr, 'f'},
- {"interactive", no_argument, nullptr, 'i'},
- {"suffix", required_argument, nullptr, 'S'},
- {"target-directory", required_argument, nullptr, 't'},
- {"logical", no_argument, nullptr, 'L'},
- {"physical", no_argument, nullptr, 'P'},
- {"relative", no_argument, nullptr, 'r'},
- {"symbolic", no_argument, nullptr, 's'},
- {"verbose", no_argument, nullptr, 'v'},
+ {"backup", optional_argument, NULL, 'b'},
+ {"directory", no_argument, NULL, 'F'},
+ {"no-dereference", no_argument, NULL, 'n'},
+ {"no-target-directory", no_argument, NULL, 'T'},
+ {"force", no_argument, NULL, 'f'},
+ {"interactive", no_argument, NULL, 'i'},
+ {"suffix", required_argument, NULL, 'S'},
+ {"target-directory", required_argument, NULL, 't'},
+ {"logical", no_argument, NULL, 'L'},
+ {"physical", no_argument, NULL, 'P'},
+ {"relative", no_argument, NULL, 'r'},
+ {"symbolic", no_argument, NULL, 's'},
+ {"verbose", no_argument, NULL, 'v'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
/* Return an errno value for a system call that returned STATUS.
@@ -130,7 +130,7 @@ convert_abs_rel (char const *from, char const *target)
char *realdest = canonicalize_filename_mode (targetdir, CAN_MISSING);
char *realfrom = canonicalize_filename_mode (from, CAN_MISSING);
- char *relative_from = nullptr;
+ char *relative_from = NULL;
if (realdest && realfrom)
{
/* Write to a PATH_MAX buffer. */
@@ -139,7 +139,7 @@ convert_abs_rel (char const *from, char const *target)
if (!relpath (realfrom, realdest, relative_from, PATH_MAX))
{
free (relative_from);
- relative_from = nullptr;
+ relative_from = NULL;
}
}
@@ -180,8 +180,8 @@ do_link (char const *source, int destdir_fd, char const *dest_base,
{
struct stat source_stats;
int source_status = 1;
- char *backup_base = nullptr;
- char *rel_source = nullptr;
+ char *backup_base = NULL;
+ char *rel_source = NULL;
int nofollow_flag = logical ? 0 : AT_SYMLINK_NOFOLLOW;
if (link_errno < 0)
link_errno = atomic_link (source, destdir_fd, dest_base);
@@ -294,7 +294,7 @@ do_link (char const *source, int destdir_fd, char const *dest_base,
{
int rename_errno = errno;
free (backup_base);
- backup_base = nullptr;
+ backup_base = NULL;
if (rename_errno != ENOENT)
{
error (0, rename_errno, _("cannot backup %s"),
@@ -350,7 +350,7 @@ do_link (char const *source, int destdir_fd, char const *dest_base,
if (backup_base)
{
char *backup = backup_base;
- void *alloc = nullptr;
+ void *alloc = NULL;
ptrdiff_t destdirlen = dest_base - dest;
if (0 < destdirlen)
{
@@ -481,9 +481,9 @@ main (int argc, char **argv)
int c;
bool ok;
bool make_backups = false;
- char const *backup_suffix = nullptr;
- char *version_control_string = nullptr;
- char const *target_directory = nullptr;
+ char const *backup_suffix = NULL;
+ char *version_control_string = NULL;
+ char const *target_directory = NULL;
int destdir_fd;
bool no_target_directory = false;
int n_files;
@@ -502,7 +502,7 @@ main (int argc, char **argv)
= hard_dir_link = false;
while ((c = getopt_long (argc, argv, "bdfinrst:vFLPS:T",
- long_options, nullptr))
+ long_options, NULL))
!= -1)
{
switch (c)
@@ -655,11 +655,11 @@ main (int argc, char **argv)
&& backup_type != numbered_backups)
{
dest_set = hash_initialize (DEST_INFO_INITIAL_CAPACITY,
- nullptr,
+ NULL,
triple_hash,
triple_compare,
triple_free);
- if (dest_set == nullptr)
+ if (dest_set == NULL)
xalloc_die ();
}
diff --git a/src/logname.c b/src/logname.c
index 190003816e..824a77ace0 100644
--- a/src/logname.c
+++ b/src/logname.c
@@ -59,7 +59,7 @@ main (int argc, char **argv)
parse_gnu_standard_options_only (argc, argv, PROGRAM_NAME, PACKAGE_NAME,
Version, true, usage, AUTHORS,
- (char const *) nullptr);
+ (char const *) NULL);
if (optind < argc)
{
diff --git a/src/ls.c b/src/ls.c
index 657d60de1e..e7485dc0e7 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -451,7 +451,7 @@ enum time_style
static char const *const time_style_args[] =
{
- "full-iso", "long-iso", "iso", "locale", nullptr
+ "full-iso", "long-iso", "iso", "locale", NULL
};
static enum time_style const time_style_types[] =
{
@@ -558,7 +558,7 @@ static enum indicator_style indicator_style;
/* Names of indicator styles. */
static char const *const indicator_style_args[] =
{
- "none", "slash", "file-type", "classify", nullptr
+ "none", "slash", "file-type", "classify", NULL
};
static enum indicator_style const indicator_style_types[] =
{
@@ -628,10 +628,10 @@ static struct bin_str color_indicator[] =
{
{ 2, (char const []) {'\033','['} },/* lc: Left of color sequence */
{ 1, (char const []) {'m'} }, /* rc: Right of color sequence */
- { 0, nullptr }, /* ec: End color (replaces lc+rs+rc) */
+ { 0, NULL }, /* ec: End color (replaces lc+rs+rc) */
{ 1, (char const []) {'0'} }, /* rs: Reset to ordinary colors */
- { 0, nullptr }, /* no: Normal */
- { 0, nullptr }, /* fi: File: default */
+ { 0, NULL }, /* no: Normal */
+ { 0, NULL }, /* fi: File: default */
{ 5, ((char const [])
{'0','1',';','3','4'}) }, /* di: Directory: bright blue */
{ 5, ((char const [])
@@ -643,8 +643,8 @@ static struct bin_str color_indicator[] =
{'0','1',';','3','3'}) }, /* bd: Block device: bright yellow */
{ 5, ((char const [])
{'0','1',';','3','3'}) }, /* cd: Char device: bright yellow */
- { 0, nullptr }, /* mi: Missing file: undefined */
- { 0, nullptr }, /* or: Orphaned symlink: undefined */
+ { 0, NULL }, /* mi: Missing file: undefined */
+ { 0, NULL }, /* or: Orphaned symlink: undefined */
{ 5, ((char const [])
{'0','1',';','3','2'}) }, /* ex: Executable: bright green */
{ 5, ((char const [])
@@ -659,14 +659,14 @@ static struct bin_str color_indicator[] =
{'3','4',';','4','2'}) }, /* ow: other-writable: blue on green */
{ 5, ((char const [])
{'3','0',';','4','2'}) }, /* tw: ow w/ sticky: black on green */
- { 0, nullptr }, /* ca: disabled by default */
- { 0, nullptr }, /* mh: disabled by default */
+ { 0, NULL }, /* ca: disabled by default */
+ { 0, NULL }, /* mh: disabled by default */
{ 3, ((char const [])
{'\033','[','K'}) }, /* cl: clear to end of line */
};
/* A list mapping file extensions to corresponding display sequence. */
-static struct color_ext_type *color_ext_list = nullptr;
+static struct color_ext_type *color_ext_list = NULL;
/* Buffer for color sequences */
static char *color_buf;
@@ -875,59 +875,59 @@ enum
static struct option const long_options[] =
{
- {"all", no_argument, nullptr, 'a'},
- {"escape", no_argument, nullptr, 'b'},
- {"directory", no_argument, nullptr, 'd'},
- {"dired", no_argument, nullptr, 'D'},
- {"full-time", no_argument, nullptr, FULL_TIME_OPTION},
- {"group-directories-first", no_argument, nullptr,
+ {"all", no_argument, NULL, 'a'},
+ {"escape", no_argument, NULL, 'b'},
+ {"directory", no_argument, NULL, 'd'},
+ {"dired", no_argument, NULL, 'D'},
+ {"full-time", no_argument, NULL, FULL_TIME_OPTION},
+ {"group-directories-first", no_argument, NULL,
GROUP_DIRECTORIES_FIRST_OPTION},
- {"human-readable", no_argument, nullptr, 'h'},
- {"inode", no_argument, nullptr, 'i'},
- {"kibibytes", no_argument, nullptr, 'k'},
- {"numeric-uid-gid", no_argument, nullptr, 'n'},
- {"no-group", no_argument, nullptr, 'G'},
- {"hide-control-chars", no_argument, nullptr, 'q'},
- {"reverse", no_argument, nullptr, 'r'},
- {"size", no_argument, nullptr, 's'},
- {"width", required_argument, nullptr, 'w'},
- {"almost-all", no_argument, nullptr, 'A'},
- {"ignore-backups", no_argument, nullptr, 'B'},
- {"classify", optional_argument, nullptr, 'F'},
- {"file-type", no_argument, nullptr, FILE_TYPE_INDICATOR_OPTION},
- {"si", no_argument, nullptr, SI_OPTION},
- {"dereference-command-line", no_argument, nullptr, 'H'},
- {"dereference-command-line-symlink-to-dir", no_argument, nullptr,
+ {"human-readable", no_argument, NULL, 'h'},
+ {"inode", no_argument, NULL, 'i'},
+ {"kibibytes", no_argument, NULL, 'k'},
+ {"numeric-uid-gid", no_argument, NULL, 'n'},
+ {"no-group", no_argument, NULL, 'G'},
+ {"hide-control-chars", no_argument, NULL, 'q'},
+ {"reverse", no_argument, NULL, 'r'},
+ {"size", no_argument, NULL, 's'},
+ {"width", required_argument, NULL, 'w'},
+ {"almost-all", no_argument, NULL, 'A'},
+ {"ignore-backups", no_argument, NULL, 'B'},
+ {"classify", optional_argument, NULL, 'F'},
+ {"file-type", no_argument, NULL, FILE_TYPE_INDICATOR_OPTION},
+ {"si", no_argument, NULL, SI_OPTION},
+ {"dereference-command-line", no_argument, NULL, 'H'},
+ {"dereference-command-line-symlink-to-dir", no_argument, NULL,
DEREFERENCE_COMMAND_LINE_SYMLINK_TO_DIR_OPTION},
- {"hide", required_argument, nullptr, HIDE_OPTION},
- {"ignore", required_argument, nullptr, 'I'},
- {"indicator-style", required_argument, nullptr, INDICATOR_STYLE_OPTION},
- {"dereference", no_argument, nullptr, 'L'},
- {"literal", no_argument, nullptr, 'N'},
- {"quote-name", no_argument, nullptr, 'Q'},
- {"quoting-style", required_argument, nullptr, QUOTING_STYLE_OPTION},
- {"recursive", no_argument, nullptr, 'R'},
- {"format", required_argument, nullptr, FORMAT_OPTION},
- {"show-control-chars", no_argument, nullptr, SHOW_CONTROL_CHARS_OPTION},
- {"sort", required_argument, nullptr, SORT_OPTION},
- {"tabsize", required_argument, nullptr, 'T'},
- {"time", required_argument, nullptr, TIME_OPTION},
- {"time-style", required_argument, nullptr, TIME_STYLE_OPTION},
- {"zero", no_argument, nullptr, ZERO_OPTION},
- {"color", optional_argument, nullptr, COLOR_OPTION},
- {"hyperlink", optional_argument, nullptr, HYPERLINK_OPTION},
- {"block-size", required_argument, nullptr, BLOCK_SIZE_OPTION},
+ {"hide", required_argument, NULL, HIDE_OPTION},
+ {"ignore", required_argument, NULL, 'I'},
+ {"indicator-style", required_argument, NULL, INDICATOR_STYLE_OPTION},
+ {"dereference", no_argument, NULL, 'L'},
+ {"literal", no_argument, NULL, 'N'},
+ {"quote-name", no_argument, NULL, 'Q'},
+ {"quoting-style", required_argument, NULL, QUOTING_STYLE_OPTION},
+ {"recursive", no_argument, NULL, 'R'},
+ {"format", required_argument, NULL, FORMAT_OPTION},
+ {"show-control-chars", no_argument, NULL, SHOW_CONTROL_CHARS_OPTION},
+ {"sort", required_argument, NULL, SORT_OPTION},
+ {"tabsize", required_argument, NULL, 'T'},
+ {"time", required_argument, NULL, TIME_OPTION},
+ {"time-style", required_argument, NULL, TIME_STYLE_OPTION},
+ {"zero", no_argument, NULL, ZERO_OPTION},
+ {"color", optional_argument, NULL, COLOR_OPTION},
+ {"hyperlink", optional_argument, NULL, HYPERLINK_OPTION},
+ {"block-size", required_argument, NULL, BLOCK_SIZE_OPTION},
{"context", no_argument, NULL, 'Z'},
- {"author", no_argument, nullptr, AUTHOR_OPTION},
+ {"author", no_argument, NULL, AUTHOR_OPTION},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
static char const *const format_args[] =
{
"verbose", "long", "commas", "horizontal", "across",
- "vertical", "single-column", nullptr
+ "vertical", "single-column", NULL
};
static enum format const format_types[] =
{
@@ -939,7 +939,7 @@ ARGMATCH_VERIFY (format_args, format_types);
static char const *const sort_args[] =
{
"none", "size", "time", "version", "extension",
- "name", "width", nullptr
+ "name", "width", NULL
};
static enum sort_type const sort_types[] =
{
@@ -954,7 +954,7 @@ static char const *const time_args[] =
"ctime", "status",
"mtime", "modification",
"birth", "creation",
- nullptr
+ NULL
};
static enum time_type const time_types[] =
{
@@ -970,7 +970,7 @@ static char const *const when_args[] =
/* force and none are for compatibility with another color-ls version */
"always", "yes", "force",
"never", "no", "none",
- "auto", "tty", "if-tty", nullptr
+ "auto", "tty", "if-tty", NULL
};
static enum when_type const when_types[] =
{
@@ -1286,7 +1286,7 @@ fstat_for_ino (int fd, struct stat *st)
}
#endif
-/* Return the address of the first plain %b spec in FMT, or nullptr if
+/* Return the address of the first plain %b spec in FMT, or NULL if
there is no such spec. %5b etc. do not match, so that user
widths/flags are honored. */
@@ -1301,7 +1301,7 @@ first_percent_b (char const *fmt)
case 'b': return fmt;
case '%': fmt++; break;
}
- return nullptr;
+ return NULL;
}
static char RFC3986[256];
@@ -1461,7 +1461,7 @@ visit_dir (dev_t dev, ino_t ino)
/* Attempt to insert this entry into the table. */
ent_from_table = hash_insert (active_dir_set, ent);
- if (ent_from_table == nullptr)
+ if (ent_from_table == NULL)
{
/* Insertion failed due to lack of memory. */
xalloc_die ();
@@ -1574,7 +1574,7 @@ process_signals (void)
/* Exit or suspend the program. */
raise (sig);
- sigprocmask (SIG_SETMASK, &oldset, nullptr);
+ sigprocmask (SIG_SETMASK, &oldset, NULL);
/* If execution reaches here, then the program has been
continued (after being suspended). */
@@ -1604,7 +1604,7 @@ signal_setup (bool init)
for (int j = 0; j < nsigs + nstop; j++)
{
int sig = j < nsigs ? term_sig[j]: stop_sig[j - nsigs];
- sigaction (sig, nullptr, &act);
+ sigaction (sig, NULL, &act);
if (act.sa_handler != SIG_IGN)
sigaddset (&caught_signals, sig);
}
@@ -1618,7 +1618,7 @@ signal_setup (bool init)
if (sigismember (&caught_signals, sig))
{
act.sa_handler = j < nsigs ? sighandler : stophandler;
- sigaction (sig, &act, nullptr);
+ sigaction (sig, &act, NULL);
}
}
}
@@ -1665,7 +1665,7 @@ main (int argc, char **argv)
exit_status = EXIT_SUCCESS;
print_dir_name = true;
- pending_dirs = nullptr;
+ pending_dirs = NULL;
current_time.tv_sec = TYPE_MINIMUM (time_t);
current_time.tv_nsec = -1;
@@ -1708,11 +1708,11 @@ main (int argc, char **argv)
detect any directory cycles. */
if (recursive)
{
- active_dir_set = hash_initialize (INITIAL_TABLE_SIZE, nullptr,
+ active_dir_set = hash_initialize (INITIAL_TABLE_SIZE, NULL,
dev_ino_hash,
dev_ino_compare,
dev_ino_free);
- if (active_dir_set == nullptr)
+ if (active_dir_set == NULL)
xalloc_die ();
obstack_init (&dev_ino_obstack);
@@ -1757,20 +1757,20 @@ main (int argc, char **argv)
if (n_files <= 0)
{
if (immediate_dirs)
- gobble_file (".", directory, NOT_AN_INODE_NUMBER, true, nullptr);
+ gobble_file (".", directory, NOT_AN_INODE_NUMBER, true, NULL);
else
- queue_directory (".", nullptr, true);
+ queue_directory (".", NULL, true);
}
else
do
- gobble_file (argv[i++], unknown, NOT_AN_INODE_NUMBER, true, nullptr);
+ gobble_file (argv[i++], unknown, NOT_AN_INODE_NUMBER, true, NULL);
while (i < argc);
if (cwd_n_used)
{
sort_files ();
if (!immediate_dirs)
- extract_dirs_from_files (nullptr, true);
+ extract_dirs_from_files (NULL, true);
/* 'cwd_n_used' might be zero now. */
}
@@ -1794,9 +1794,9 @@ main (int argc, char **argv)
if (LOOP_DETECT)
{
- if (thispend->name == nullptr)
+ if (thispend->name == NULL)
{
- /* thispend->name == nullptr means this is a marker entry
+ /* thispend->name == NULL means this is a marker entry
indicating we've finished processing the directory.
Use its dev/ino numbers to remove the corresponding
entry from the active_dir_set hash table. */
@@ -1872,7 +1872,7 @@ decode_line_length (char const *spec)
/* Treat too-large values as if they were 0, which is
effectively infinity. */
- switch (xstrtoumax (spec, nullptr, 0, &val, ""))
+ switch (xstrtoumax (spec, NULL, 0, &val, ""))
{
case LONGINT_OK:
return val <= MIN (PTRDIFF_MAX, SIZE_MAX) ? val : 0;
@@ -1908,7 +1908,7 @@ stdout_isatty (void)
static int
decode_switches (int argc, char **argv)
{
- char *time_style_option = nullptr;
+ char *time_style_option = NULL;
/* These variables are false or -1 unless a switch says otherwise. */
bool kibibytes_specified = false;
@@ -2320,7 +2320,7 @@ decode_switches (int argc, char **argv)
if (p)
{
uintmax_t tmp;
- if (xstrtoumax (p, nullptr, 0, &tmp, "") == LONGINT_OK
+ if (xstrtoumax (p, NULL, 0, &tmp, "") == LONGINT_OK
&& tmp <= SIZE_MAX)
tabsize = tmp;
else
@@ -2344,15 +2344,15 @@ decode_switches (int argc, char **argv)
? (stdout_isatty () ? shell_escape_quoting_style : -1)
: escape_quoting_style);
if (0 <= qs)
- set_quoting_style (nullptr, qs);
- qs = get_quoting_style (nullptr);
+ set_quoting_style (NULL, qs);
+ qs = get_quoting_style (NULL);
align_variable_outer_quotes
= ((format == long_format
|| ((format == many_per_line || format == horizontal) && line_length))
&& (qs == shell_quoting_style
|| qs == shell_escape_quoting_style
|| qs == c_maybe_quoting_style));
- filename_quoting_options = clone_quoting_options (nullptr);
+ filename_quoting_options = clone_quoting_options (NULL);
if (qs == escape_quoting_style)
set_char_quoting (filename_quoting_options, ' ', 1);
if (file_type <= indicator_style)
@@ -2361,7 +2361,7 @@ decode_switches (int argc, char **argv)
set_char_quoting (filename_quoting_options, *p, 1);
}
- dirname_quoting_options = clone_quoting_options (nullptr);
+ dirname_quoting_options = clone_quoting_options (NULL);
set_char_quoting (dirname_quoting_options, ':', 1);
/* --dired implies --format=long (-l) and sans --hyperlink.
@@ -2381,7 +2381,7 @@ decode_switches (int argc, char **argv)
if (format == long_format)
{
- char *envstyle = nullptr;
+ char *envstyle = NULL;
char *style = time_style_option;
if (! style)
style = envstyle = getenv ("TIME_STYLE");
@@ -2444,7 +2444,7 @@ decode_switches (int argc, char **argv)
{
for (int i = 0; i < 2; i++)
long_time_format[i] =
- dcgettext (nullptr, long_time_format[i], LC_TIME);
+ dcgettext (NULL, long_time_format[i], LC_TIME);
}
}
}
@@ -2705,7 +2705,7 @@ parse_ls_color (void)
char label0, label1; /* Indicator label */
struct color_ext_type *ext; /* Extension we are working on */
- if ((p = getenv ("LS_COLORS")) == nullptr || *p == '\0')
+ if ((p = getenv ("LS_COLORS")) == NULL || *p == '\0')
{
/* LS_COLORS takes precedence, but if that's not set then
honor the COLORTERM and TERM env variables so that
@@ -2717,7 +2717,7 @@ parse_ls_color (void)
return;
}
- ext = nullptr;
+ ext = NULL;
/* This is an overly conservative estimate, but any possible
LS_COLORS string will *not* generate a color_buf longer than
@@ -2823,7 +2823,7 @@ parse_ls_color (void)
error (0, 0,
_("unparsable value for LS_COLORS environment variable"));
free (color_buf);
- for (struct color_ext_type *e = color_ext_list; e != nullptr;
+ for (struct color_ext_type *e = color_ext_list; e != NULL;
/* empty */)
{
struct color_ext_type *e2 = e;
@@ -2838,12 +2838,12 @@ parse_ls_color (void)
different cased extensions with separate sequences defined.
Also set ext.len to SIZE_MAX on any entries that can't
match due to precedence, to avoid redundant string compares. */
- for (struct color_ext_type *e1 = color_ext_list; e1 != nullptr;
+ for (struct color_ext_type *e1 = color_ext_list; e1 != NULL;
e1 = e1->next)
{
bool case_ignored = false;
- for (struct color_ext_type *e2 = e1->next; e2 != nullptr;
+ for (struct color_ext_type *e2 = e1->next; e2 != NULL;
e2 = e2->next)
{
if (e2->ext.len < SIZE_MAX && e1->ext.len == e2->ext.len)
@@ -2928,7 +2928,7 @@ file_failure (bool serious, char const *message, char const *file)
If REALNAME is nonzero, it will be used instead of NAME when the
directory name is printed. This allows symbolic links to directories
to be treated as regular directories but still be listed under their
- real names. NAME == nullptr is used to insert a marker entry for the
+ real names. NAME == NULL is used to insert a marker entry for the
directory named in REALNAME.
If NAME is non-null, we use its dev/ino information to save
a call to stat -- when doing a recursive (-R) traversal.
@@ -2938,8 +2938,8 @@ static void
queue_directory (char const *name, char const *realname, bool command_line_arg)
{
struct pending *new = xmalloc (sizeof *new);
- new->realname = realname ? xstrdup (realname) : nullptr;
- new->name = name ? xstrdup (name) : nullptr;
+ new->realname = realname ? xstrdup (realname) : NULL;
+ new->name = name ? xstrdup (name) : NULL;
new->command_line_arg = command_line_arg;
new->next = pending_dirs;
pending_dirs = new;
@@ -3005,7 +3005,7 @@ print_dir (char const *name, char const *realname, bool command_line_arg)
first = false;
dired_indent ();
- char *absolute_name = nullptr;
+ char *absolute_name = NULL;
if (print_hyperlink)
{
absolute_name = canonicalize_filename_mode (name, CAN_MISSING);
@@ -3014,7 +3014,7 @@ print_dir (char const *name, char const *realname, bool command_line_arg)
_("error canonicalizing %s"), name);
}
quote_name (realname ? realname : name, dirname_quoting_options, -1,
- nullptr, true, &subdired_obstack, absolute_name);
+ NULL, true, &subdired_obstack, absolute_name);
free (absolute_name);
@@ -3172,10 +3172,10 @@ has_capability (char const *name)
bool has_cap;
cap_t cap_d = cap_get_file (name);
- if (cap_d == nullptr)
+ if (cap_d == NULL)
return false;
- result = cap_to_text (cap_d, nullptr);
+ result = cap_to_text (cap_d, NULL);
cap_free (cap_d);
if (!result)
return false;
@@ -3514,7 +3514,7 @@ gobble_file (char const *name, enum filetype type, ino_t inode,
f->has_capability = has_capability_cache (full_name, f);
f->scontext = ai.scontext;
- ai.scontext = nullptr;
+ ai.scontext = NULL;
aclinfo_free (&ai);
}
@@ -3653,7 +3653,7 @@ static void
get_link_name (char const *filename, struct fileinfo *f, bool command_line_arg)
{
f->linkname = areadlink_with_size (filename, f->stat.st_size);
- if (f->linkname == nullptr)
+ if (f->linkname == NULL)
file_failure (command_line_arg, _("cannot read symbolic link %s"),
filename);
}
@@ -3680,14 +3680,14 @@ static void
extract_dirs_from_files (char const *dirname, bool command_line_arg)
{
idx_t i, j;
- bool ignore_dot_and_dot_dot = (dirname != nullptr);
+ bool ignore_dot_and_dot_dot = (dirname != NULL);
if (dirname && LOOP_DETECT)
{
/* Insert a marker entry first. When we dequeue this marker entry,
we'll know that DIRNAME has been processed and may be removed
from the set of active directories. */
- queue_directory (nullptr, dirname, false);
+ queue_directory (NULL, dirname, false);
}
/* Queue the directories last one first, because queueing reverses the
@@ -3705,7 +3705,7 @@ extract_dirs_from_files (char const *dirname, bool command_line_arg)
queue_directory (f->name, f->linkname, command_line_arg);
else
{
- char *name = file_name_concat (dirname, f->name, nullptr);
+ char *name = file_name_concat (dirname, f->name, NULL);
queue_directory (name, f->linkname, command_line_arg);
free (name);
}
@@ -3963,13 +3963,13 @@ static qsortFunc const sort_functions[][2][2][2] =
{ rev_xstrcoll_version, rev_xstrcoll_df_version },
},
- /* We use nullptr for the strcmp variants of version comparison
+ /* We use NULL for the strcmp variants of version comparison
since as explained in cmp_version definition, version comparison
does not rely on xstrcoll, so it will never longjmp, and never
need to try the strcmp fallback. */
{
- { nullptr, nullptr },
- { nullptr, nullptr },
+ { NULL, NULL },
+ { NULL, NULL },
}
},
@@ -4181,7 +4181,7 @@ static void
format_user (uid_t u, int width, bool stat_ok)
{
format_user_or_group (! stat_ok ? "?" :
- (numeric_ids ? nullptr : getuser (u)), u, width);
+ (numeric_ids ? NULL : getuser (u)), u, width);
}
/* Likewise, for groups. */
@@ -4190,7 +4190,7 @@ static void
format_group (gid_t g, int width, bool stat_ok)
{
format_user_or_group (! stat_ok ? "?" :
- (numeric_ids ? nullptr : getgroup (g)), g, width);
+ (numeric_ids ? NULL : getgroup (g)), g, width);
}
/* Return the number of columns that format_user_or_group will print,
@@ -4201,7 +4201,7 @@ format_user_or_group_width (char const *name, uintmax_t id)
{
return (name
? mbswidth (name, MBSWIDTH_FLAGS)
- : snprintf (nullptr, 0, "%ju", id));
+ : snprintf (NULL, 0, "%ju", id));
}
/* Return the number of columns that format_user will print,
@@ -4210,7 +4210,7 @@ format_user_or_group_width (char const *name, uintmax_t id)
static int
format_user_width (uid_t u)
{
- return format_user_or_group_width (numeric_ids ? nullptr : getuser (u), u);
+ return format_user_or_group_width (numeric_ids ? NULL : getuser (u), u);
}
/* Likewise, for groups. */
@@ -4218,7 +4218,7 @@ format_user_width (uid_t u)
static int
format_group_width (gid_t g)
{
- return format_user_or_group_width (numeric_ids ? nullptr : getgroup (g), g);
+ return format_user_or_group_width (numeric_ids ? NULL : getgroup (g), g);
}
/* Return a pointer to a formatted version of F->stat.st_ino,
@@ -4431,7 +4431,7 @@ print_long_format (const struct fileinfo *f)
if (f->linkname)
{
dired_outstring (" -> ");
- print_name_with_quoting (f, true, nullptr, (p - buf) + w + 4);
+ print_name_with_quoting (f, true, NULL, (p - buf) + w + 4);
if (indicator_style != none)
print_type_indicator (true, f->linkmode, unknown);
}
@@ -4609,7 +4609,7 @@ quote_name_buf (char **inbuf, size_t bufsize, char *name,
displayed_width = len;
}
}
- else if (width != nullptr)
+ else if (width != NULL)
{
if (MB_CUR_MAX > 1)
{
@@ -4636,7 +4636,7 @@ quote_name_buf (char **inbuf, size_t bufsize, char *name,
not actually part of the name. */
*pad = (align_variable_outer_quotes && cwd_some_quoted && ! quoted);
- if (width != nullptr)
+ if (width != NULL)
*width = displayed_width;
*inbuf = buf;
@@ -4698,7 +4698,7 @@ quote_name (char const *name, struct quoting_options const *options,
bool pad;
len = quote_name_buf (&buf, sizeof smallbuf, (char *) name, options,
- needs_general_quoting, nullptr, &pad);
+ needs_general_quoting, NULL, &pad);
if (pad && allow_pad)
dired_outbyte (' ');
@@ -4761,7 +4761,7 @@ print_name_with_quoting (const struct fileinfo *f,
char const *name = symlink_target ? f->linkname : f->name;
const struct bin_str *color
- = print_with_color ? get_color_indicator (f, symlink_target) : nullptr;
+ = print_with_color ? get_color_indicator (f, symlink_target) : NULL;
bool used_color_this_time = (print_with_color
&& (color || is_colored (C_NORM)));
@@ -4791,7 +4791,7 @@ print_name_with_quoting (const struct fileinfo *f,
static void
prep_non_filename_text (void)
{
- if (color_indicator[C_END].string != nullptr)
+ if (color_indicator[C_END].string != NULL)
put_indicator (&color_indicator[C_END]);
else
{
@@ -4833,7 +4833,7 @@ print_file_name_and_frills (const struct fileinfo *f, size_t start_col)
if (print_scontext)
printf ("%*s ", format == with_commas ? 0 : scontext_width, f->scontext);
- size_t width = print_name_with_quoting (f, false, nullptr, start_col);
+ size_t width = print_name_with_quoting (f, false, NULL, start_col);
if (indicator_style != none)
width += print_type_indicator (f->stat_ok, f->stat.st_mode, f->filetype);
@@ -4898,10 +4898,10 @@ print_color_indicator (const struct bin_str *ind)
put_indicator (&color_indicator[C_RIGHT]);
}
- return ind != nullptr;
+ return ind != NULL;
}
-/* Returns color indicator or nullptr if none. */
+/* Returns color indicator or NULL if none. */
ATTRIBUTE_PURE
static const struct bin_str*
get_color_indicator (const struct fileinfo *f, bool symlink_target)
@@ -4989,14 +4989,14 @@ get_color_indicator (const struct fileinfo *f, bool symlink_target)
}
/* Check the file's suffix only if still classified as C_FILE. */
- ext = nullptr;
+ ext = NULL;
if (type == C_FILE)
{
/* Test if NAME has a recognized suffix. */
len = strlen (name);
name += len; /* Pointer to final \0. */
- for (ext = color_ext_list; ext != nullptr; ext = ext->next)
+ for (ext = color_ext_list; ext != NULL; ext = ext->next)
{
if (ext->ext.len <= len)
{
@@ -5026,7 +5026,7 @@ get_color_indicator (const struct fileinfo *f, bool symlink_target)
const struct bin_str *const s
= ext ? &(ext->seq) : &color_indicator[type];
- return s->string ? s : nullptr;
+ return s->string ? s : NULL;
}
/* Output a color indicator (which may contain nulls). */
diff --git a/src/mkdir.c b/src/mkdir.c
index 3c4b546e37..38a696eeef 100644
--- a/src/mkdir.c
+++ b/src/mkdir.c
@@ -39,12 +39,12 @@
static struct option const longopts[] =
{
{GETOPT_SELINUX_CONTEXT_OPTION_DECL},
- {"mode", required_argument, nullptr, 'm'},
- {"parents", no_argument, nullptr, 'p'},
- {"verbose", no_argument, nullptr, 'v'},
+ {"mode", required_argument, NULL, 'm'},
+ {"parents", no_argument, NULL, 'p'},
+ {"verbose", no_argument, NULL, 'v'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
void
@@ -83,7 +83,7 @@ Create the DIRECTORY(ies), if they do not already exist.\n\
/* Options passed to subsidiary functions. */
struct mkdir_options
{
- /* Function to make an ancestor, or nullptr if ancestors should not be
+ /* Function to make an ancestor, or NULL if ancestors should not be
made. */
int (*make_ancestor_function) (char const *, char const *, void *);
@@ -190,16 +190,16 @@ process_dir (char *dir, struct savewd *wd, void *options)
int
main (int argc, char **argv)
{
- char const *specified_mode = nullptr;
+ char const *specified_mode = NULL;
int optc;
- char const *scontext = nullptr;
+ char const *scontext = NULL;
struct mkdir_options options;
- options.make_ancestor_function = nullptr;
+ options.make_ancestor_function = NULL;
options.mode = S_IRWXUGO;
options.mode_bits = 0;
- options.created_directory_format = nullptr;
- options.set_security_context = nullptr;
+ options.created_directory_format = NULL;
+ options.set_security_context = NULL;
initialize_main (&argc, &argv);
set_program_name (argv[0]);
@@ -209,7 +209,7 @@ main (int argc, char **argv)
atexit (close_stdout);
- while ((optc = getopt_long (argc, argv, "pm:vZ", longopts, nullptr)) != -1)
+ while ((optc = getopt_long (argc, argv, "pm:vZ", longopts, NULL)) != -1)
{
switch (optc)
{
@@ -235,7 +235,7 @@ main (int argc, char **argv)
else
{
options.set_security_context = selabel_open (SELABEL_CTX_FILE,
- nullptr, 0);
+ NULL, 0);
if (! options.set_security_context)
error (0, errno, _("warning: ignoring --context"));
}
diff --git a/src/mkfifo.c b/src/mkfifo.c
index 4c434bc07b..fc97013e6a 100644
--- a/src/mkfifo.c
+++ b/src/mkfifo.c
@@ -36,10 +36,10 @@
static struct option const longopts[] =
{
{GETOPT_SELINUX_CONTEXT_OPTION_DECL},
- {"mode", required_argument, nullptr, 'm'},
+ {"mode", required_argument, NULL, 'm'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
void
@@ -74,9 +74,9 @@ Create named pipes (FIFOs) with the given NAMEs.\n\
int
main (int argc, char **argv)
{
- char const *specified_mode = nullptr;
- char const *scontext = nullptr;
- struct selabel_handle *set_security_context = nullptr;
+ char const *specified_mode = NULL;
+ char const *scontext = NULL;
+ struct selabel_handle *set_security_context = NULL;
initialize_main (&argc, &argv);
set_program_name (argv[0]);
@@ -87,7 +87,7 @@ main (int argc, char **argv)
atexit (close_stdout);
int optc;
- while ((optc = getopt_long (argc, argv, "m:Z", longopts, nullptr)) != -1)
+ while ((optc = getopt_long (argc, argv, "m:Z", longopts, NULL)) != -1)
{
switch (optc)
{
@@ -107,7 +107,7 @@ main (int argc, char **argv)
else
{
set_security_context = selabel_open (SELABEL_CTX_FILE,
- nullptr, 0);
+ NULL, 0);
if (! set_security_context)
error (0, errno, _("warning: ignoring --context"));
}
@@ -154,7 +154,7 @@ main (int argc, char **argv)
error (EXIT_FAILURE, 0, _("invalid mode"));
mode_t umask_value = umask (0);
umask (umask_value);
- newmode = mode_adjust (newmode, false, umask_value, change, nullptr);
+ newmode = mode_adjust (newmode, false, umask_value, change, NULL);
free (change);
if (newmode & ~S_IRWXUGO)
error (EXIT_FAILURE, 0,
diff --git a/src/mknod.c b/src/mknod.c
index 1a175bb6ed..3789300377 100644
--- a/src/mknod.c
+++ b/src/mknod.c
@@ -37,10 +37,10 @@
static struct option const longopts[] =
{
{GETOPT_SELINUX_CONTEXT_OPTION_DECL},
- {"mode", required_argument, nullptr, 'm'},
+ {"mode", required_argument, NULL, 'm'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
void
@@ -90,9 +90,9 @@ otherwise, as decimal. TYPE may be:\n\
int
main (int argc, char **argv)
{
- char const *specified_mode = nullptr;
- char const *scontext = nullptr;
- struct selabel_handle *set_security_context = nullptr;
+ char const *specified_mode = NULL;
+ char const *scontext = NULL;
+ struct selabel_handle *set_security_context = NULL;
initialize_main (&argc, &argv);
set_program_name (argv[0]);
@@ -103,7 +103,7 @@ main (int argc, char **argv)
atexit (close_stdout);
int optc;
- while ((optc = getopt_long (argc, argv, "m:Z", longopts, nullptr)) != -1)
+ while ((optc = getopt_long (argc, argv, "m:Z", longopts, NULL)) != -1)
{
switch (optc)
{
@@ -123,7 +123,7 @@ main (int argc, char **argv)
else
{
set_security_context = selabel_open (SELABEL_CTX_FILE,
- nullptr, 0);
+ NULL, 0);
if (! set_security_context)
error (0, errno, _("warning: ignoring --context"));
}
@@ -150,7 +150,7 @@ main (int argc, char **argv)
error (EXIT_FAILURE, 0, _("invalid mode"));
mode_t umask_value = umask (0);
umask (umask_value);
- newmode = mode_adjust (newmode, false, umask_value, change, nullptr);
+ newmode = mode_adjust (newmode, false, umask_value, change, NULL);
free (change);
if (newmode & ~S_IRWXUGO)
error (EXIT_FAILURE, 0,
@@ -227,14 +227,14 @@ main (int argc, char **argv)
{
char const *s_major = argv[optind + 2];
uintmax_t i_major;
- if (xstrtoumax (s_major, nullptr, 0, &i_major, "") != LONGINT_OK
+ if (xstrtoumax (s_major, NULL, 0, &i_major, "") != LONGINT_OK
|| i_major != (major_t) i_major)
error (EXIT_FAILURE, 0,
_("invalid major device number %s"), quote (s_major));
char const *s_minor = argv[optind + 3];
uintmax_t i_minor;
- if (xstrtoumax (s_minor, nullptr, 0, &i_minor, "") != LONGINT_OK
+ if (xstrtoumax (s_minor, NULL, 0, &i_minor, "") != LONGINT_OK
|| i_minor != (minor_t) i_minor)
error (EXIT_FAILURE, 0,
_("invalid minor device number %s"), quote (s_minor));
diff --git a/src/mktemp.c b/src/mktemp.c
index 698b390ab5..ce8f5dd951 100644
--- a/src/mktemp.c
+++ b/src/mktemp.c
@@ -45,14 +45,14 @@ enum
static struct option const longopts[] =
{
- {"directory", no_argument, nullptr, 'd'},
- {"quiet", no_argument, nullptr, 'q'},
- {"dry-run", no_argument, nullptr, 'u'},
- {"suffix", required_argument, nullptr, SUFFIX_OPTION},
- {"tmpdir", optional_argument, nullptr, 'p'},
+ {"directory", no_argument, NULL, 'd'},
+ {"quiet", no_argument, NULL, 'q'},
+ {"dry-run", no_argument, NULL, 'u'},
+ {"suffix", required_argument, NULL, SUFFIX_OPTION},
+ {"tmpdir", optional_argument, NULL, 'p'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
void
@@ -144,11 +144,11 @@ int
main (int argc, char **argv)
{
char const *dest_dir;
- char const *dest_dir_arg = nullptr;
+ char const *dest_dir_arg = NULL;
bool suppress_file_err = false;
int c;
char *template;
- char *suffix = nullptr;
+ char *suffix = NULL;
bool use_dest_dir = false;
bool deprecated_t_option = false;
bool create_directory = false;
@@ -156,7 +156,7 @@ main (int argc, char **argv)
int status = EXIT_SUCCESS;
size_t x_count;
size_t suffix_len;
- char *dest_name = nullptr;
+ char *dest_name = NULL;
initialize_main (&argc, &argv);
set_program_name (argv[0]);
@@ -166,7 +166,7 @@ main (int argc, char **argv)
atexit (maybe_close_stdout);
- while ((c = getopt_long (argc, argv, "dp:qtuV", longopts, nullptr)) != -1)
+ while ((c = getopt_long (argc, argv, "dp:qtuV", longopts, NULL)) != -1)
{
switch (c)
{
@@ -296,7 +296,7 @@ main (int argc, char **argv)
quote (template));
}
- dest_name = file_name_concat (dest_dir, template, nullptr);
+ dest_name = file_name_concat (dest_dir, template, NULL);
free (template);
template = dest_name;
/* Note that suffix is now invalid. */
diff --git a/src/mv.c b/src/mv.c
index b155790ba1..ec0347692b 100644
--- a/src/mv.c
+++ b/src/mv.c
@@ -55,7 +55,7 @@ enum
static char const *const update_type_string[] =
{
- "all", "none", "none-fail", "older", nullptr
+ "all", "none", "none-fail", "older", NULL
};
static enum Update_type const update_type[] =
{
@@ -65,24 +65,24 @@ ARGMATCH_VERIFY (update_type_string, update_type);
static struct option const long_options[] =
{
- {"backup", optional_argument, nullptr, 'b'},
- {"context", no_argument, nullptr, 'Z'},
- {"debug", no_argument, nullptr, DEBUG_OPTION},
- {"exchange", no_argument, nullptr, EXCHANGE_OPTION},
- {"force", no_argument, nullptr, 'f'},
- {"interactive", no_argument, nullptr, 'i'},
- {"no-clobber", no_argument, nullptr, 'n'}, /* Deprecated. */
- {"no-copy", no_argument, nullptr, NO_COPY_OPTION},
- {"no-target-directory", no_argument, nullptr, 'T'},
- {"strip-trailing-slashes", no_argument, nullptr,
+ {"backup", optional_argument, NULL, 'b'},
+ {"context", no_argument, NULL, 'Z'},
+ {"debug", no_argument, NULL, DEBUG_OPTION},
+ {"exchange", no_argument, NULL, EXCHANGE_OPTION},
+ {"force", no_argument, NULL, 'f'},
+ {"interactive", no_argument, NULL, 'i'},
+ {"no-clobber", no_argument, NULL, 'n'}, /* Deprecated. */
+ {"no-copy", no_argument, NULL, NO_COPY_OPTION},
+ {"no-target-directory", no_argument, NULL, 'T'},
+ {"strip-trailing-slashes", no_argument, NULL,
STRIP_TRAILING_SLASHES_OPTION},
- {"suffix", required_argument, nullptr, 'S'},
- {"target-directory", required_argument, nullptr, 't'},
- {"update", optional_argument, nullptr, 'u'},
- {"verbose", no_argument, nullptr, 'v'},
+ {"suffix", required_argument, NULL, 'S'},
+ {"target-directory", required_argument, NULL, 't'},
+ {"update", optional_argument, NULL, 'u'},
+ {"verbose", no_argument, NULL, 'v'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
static void
@@ -109,7 +109,7 @@ rm_option_init (struct rm_options *x)
{
static struct dev_ino dev_ino_buf;
x->root_dev_ino = get_root_dev_ino (&dev_ino_buf);
- if (x->root_dev_ino == nullptr)
+ if (x->root_dev_ino == NULL)
error (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
quoteaf ("/"));
}
@@ -139,7 +139,7 @@ cp_option_init (struct cp_options *x)
x->preserve_timestamps = true;
x->explicit_no_preserve_mode= false;
x->preserve_security_context = selinux_enabled;
- x->set_security_context = nullptr;
+ x->set_security_context = NULL;
x->reduce_diagnostics = false;
x->data_copy_required = true;
x->require_preserve = false; /* FIXME: maybe make this an option */
@@ -156,8 +156,8 @@ cp_option_init (struct cp_options *x)
x->open_dangling_dest_symlink = false;
x->update = UPDATE_ALL;
x->verbose = false;
- x->dest_info = nullptr;
- x->src_info = nullptr;
+ x->dest_info = NULL;
+ x->src_info = NULL;
}
/* Move SOURCE onto DEST aka DEST_DIRFD+DEST_RELNAME.
@@ -190,14 +190,14 @@ do_move (char const *source, char const *dest,
copied-into-self directory, DEST ('b/b' in the example),
and failing. */
- dir_to_remove = nullptr;
+ dir_to_remove = NULL;
ok = false;
}
else if (rename_succeeded)
{
/* No need to remove anything. SOURCE was successfully
renamed to DEST. Or the user declined to rename a file. */
- dir_to_remove = nullptr;
+ dir_to_remove = NULL;
}
else
{
@@ -226,12 +226,12 @@ do_move (char const *source, char const *dest,
dir_to_remove = source;
}
- if (dir_to_remove != nullptr)
+ if (dir_to_remove != NULL)
{
struct rm_options rm_options;
rm_option_init (&rm_options);
rm_options.verbose = x->verbose;
- char const *dir[2] = { dir_to_remove, nullptr };
+ char const *dir[2] = { dir_to_remove, NULL };
enum RM_status status = rm ((void *) dir, &rm_options);
affirm (VALID_STATUS (status));
@@ -312,11 +312,11 @@ int
main (int argc, char **argv)
{
bool make_backups = false;
- char const *backup_suffix = nullptr;
- char *version_control_string = nullptr;
+ char const *backup_suffix = NULL;
+ char *version_control_string = NULL;
struct cp_options x;
bool remove_trailing_slashes = false;
- char const *target_directory = nullptr;
+ char const *target_directory = NULL;
bool no_target_directory = false;
bool selinux_enabled = (0 < is_selinux_enabled ());
@@ -334,7 +334,7 @@ main (int argc, char **argv)
priv_set_remove_linkdir ();
int c;
- while ((c = getopt_long (argc, argv, "bfint:uvS:TZ", long_options, nullptr))
+ while ((c = getopt_long (argc, argv, "bfint:uvS:TZ", long_options, NULL))
!= -1)
{
switch (c)
@@ -393,7 +393,7 @@ main (int argc, char **argv)
{
x.preserve_security_context = false;
x.set_security_context = selabel_open (SELABEL_CTX_FILE,
- nullptr, 0);
+ NULL, 0);
if (! x.set_security_context)
error (0, errno, _("warning: ignoring --context"));
}
diff --git a/src/nice.c b/src/nice.c
index 130eacce0b..4b4b853619 100644
--- a/src/nice.c
+++ b/src/nice.c
@@ -56,10 +56,10 @@
static struct option const longopts[] =
{
- {"adjustment", required_argument, nullptr, 'n'},
+ {"adjustment", required_argument, NULL, 'n'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
void
@@ -102,7 +102,7 @@ main (int argc, char **argv)
{
int current_niceness;
int adjustment = 10;
- char const *adjustment_given = nullptr;
+ char const *adjustment_given = NULL;
bool ok;
int i;
@@ -136,7 +136,7 @@ main (int argc, char **argv)
/* Initialize getopt_long's internal state. */
optind = 0;
- c = getopt_long (fake_argc, fake_argv, "+n:", longopts, nullptr);
+ c = getopt_long (fake_argc, fake_argv, "+n:", longopts, NULL);
i += optind - 1;
switch (c)
@@ -176,7 +176,7 @@ main (int argc, char **argv)
enum { MIN_ADJUSTMENT = 1 - 2 * NZERO, MAX_ADJUSTMENT = 2 * NZERO - 1 };
#endif
long int tmp;
- if (LONGINT_OVERFLOW < xstrtol (adjustment_given, nullptr, 10, &tmp, ""))
+ if (LONGINT_OVERFLOW < xstrtol (adjustment_given, NULL, 10, &tmp, ""))
error (EXIT_CANCELED, 0, _("invalid adjustment %s"),
quote (adjustment_given));
#if (defined __gnu_hurd__ \
diff --git a/src/nl.c b/src/nl.c
index 5044d85dfc..43967a90a1 100644
--- a/src/nl.c
+++ b/src/nl.c
@@ -88,7 +88,7 @@ static char header_fastmap[UCHAR_MAX + 1];
static char footer_fastmap[UCHAR_MAX + 1];
/* Pointer to current regex, if any. */
-static struct re_pattern_buffer *current_regex = nullptr;
+static struct re_pattern_buffer *current_regex = NULL;
/* Separator string to print after line number (-s). */
static char const *separator_str = "\t";
@@ -97,19 +97,19 @@ static char const *separator_str = "\t";
static char *section_del = DEFAULT_SECTION_DELIMITERS;
/* Header delimiter string. */
-static char *header_del = nullptr;
+static char *header_del = NULL;
/* Header section delimiter length. */
static size_t header_del_len;
/* Body delimiter string. */
-static char *body_del = nullptr;
+static char *body_del = NULL;
/* Body section delimiter length. */
static size_t body_del_len;
/* Footer delimiter string. */
-static char *footer_del = nullptr;
+static char *footer_del = NULL;
/* Footer section delimiter length. */
static size_t footer_del_len;
@@ -118,7 +118,7 @@ static size_t footer_del_len;
static struct linebuffer line_buf;
/* printf format string for unnumbered lines. */
-static char *print_no_line_fmt = nullptr;
+static char *print_no_line_fmt = NULL;
/* Starting line number on each page (-v). */
static intmax_t starting_line_number = 1;
@@ -149,20 +149,20 @@ static bool have_read_stdin;
static struct option const longopts[] =
{
- {"header-numbering", required_argument, nullptr, 'h'},
- {"body-numbering", required_argument, nullptr, 'b'},
- {"footer-numbering", required_argument, nullptr, 'f'},
- {"starting-line-number", required_argument, nullptr, 'v'},
- {"line-increment", required_argument, nullptr, 'i'},
- {"no-renumber", no_argument, nullptr, 'p'},
- {"join-blank-lines", required_argument, nullptr, 'l'},
- {"number-separator", required_argument, nullptr, 's'},
- {"number-width", required_argument, nullptr, 'w'},
- {"number-format", required_argument, nullptr, 'n'},
- {"section-delimiter", required_argument, nullptr, 'd'},
+ {"header-numbering", required_argument, NULL, 'h'},
+ {"body-numbering", required_argument, NULL, 'b'},
+ {"footer-numbering", required_argument, NULL, 'f'},
+ {"starting-line-number", required_argument, NULL, 'v'},
+ {"line-increment", required_argument, NULL, 'i'},
+ {"no-renumber", no_argument, NULL, 'p'},
+ {"join-blank-lines", required_argument, NULL, 'l'},
+ {"number-separator", required_argument, NULL, 's'},
+ {"number-width", required_argument, NULL, 'w'},
+ {"number-format", required_argument, NULL, 'n'},
+ {"section-delimiter", required_argument, NULL, 'd'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
/* Print a usage message and quit. */
@@ -256,10 +256,10 @@ build_type_arg (char const **typep,
break;
case 'p':
*typep = optarg++;
- regexp->buffer = nullptr;
+ regexp->buffer = NULL;
regexp->allocated = 0;
regexp->fastmap = fastmap;
- regexp->translate = nullptr;
+ regexp->translate = NULL;
re_syntax_options =
RE_SYNTAX_POSIX_BASIC & ~RE_CONTEXT_INVALID_DUP & ~RE_NO_EMPTY_RANGES;
errmsg = re_compile_pattern (optarg, strlen (optarg), regexp);
@@ -364,7 +364,7 @@ proc_text (void)
break;
case 'p':
switch (re_search (current_regex, line_buf.buffer, line_buf.length - 1,
- 0, line_buf.length - 1, nullptr))
+ 0, line_buf.length - 1, NULL))
{
case -2:
error (EXIT_FAILURE, errno, _("error in regular expression search"));
@@ -448,7 +448,7 @@ nl_file (char const *file)
else
{
stream = fopen (file, "r");
- if (stream == nullptr)
+ if (stream == NULL)
{
error (0, errno, "%s", quotef (file));
return false;
@@ -492,7 +492,7 @@ main (int argc, char **argv)
have_read_stdin = false;
while ((c = getopt_long (argc, argv, "h:b:f:v:i:pl:s:w:n:d:", longopts,
- nullptr))
+ NULL))
!= -1)
{
switch (c)
diff --git a/src/nohup.c b/src/nohup.c
index a84ef97d7b..666c67ff2c 100644
--- a/src/nohup.c
+++ b/src/nohup.c
@@ -98,7 +98,7 @@ main (int argc, char **argv)
parse_gnu_standard_options_only (argc, argv, PROGRAM_NAME, PACKAGE_NAME,
Version, false, usage, AUTHORS,
- (char const *) nullptr);
+ (char const *) NULL);
if (argc <= optind)
{
@@ -130,7 +130,7 @@ main (int argc, char **argv)
int out_fd = STDOUT_FILENO;
if (redirecting_stdout || (redirecting_stderr && stdout_is_closed))
{
- char *in_home = nullptr;
+ char *in_home = NULL;
char const *file = "nohup.out";
int flags = O_CREAT | O_WRONLY | O_APPEND;
mode_t mode = S_IRUSR | S_IWUSR;
@@ -145,7 +145,7 @@ main (int argc, char **argv)
char const *home = getenv ("HOME");
if (home)
{
- in_home = file_name_concat (home, file, nullptr);
+ in_home = file_name_concat (home, file, NULL);
out_fd = (redirecting_stdout
? fd_reopen (STDOUT_FILENO, in_home, flags, mode)
: open (in_home, flags, mode));
diff --git a/src/nproc.c b/src/nproc.c
index 2c28826761..68e9dc6e45 100644
--- a/src/nproc.c
+++ b/src/nproc.c
@@ -39,11 +39,11 @@ enum
static struct option const longopts[] =
{
- {"all", no_argument, nullptr, ALL_OPTION},
- {"ignore", required_argument, nullptr, IGNORE_OPTION},
+ {"all", no_argument, NULL, ALL_OPTION},
+ {"ignore", required_argument, NULL, IGNORE_OPTION},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
void
@@ -87,7 +87,7 @@ main (int argc, char **argv)
while (true)
{
- int c = getopt_long (argc, argv, "", longopts, nullptr);
+ int c = getopt_long (argc, argv, "", longopts, NULL);
if (c == -1)
break;
switch (c)
diff --git a/src/numfmt.c b/src/numfmt.c
index 5aebf57a4d..ac5cd9b7b0 100644
--- a/src/numfmt.c
+++ b/src/numfmt.c
@@ -75,7 +75,7 @@ enum scale_type
static char const *const scale_from_args[] =
{
- "none", "auto", "si", "iec", "iec-i", nullptr
+ "none", "auto", "si", "iec", "iec-i", NULL
};
static enum scale_type const scale_from_types[] =
@@ -85,7 +85,7 @@ static enum scale_type const scale_from_types[] =
static char const *const scale_to_args[] =
{
- "none", "si", "iec", "iec-i", nullptr
+ "none", "si", "iec", "iec-i", NULL
};
static enum scale_type const scale_to_types[] =
@@ -105,7 +105,7 @@ enum round_type
static char const *const round_args[] =
{
- "up", "down", "from-zero", "towards-zero", "nearest", nullptr
+ "up", "down", "from-zero", "towards-zero", "nearest", NULL
};
static enum round_type const round_types[] =
@@ -124,7 +124,7 @@ enum inval_type
static char const *const inval_args[] =
{
- "abort", "fail", "warn", "ignore", nullptr
+ "abort", "fail", "warn", "ignore", NULL
};
static enum inval_type const inval_types[] =
@@ -134,26 +134,26 @@ static enum inval_type const inval_types[] =
static struct option const longopts[] =
{
- {"from", required_argument, nullptr, FROM_OPTION},
- {"from-unit", required_argument, nullptr, FROM_UNIT_OPTION},
- {"to", required_argument, nullptr, TO_OPTION},
- {"to-unit", required_argument, nullptr, TO_UNIT_OPTION},
- {"round", required_argument, nullptr, ROUND_OPTION},
- {"padding", required_argument, nullptr, PADDING_OPTION},
- {"suffix", required_argument, nullptr, SUFFIX_OPTION},
- {"unit-separator", required_argument, nullptr, UNIT_SEPARATOR_OPTION},
- {"grouping", no_argument, nullptr, GROUPING_OPTION},
- {"delimiter", required_argument, nullptr, 'd'},
- {"field", required_argument, nullptr, FIELD_OPTION},
- {"debug", no_argument, nullptr, DEBUG_OPTION},
- {"-debug", no_argument, nullptr, DEV_DEBUG_OPTION},
- {"header", optional_argument, nullptr, HEADER_OPTION},
- {"format", required_argument, nullptr, FORMAT_OPTION},
- {"invalid", required_argument, nullptr, INVALID_OPTION},
- {"zero-terminated", no_argument, nullptr, 'z'},
+ {"from", required_argument, NULL, FROM_OPTION},
+ {"from-unit", required_argument, NULL, FROM_UNIT_OPTION},
+ {"to", required_argument, NULL, TO_OPTION},
+ {"to-unit", required_argument, NULL, TO_UNIT_OPTION},
+ {"round", required_argument, NULL, ROUND_OPTION},
+ {"padding", required_argument, NULL, PADDING_OPTION},
+ {"suffix", required_argument, NULL, SUFFIX_OPTION},
+ {"unit-separator", required_argument, NULL, UNIT_SEPARATOR_OPTION},
+ {"grouping", no_argument, NULL, GROUPING_OPTION},
+ {"delimiter", required_argument, NULL, 'd'},
+ {"field", required_argument, NULL, FIELD_OPTION},
+ {"debug", no_argument, NULL, DEBUG_OPTION},
+ {"-debug", no_argument, NULL, DEV_DEBUG_OPTION},
+ {"header", optional_argument, NULL, HEADER_OPTION},
+ {"format", required_argument, NULL, FORMAT_OPTION},
+ {"invalid", required_argument, NULL, INVALID_OPTION},
+ {"zero-terminated", no_argument, NULL, 'z'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
/* Maximum number of digits we can safely handle
@@ -170,19 +170,19 @@ static enum scale_type scale_from = scale_none;
static enum scale_type scale_to = scale_none;
static enum round_type round_style = round_from_zero;
static enum inval_type inval_style = inval_abort;
-static char const *suffix = nullptr;
-static char const *unit_separator = nullptr;
+static char const *suffix = NULL;
+static char const *unit_separator = NULL;
static uintmax_t from_unit_size = 1;
static uintmax_t to_unit_size = 1;
static int grouping = 0;
-static char *padding_buffer = nullptr;
+static char *padding_buffer = NULL;
static idx_t padding_buffer_size = 0;
static intmax_t padding_width = 0;
static int zero_padding_width = 0;
static long int user_precision = -1;
-static char const *format_str = nullptr;
-static char *format_str_prefix = nullptr;
-static char *format_str_suffix = nullptr;
+static char const *format_str = NULL;
+static char *format_str_prefix = NULL;
+static char *format_str_suffix = NULL;
/* By default, any conversion error will terminate the program. */
static int conv_exit_code = EXIT_CONVERSION_WARNINGS;
@@ -191,8 +191,8 @@ static int conv_exit_code = EXIT_CONVERSION_WARNINGS;
/* auto-pad each line based on skipped whitespace. */
static int auto_padding = 0;
-/* field delimiter - if nullptr, blanks separate fields. */
-static char const *delimiter = nullptr;
+/* field delimiter - if NULL, blanks separate fields. */
+static char const *delimiter = NULL;
/* line delimiter. */
static unsigned char line_delim = '\n';
@@ -243,7 +243,7 @@ static char const *valid_suffixes = 1 + zero_and_valid_suffixes;
static inline bool
valid_suffix (const char suf)
{
- return strchr (valid_suffixes, suf) != nullptr;
+ return strchr (valid_suffixes, suf) != NULL;
}
static inline int
@@ -738,7 +738,7 @@ simple_strtod_human (char const *input_str,
static void
simple_strtod_fatal (enum simple_strtod_error err, char const *input_str)
{
- char const *msgid = nullptr;
+ char const *msgid = NULL;
switch (err)
{
@@ -871,9 +871,9 @@ unit_to_umax (char const *n_string)
{
strtol_error s_err;
char const *c_string = n_string;
- char *t_string = nullptr;
+ char *t_string = NULL;
size_t n_len = strlen (n_string);
- char *end = nullptr;
+ char *end = NULL;
uintmax_t n;
char const *suffixes = valid_suffixes;
@@ -1087,7 +1087,7 @@ parse_format_string (char const *fmt)
size_t i;
size_t prefix_len = 0;
size_t suffix_pos;
- char *endptr = nullptr;
+ char *endptr = NULL;
bool zero_padding = false;
for (i = 0; !(fmt[i] == '%' && fmt[i + 1] != '%'); i += (fmt[i] == '%') + 1)
@@ -1199,7 +1199,7 @@ static enum simple_strtod_error
parse_human_number (char const *str, long double /*output */ *value,
size_t *precision)
{
- char *ptr = nullptr;
+ char *ptr = NULL;
enum simple_strtod_error e =
simple_strtod_human (str, &ptr, value, precision, scale_from);
@@ -1389,7 +1389,7 @@ is_utf8_charset (void)
}
/* Search for multi-byte character C in multi-byte string S.
- Return a pointer to the character, or nullptr if not found. */
+ Return a pointer to the character, or NULL if not found. */
ATTRIBUTE_PURE
static char *
mbsmbchr (char const* s, char const* c)
@@ -1496,7 +1496,7 @@ process_line (char *line, bool newline)
if (! process_field (next, field))
valid_number = false;
- if (delimiter != nullptr)
+ if (delimiter != NULL)
fputs (delimiter, stdout);
else
fputc (' ', stdout);
@@ -1547,12 +1547,12 @@ main (int argc, char **argv)
#endif
decimal_point = nl_langinfo (RADIXCHAR);
- if (decimal_point == nullptr || strlen (decimal_point) == 0)
+ if (decimal_point == NULL || strlen (decimal_point) == 0)
decimal_point = ".";
decimal_point_length = strlen (decimal_point);
thousands_sep = nl_langinfo (THOUSEP);
- if (thousands_sep == nullptr)
+ if (thousands_sep == NULL)
thousands_sep = "";
thousands_sep_length = strlen (thousands_sep);
@@ -1560,7 +1560,7 @@ main (int argc, char **argv)
while (true)
{
- int c = getopt_long (argc, argv, "d:z", longopts, nullptr);
+ int c = getopt_long (argc, argv, "d:z", longopts, NULL);
if (c == -1)
break;
@@ -1594,7 +1594,7 @@ main (int argc, char **argv)
break;
case PADDING_OPTION:
- if (((xstrtoimax (optarg, nullptr, 10, &padding_width, "")
+ if (((xstrtoimax (optarg, NULL, 10, &padding_width, "")
& ~LONGINT_OVERFLOW)
!= LONGINT_OK)
|| padding_width == 0)
@@ -1649,7 +1649,7 @@ main (int argc, char **argv)
case HEADER_OPTION:
if (optarg)
{
- if (xstrtoumax (optarg, nullptr, 10, &header, "") != LONGINT_OK
+ if (xstrtoumax (optarg, NULL, 10, &header, "") != LONGINT_OK
|| header == 0)
error (EXIT_FAILURE, 0, _("invalid header value %s"),
quote (optarg));
@@ -1677,7 +1677,7 @@ main (int argc, char **argv)
}
}
- if (format_str != nullptr && grouping)
+ if (format_str != NULL && grouping)
error (EXIT_FAILURE, 0, _("--grouping cannot be combined with --format"));
if (debug && ! locale_ok)
@@ -1685,10 +1685,10 @@ main (int argc, char **argv)
/* Warn about no-op. */
if (debug && scale_from == scale_none && scale_to == scale_none
- && !grouping && (padding_width == 0) && (format_str == nullptr))
+ && !grouping && (padding_width == 0) && (format_str == NULL))
error (0, 0, _("no conversion option specified"));
- if (debug && unit_separator && delimiter == nullptr)
+ if (debug && unit_separator && delimiter == NULL)
error (0, 0,
_("field delimiters have higher precedence than unit separators"));
@@ -1703,7 +1703,7 @@ main (int argc, char **argv)
error (0, 0, _("grouping has no effect in this locale"));
}
- auto_padding = (padding_width == 0 && delimiter == nullptr);
+ auto_padding = (padding_width == 0 && delimiter == NULL);
if (inval_style != inval_abort)
conv_exit_code = 0;
@@ -1718,7 +1718,7 @@ main (int argc, char **argv)
}
else
{
- char *line = nullptr;
+ char *line = NULL;
size_t line_allocated = 0;
ssize_t len;
diff --git a/src/od.c b/src/od.c
index 107e4d3b5f..c421bd6da6 100644
--- a/src/od.c
+++ b/src/od.c
@@ -249,7 +249,7 @@ static char const *const *file_list;
/* Initializer for file_list if no file-arguments
were specified on the command line. */
-static char const *const default_file_list[] = {"-", nullptr};
+static char const *const default_file_list[] = {"-", NULL};
/* The input stream associated with the current file. */
static FILE *in_stream;
@@ -323,7 +323,7 @@ enum endian_type
static char const *const endian_args[] =
{
- "little", "big", nullptr
+ "little", "big", NULL
};
static enum endian_type const endian_types[] =
@@ -333,19 +333,19 @@ static enum endian_type const endian_types[] =
static struct option const long_options[] =
{
- {"skip-bytes", required_argument, nullptr, 'j'},
- {"address-radix", required_argument, nullptr, 'A'},
- {"read-bytes", required_argument, nullptr, 'N'},
- {"format", required_argument, nullptr, 't'},
- {"output-duplicates", no_argument, nullptr, 'v'},
- {"strings", optional_argument, nullptr, 'S'},
- {"traditional", no_argument, nullptr, TRADITIONAL_OPTION},
- {"width", optional_argument, nullptr, 'w'},
- {"endian", required_argument, nullptr, ENDIAN_OPTION },
+ {"skip-bytes", required_argument, NULL, 'j'},
+ {"address-radix", required_argument, NULL, 'A'},
+ {"read-bytes", required_argument, NULL, 'N'},
+ {"format", required_argument, NULL, 't'},
+ {"output-duplicates", no_argument, NULL, 'v'},
+ {"strings", optional_argument, NULL, 'S'},
+ {"traditional", no_argument, NULL, TRADITIONAL_OPTION},
+ {"width", optional_argument, NULL, 'w'},
+ {"endian", required_argument, NULL, ENDIAN_OPTION },
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
void
@@ -825,7 +825,7 @@ decode_one_format (char const *s_orig, char const *s, char const **next,
? print_intmax
: LONG < LONG_LONG && LONG_LONG < INTMAX && size_spec == LONG_LONG
? print_long_long
- : (affirm (false), (print_function_type) nullptr));
+ : (affirm (false), (print_function_type) NULL));
break;
case 'f':
@@ -983,7 +983,7 @@ open_next_file (void)
do
{
input_filename = *file_list;
- if (input_filename == nullptr)
+ if (input_filename == NULL)
return ok;
++file_list;
@@ -997,17 +997,17 @@ open_next_file (void)
else
{
in_stream = fopen (input_filename, (O_BINARY ? "rb" : "r"));
- if (in_stream == nullptr)
+ if (in_stream == NULL)
{
error (0, errno, "%s", quotef (input_filename));
ok = false;
}
}
}
- while (in_stream == nullptr);
+ while (in_stream == NULL);
if (0 <= end_offset && !flag_dump_strings)
- setvbuf (in_stream, nullptr, _IONBF, 0);
+ setvbuf (in_stream, NULL, _IONBF, 0);
return ok;
}
@@ -1024,7 +1024,7 @@ check_and_close (int in_errno)
{
bool ok = true;
- if (in_stream != nullptr)
+ if (in_stream != NULL)
{
if (!ferror (in_stream))
in_errno = 0;
@@ -1038,7 +1038,7 @@ check_and_close (int in_errno)
ok = false;
}
- in_stream = nullptr;
+ in_stream = NULL;
}
if (ferror (stdout))
@@ -1093,7 +1093,7 @@ skip (intmax_t n_skip)
if (n_skip == 0)
return true;
- while (in_stream != nullptr) /* EOF. */
+ while (in_stream != NULL) /* EOF. */
{
struct stat file_stats;
@@ -1370,7 +1370,7 @@ read_block (idx_t n, char *block, idx_t *n_bytes_in_buffer)
*n_bytes_in_buffer = 0;
- while (in_stream != nullptr) /* EOF. */
+ while (in_stream != NULL) /* EOF. */
{
idx_t n_needed = n - *n_bytes_in_buffer;
idx_t n_read = fread (block + *n_bytes_in_buffer,
@@ -1403,14 +1403,14 @@ get_lcm (void)
return l_c_m;
}
-/* Act like xstrtoimax (NPTR, nullptr, BASE, VAL, VALID_SUFFIXES),
+/* Act like xstrtoimax (NPTR, NULL, BASE, VAL, VALID_SUFFIXES),
except reject negative values, and *VAL may be set if
LONGINT_INVALID is returned. */
static strtol_error
xstr2nonneg (char const *restrict nptr, int base, intmax_t *val,
char const *restrict valid_suffixes)
{
- strtol_error s_err = xstrtoimax (nptr, nullptr, base, val, valid_suffixes);
+ strtol_error s_err = xstrtoimax (nptr, NULL, base, val, valid_suffixes);
return s_err != LONGINT_INVALID && *val < 0 ? LONGINT_INVALID : s_err;
}
@@ -1435,7 +1435,7 @@ parse_old_offset (char *str, intmax_t *offset)
it's hexadecimal, else octal. */
char *dot = strchr (s, '.');
if (dot && dot[(dot[1] == 'b' || dot[1] == 'B') + 1])
- dot = nullptr;
+ dot = NULL;
int radix = dot ? 10 : s[0] == '0' && (s[1] == 'x' || s[1] == 'X') ? 16 : 8;
if (dot)
@@ -1719,7 +1719,7 @@ main (int argc, char **argv)
case 'S':
modern = true;
- if (optarg == nullptr)
+ if (optarg == NULL)
string_min = 3;
else
{
@@ -1798,7 +1798,7 @@ main (int argc, char **argv)
case 'w':
modern = true;
- if (optarg == nullptr)
+ if (optarg == NULL)
{
desired_width = 32;
}
@@ -1950,12 +1950,12 @@ main (int argc, char **argv)
/* open the first input file */
ok = open_next_file ();
- if (in_stream == nullptr)
+ if (in_stream == NULL)
goto cleanup;
/* skip over any unwanted header bytes */
ok &= skip (n_bytes_to_skip);
- if (in_stream == nullptr)
+ if (in_stream == NULL)
goto cleanup;
pseudo_offset = (flag_pseudo_start ? pseudo_start - n_bytes_to_skip : 0);
diff --git a/src/paste.c b/src/paste.c
index 5309f0e370..8e433be102 100644
--- a/src/paste.c
+++ b/src/paste.c
@@ -73,12 +73,12 @@ static unsigned char line_delim = '\n';
static struct option const longopts[] =
{
- {"serial", no_argument, nullptr, 's'},
- {"delimiters", required_argument, nullptr, 'd'},
- {"zero-terminated", no_argument, nullptr, 'z'},
+ {"serial", no_argument, NULL, 's'},
+ {"delimiters", required_argument, NULL, 'd'},
+ {"zero-terminated", no_argument, NULL, 'z'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
/* Set globals delims, delim_lens, and num_delims.
@@ -215,7 +215,7 @@ paste_parallel (size_t nfiles, char **fnamptr)
else
{
fileptr[files_open] = fopen (fnamptr[files_open], "r");
- if (fileptr[files_open] == nullptr)
+ if (fileptr[files_open] == NULL)
error (EXIT_FAILURE, errno, "%s", quotef (fnamptr[files_open]));
else if (fileno (fileptr[files_open]) == STDIN_FILENO)
opened_stdin = true;
@@ -284,7 +284,7 @@ paste_parallel (size_t nfiles, char **fnamptr)
ok = false;
}
- fileptr[i] = nullptr;
+ fileptr[i] = NULL;
files_open--;
}
@@ -379,7 +379,7 @@ paste_serial (size_t nfiles, char **fnamptr)
else
{
fileptr = fopen (*fnamptr, "r");
- if (fileptr == nullptr)
+ if (fileptr == NULL)
{
error (0, errno, "%s", quotef (*fnamptr));
ok = false;
@@ -504,7 +504,7 @@ main (int argc, char **argv)
have_read_stdin = false;
serial_merge = false;
- while ((optc = getopt_long (argc, argv, "d:sz", longopts, nullptr)) != -1)
+ while ((optc = getopt_long (argc, argv, "d:sz", longopts, NULL)) != -1)
{
switch (optc)
{
diff --git a/src/pathchk.c b/src/pathchk.c
index d27d9f35c8..f9a60fe669 100644
--- a/src/pathchk.c
+++ b/src/pathchk.c
@@ -71,10 +71,10 @@ enum
static struct option const longopts[] =
{
- {"portability", no_argument, nullptr, PORTABILITY_OPTION},
+ {"portability", no_argument, NULL, PORTABILITY_OPTION},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
void
@@ -115,7 +115,7 @@ main (int argc, char **argv)
atexit (close_stdout);
- while ((optc = getopt_long (argc, argv, "+pP", longopts, nullptr)) != -1)
+ while ((optc = getopt_long (argc, argv, "+pP", longopts, NULL)) != -1)
{
switch (optc)
{
diff --git a/src/pinky.c b/src/pinky.c
index 64a7744cc0..887b32fc41 100644
--- a/src/pinky.c
+++ b/src/pinky.c
@@ -86,10 +86,10 @@ enum
static struct option const longopts[] =
{
- {"lookup", no_argument, nullptr, LOOKUP_OPTION},
+ {"lookup", no_argument, NULL, LOOKUP_OPTION},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
/* Count and return the number of ampersands in STR. */
@@ -246,7 +246,7 @@ print_entry (STRUCT_UTMP const *utmp_ent)
if (include_fullname)
{
struct passwd *pw = getpwnam (ut_user);
- if (pw == nullptr)
+ if (pw == NULL)
/* TRANSLATORS: Real name is unknown; at most 19 characters. */
printf (" %19s", _(" ???"));
else
@@ -284,8 +284,8 @@ print_entry (STRUCT_UTMP const *utmp_ent)
#ifdef HAVE_STRUCT_XTMP_UT_HOST
if (include_where && utmp_ent->ut_host[0])
{
- char *host = nullptr;
- char *display = nullptr;
+ char *host = NULL;
+ char *display = NULL;
char *ut_host = utmp_ent->ut_host;
/* Look for an X display. */
@@ -323,7 +323,7 @@ print_entry (STRUCT_UTMP const *utmp_ent)
static void
cat_file (char const *header, char const *home, char const *file)
{
- char *full_name = file_name_concat (home, file, nullptr);
+ char *full_name = file_name_concat (home, file, NULL);
int fd = open (full_name, O_RDONLY);
if (0 <= fd)
@@ -358,7 +358,7 @@ print_long_entry (const char name[])
printf ("%-28s", name);
printf (_("In real life: "));
- if (pw == nullptr)
+ if (pw == NULL)
{
/* TRANSLATORS: Real name is unknown; no hard limit. */
printf (" %s", _("???\n"));
@@ -534,7 +534,7 @@ main (int argc, char **argv)
atexit (close_stdout);
- while ((optc = getopt_long (argc, argv, "sfwiqbhlp", longopts, nullptr))
+ while ((optc = getopt_long (argc, argv, "sfwiqbhlp", longopts, NULL))
!= -1)
{
switch (optc)
diff --git a/src/pr.c b/src/pr.c
index 24f69a3692..5dfc58adba 100644
--- a/src/pr.c
+++ b/src/pr.c
@@ -742,33 +742,33 @@ static char const short_options[] =
static struct option const long_options[] =
{
- {"pages", required_argument, nullptr, PAGES_OPTION},
- {"columns", required_argument, nullptr, COLUMNS_OPTION},
- {"across", no_argument, nullptr, 'a'},
- {"show-control-chars", no_argument, nullptr, 'c'},
- {"double-space", no_argument, nullptr, 'd'},
- {"date-format", required_argument, nullptr, 'D'},
- {"expand-tabs", optional_argument, nullptr, 'e'},
- {"form-feed", no_argument, nullptr, 'f'},
- {"header", required_argument, nullptr, 'h'},
- {"output-tabs", optional_argument, nullptr, 'i'},
- {"join-lines", no_argument, nullptr, 'J'},
- {"length", required_argument, nullptr, 'l'},
- {"merge", no_argument, nullptr, 'm'},
- {"number-lines", optional_argument, nullptr, 'n'},
- {"first-line-number", required_argument, nullptr, 'N'},
- {"indent", required_argument, nullptr, 'o'},
- {"no-file-warnings", no_argument, nullptr, 'r'},
- {"separator", optional_argument, nullptr, 's'},
- {"sep-string", optional_argument, nullptr, 'S'},
- {"omit-header", no_argument, nullptr, 't'},
- {"omit-pagination", no_argument, nullptr, 'T'},
- {"show-nonprinting", no_argument, nullptr, 'v'},
- {"width", required_argument, nullptr, 'w'},
- {"page-width", required_argument, nullptr, 'W'},
+ {"pages", required_argument, NULL, PAGES_OPTION},
+ {"columns", required_argument, NULL, COLUMNS_OPTION},
+ {"across", no_argument, NULL, 'a'},
+ {"show-control-chars", no_argument, NULL, 'c'},
+ {"double-space", no_argument, NULL, 'd'},
+ {"date-format", required_argument, NULL, 'D'},
+ {"expand-tabs", optional_argument, NULL, 'e'},
+ {"form-feed", no_argument, NULL, 'f'},
+ {"header", required_argument, NULL, 'h'},
+ {"output-tabs", optional_argument, NULL, 'i'},
+ {"join-lines", no_argument, NULL, 'J'},
+ {"length", required_argument, NULL, 'l'},
+ {"merge", no_argument, NULL, 'm'},
+ {"number-lines", optional_argument, NULL, 'n'},
+ {"first-line-number", required_argument, NULL, 'N'},
+ {"indent", required_argument, NULL, 'o'},
+ {"no-file-warnings", no_argument, NULL, 'r'},
+ {"separator", optional_argument, NULL, 's'},
+ {"sep-string", optional_argument, NULL, 'S'},
+ {"omit-header", no_argument, NULL, 't'},
+ {"omit-pagination", no_argument, NULL, 'T'},
+ {"show-nonprinting", no_argument, NULL, 'v'},
+ {"width", required_argument, NULL, 'w'},
+ {"page-width", required_argument, NULL, 'W'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
static _Noreturn void
@@ -864,7 +864,7 @@ main (int argc, char **argv)
char **file_names;
/* Accumulate the digits of old-style options like -99. */
- char *column_count_string = nullptr;
+ char *column_count_string = NULL;
idx_t n_digits = 0;
idx_t n_alloc = 0;
@@ -879,7 +879,7 @@ main (int argc, char **argv)
n_files = 0;
file_names = (argc > 1
? xnmalloc (argc - 1, sizeof (char *))
- : nullptr);
+ : NULL);
while (true)
{
@@ -929,7 +929,7 @@ main (int argc, char **argv)
short-named option syntax, e.g., -9, ensure that this
long-name-specified value overrides it. */
free (column_count_string);
- column_count_string = nullptr;
+ column_count_string = NULL;
n_alloc = 0;
break;
}
@@ -1132,7 +1132,7 @@ main (int argc, char **argv)
if (n_files == 0)
{
/* No file arguments specified; read from standard input. */
- print_files (0, nullptr);
+ print_files (0, NULL);
}
else
{
@@ -1181,7 +1181,7 @@ getoptarg (char *arg, char switch_char, char *character, int *number)
if (*arg)
{
long int tmp_long;
- strtol_error e = xstrtol (arg, nullptr, 10, &tmp_long, "");
+ strtol_error e = xstrtol (arg, NULL, 10, &tmp_long, "");
if (e == LONGINT_OK)
{
if (tmp_long <= 0)
@@ -1494,7 +1494,7 @@ open_file (char *name, COLUMN *p)
p->name = name;
p->fp = fopen (name, "r");
}
- if (p->fp == nullptr)
+ if (p->fp == NULL)
{
failed_opens = true;
if (!ignore_failed_opens)
@@ -1647,7 +1647,7 @@ print_files (int number_of_files, char **av)
static void
init_header (char const *filename, int desc)
{
- char *buf = nullptr;
+ char *buf = NULL;
struct stat st;
struct timespec t;
int ns;
@@ -1669,7 +1669,7 @@ init_header (char const *filename, int desc)
ns = t.tv_nsec;
if (localtime_rz (localtz, &t.tv_sec, &tm))
{
- ptrdiff_t len = nstrftime (nullptr, MIN (PTRDIFF_MAX, SIZE_MAX),
+ ptrdiff_t len = nstrftime (NULL, MIN (PTRDIFF_MAX, SIZE_MAX),
date_format, &tm, localtz, ns);
if (0 <= len)
{
diff --git a/src/printenv.c b/src/printenv.c
index 1eadf5a2a2..2f2b54b9e8 100644
--- a/src/printenv.c
+++ b/src/printenv.c
@@ -46,10 +46,10 @@ enum { PRINTENV_FAILURE = 2 };
static struct option const longopts[] =
{
- {"null", no_argument, nullptr, '0'},
+ {"null", no_argument, NULL, '0'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
void
@@ -92,7 +92,7 @@ main (int argc, char **argv)
atexit (close_stdout);
int optc;
- while ((optc = getopt_long (argc, argv, "+iu:0", longopts, nullptr)) != -1)
+ while ((optc = getopt_long (argc, argv, "+iu:0", longopts, NULL)) != -1)
{
switch (optc)
{
@@ -109,7 +109,7 @@ main (int argc, char **argv)
bool ok;
if (optind >= argc)
{
- for (char **env = environ; *env != nullptr; ++env)
+ for (char **env = environ; *env != NULL; ++env)
printf ("%s%c", *env, opt_nul_terminate_output ? '\0' : '\n');
ok = true;
}
diff --git a/src/printf.c b/src/printf.c
index 26f9c294d3..7d261ff02d 100644
--- a/src/printf.c
+++ b/src/printf.c
@@ -669,7 +669,7 @@ print_formatted (char const *format, int argc, char **argv)
print_direc (direc, *ac.f,
have_field_width, field_width,
have_precision, precision,
- ac.curr_arg < argc ? argv[ac.curr_arg] : nullptr);
+ ac.curr_arg < argc ? argv[ac.curr_arg] : NULL);
break;
@@ -702,7 +702,7 @@ main (int argc, char **argv)
exit_status = EXIT_SUCCESS;
- posixly_correct = (getenv ("POSIXLY_CORRECT") != nullptr);
+ posixly_correct = (getenv ("POSIXLY_CORRECT") != NULL);
/* We directly parse options, rather than use parse_long_options, in
order to avoid accepting abbreviations. */
@@ -714,7 +714,7 @@ main (int argc, char **argv)
if (streq (argv[1], "--version"))
{
version_etc (stdout, PROGRAM_NAME, PACKAGE_NAME, Version, AUTHORS,
- (char *) nullptr);
+ (char *) NULL);
return EXIT_SUCCESS;
}
}
diff --git a/src/ptx.c b/src/ptx.c
index 20f61afa39..59e8508a6b 100644
--- a/src/ptx.c
+++ b/src/ptx.c
@@ -81,9 +81,9 @@ static enum Format output_format = UNKNOWN_FORMAT;
/* output format */
static bool ignore_case = false; /* fold lower to upper for sorting */
-static char const *break_file = nullptr; /* name of the 'Break chars' file */
-static char const *only_file = nullptr; /* name of the 'Only words' file */
-static char const *ignore_file = nullptr; /* name of the 'Ignore words' file */
+static char const *break_file = NULL; /* name of the 'Break chars' file */
+static char const *only_file = NULL; /* name of the 'Only words' file */
+static char const *ignore_file = NULL; /* name of the 'Ignore words' file */
/* Options that use regular expressions. */
struct regex_data
@@ -182,7 +182,7 @@ static BLOCK *text_buffers; /* files to study */
{ \
regoff_t count; \
count = re_match (&word_regex.pattern, cursor, limit - cursor, \
- 0, nullptr); \
+ 0, NULL); \
if (count == -2) \
matcher_error (); \
cursor += count == -1 ? 1 : count; \
@@ -397,10 +397,10 @@ compile_regex (struct regex_data *regex)
char const *string = regex->string;
char const *message;
- pattern->buffer = nullptr;
+ pattern->buffer = NULL;
pattern->allocated = 0;
pattern->fastmap = regex->fastmap;
- pattern->translate = ignore_case ? folded_chars : nullptr;
+ pattern->translate = ignore_case ? folded_chars : NULL;
message = re_compile_pattern (string, strlen (string), pattern);
if (message)
@@ -437,7 +437,7 @@ initialize_regex (void)
if (context_regex.string)
{
if (!*context_regex.string)
- context_regex.string = nullptr;
+ context_regex.string = NULL;
}
else if (gnu_extensions && !input_reference)
context_regex.string = "[.?!][]\"')}]*\\($\\|\t\\| \\)[ \t\n]*";
@@ -670,7 +670,7 @@ digest_word_file (char const *file_name, WORD_TABLE *table)
swallow_file_in_memory (file_name, &file_contents);
- table->start = nullptr;
+ table->start = NULL;
table->alloc = 0;
table->length = 0;
@@ -1118,7 +1118,7 @@ fix_output_parameters (void)
if (truncation_string && *truncation_string)
truncation_string_length = strlen (truncation_string);
else
- truncation_string = nullptr;
+ truncation_string = NULL;
if (gnu_extensions)
{
@@ -1333,8 +1333,8 @@ define_all_fields (OCCURS *occurs)
/* No place left for a tail field. */
- tail.start = nullptr;
- tail.end = nullptr;
+ tail.start = NULL;
+ tail.end = NULL;
tail_truncation = false;
}
@@ -1372,8 +1372,8 @@ define_all_fields (OCCURS *occurs)
/* No place left for a head field. */
- head.start = nullptr;
- head.end = nullptr;
+ head.start = NULL;
+ head.end = NULL;
head_truncation = false;
}
@@ -1611,12 +1611,12 @@ generate_all_output (void)
line contexts or references are not used, in which case these variables
would never be computed. */
- tail.start = nullptr;
- tail.end = nullptr;
+ tail.start = NULL;
+ tail.end = NULL;
tail_truncation = false;
- head.start = nullptr;
- head.end = nullptr;
+ head.start = NULL;
+ head.end = NULL;
head_truncation = false;
/* Loop over all keyword occurrences. */
@@ -1731,30 +1731,30 @@ enum
/* Long options equivalences. */
static struct option const long_options[] =
{
- {"auto-reference", no_argument, nullptr, 'A'},
- {"break-file", required_argument, nullptr, 'b'},
- {"flag-truncation", required_argument, nullptr, 'F'},
- {"ignore-case", no_argument, nullptr, 'f'},
- {"gap-size", required_argument, nullptr, 'g'},
- {"ignore-file", required_argument, nullptr, 'i'},
- {"macro-name", required_argument, nullptr, 'M'},
- {"only-file", required_argument, nullptr, 'o'},
- {"references", no_argument, nullptr, 'r'},
- {"right-side-refs", no_argument, nullptr, 'R'},
- {"format", required_argument, nullptr, FORMAT_OPTION},
- {"sentence-regexp", required_argument, nullptr, 'S'},
- {"traditional", no_argument, nullptr, 'G'},
- {"typeset-mode", no_argument, nullptr, 't'},
- {"width", required_argument, nullptr, 'w'},
- {"word-regexp", required_argument, nullptr, 'W'},
+ {"auto-reference", no_argument, NULL, 'A'},
+ {"break-file", required_argument, NULL, 'b'},
+ {"flag-truncation", required_argument, NULL, 'F'},
+ {"ignore-case", no_argument, NULL, 'f'},
+ {"gap-size", required_argument, NULL, 'g'},
+ {"ignore-file", required_argument, NULL, 'i'},
+ {"macro-name", required_argument, NULL, 'M'},
+ {"only-file", required_argument, NULL, 'o'},
+ {"references", no_argument, NULL, 'r'},
+ {"right-side-refs", no_argument, NULL, 'R'},
+ {"format", required_argument, NULL, FORMAT_OPTION},
+ {"sentence-regexp", required_argument, NULL, 'S'},
+ {"traditional", no_argument, NULL, 'G'},
+ {"typeset-mode", no_argument, NULL, 't'},
+ {"width", required_argument, NULL, 'w'},
+ {"word-regexp", required_argument, NULL, 'W'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0},
+ {NULL, 0, NULL, 0},
};
static char const *const format_args[] =
{
- "roff", "tex", nullptr
+ "roff", "tex", NULL
};
static enum Format const format_vals[] =
@@ -1779,7 +1779,7 @@ main (int argc, char **argv)
atexit (close_stdout);
while (optchar = getopt_long (argc, argv, "AF:GM:ORS:TW:b:i:fg:o:trw:",
- long_options, nullptr),
+ long_options, NULL),
optchar != EOF)
{
switch (optchar)
@@ -1802,7 +1802,7 @@ main (int argc, char **argv)
case 'g':
{
intmax_t tmp;
- if (! (xstrtoimax (optarg, nullptr, 0, &tmp, "") == LONGINT_OK
+ if (! (xstrtoimax (optarg, NULL, 0, &tmp, "") == LONGINT_OK
&& 0 < tmp && tmp <= IDX_MAX))
error (EXIT_FAILURE, 0, _("invalid gap width: %s"),
quote (optarg));
@@ -1830,7 +1830,7 @@ main (int argc, char **argv)
case 'w':
{
intmax_t tmp;
- if (! (xstrtoimax (optarg, nullptr, 0, &tmp, "") == LONGINT_OK
+ if (! (xstrtoimax (optarg, NULL, 0, &tmp, "") == LONGINT_OK
&& 0 < tmp && tmp <= IDX_MAX))
error (EXIT_FAILURE, 0, _("invalid line width: %s"),
quote (optarg));
@@ -1872,7 +1872,7 @@ main (int argc, char **argv)
word_regex.string = optarg;
unescape_string (optarg);
if (!*word_regex.string)
- word_regex.string = nullptr;
+ word_regex.string = NULL;
break;
case FORMAT_OPTION:
@@ -1902,7 +1902,7 @@ main (int argc, char **argv)
file_line_count = xmalloc (sizeof *file_line_count);
text_buffers = xmalloc (sizeof *text_buffers);
number_input_files = 1;
- input_file_name[0] = nullptr;
+ input_file_name[0] = NULL;
}
else if (gnu_extensions)
{
@@ -1914,7 +1914,7 @@ main (int argc, char **argv)
for (file_index = 0; file_index < number_input_files; file_index++)
{
if (!*argv[optind] || streq (argv[optind], "-"))
- input_file_name[file_index] = nullptr;
+ input_file_name[file_index] = NULL;
else
input_file_name[file_index] = argv[optind];
optind++;
@@ -1930,7 +1930,7 @@ main (int argc, char **argv)
file_line_count = xmalloc (sizeof *file_line_count);
text_buffers = xmalloc (sizeof *text_buffers);
if (!*argv[optind] || streq (argv[optind], "-"))
- input_file_name[0] = nullptr;
+ input_file_name[0] = NULL;
else
input_file_name[0] = argv[optind];
optind++;
@@ -1976,14 +1976,14 @@ main (int argc, char **argv)
{
digest_word_file (ignore_file, &ignore_table);
if (ignore_table.length == 0)
- ignore_file = nullptr;
+ ignore_file = NULL;
}
if (only_file)
{
digest_word_file (only_file, &only_table);
if (only_table.length == 0)
- only_file = nullptr;
+ only_file = NULL;
}
/* Prepare to study all the input files. */
diff --git a/src/pwd.c b/src/pwd.c
index 3d3af313f7..5276553e89 100644
--- a/src/pwd.c
+++ b/src/pwd.c
@@ -38,11 +38,11 @@ struct file_name
static struct option const longopts[] =
{
- {"logical", no_argument, nullptr, 'L'},
- {"physical", no_argument, nullptr, 'P'},
+ {"logical", no_argument, NULL, 'L'},
+ {"physical", no_argument, NULL, 'P'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
void
@@ -104,12 +104,12 @@ file_name_prepend (struct file_name *p, char const *s, size_t s_len)
idx_t n_free = p->start - p->buf;
if (n_free < 1 + s_len)
{
- /* Call xpalloc with nullptr not p->buf, since with the latter
+ /* Call xpalloc with NULL not p->buf, since with the latter
we'd end up copying the data twice: once via realloc, then again
- to align it with the end of the new buffer. By passing nullptr we
+ to align it with the end of the new buffer. By passing NULL we
copy it only once. */
idx_t n_used = p->n_alloc - n_free;
- char *buf = xpalloc (nullptr, &p->n_alloc, 1 + s_len - n_free, -1, 1);
+ char *buf = xpalloc (NULL, &p->n_alloc, 1 + s_len - n_free, -1, 1);
p->start = memcpy (buf + p->n_alloc - n_free, p->start, n_used);
free (p->buf);
p->buf = buf;
@@ -152,7 +152,7 @@ find_dir_entry (struct stat *dot_sb, struct file_name *file_name,
size_t parent_height)
{
DIR *dirp = opendir ("..");
- if (dirp == nullptr)
+ if (dirp == NULL)
error (EXIT_FAILURE, errno, _("cannot open directory %s"),
quote (nth_parent (parent_height)));
@@ -176,7 +176,7 @@ find_dir_entry (struct stat *dot_sb, struct file_name *file_name,
struct dirent const *dp;
errno = 0;
- if ((dp = readdir_ignoring_dot_and_dotdot (dirp)) == nullptr)
+ if ((dp = readdir_ignoring_dot_and_dotdot (dirp)) == NULL)
{
if (errno)
{
@@ -186,7 +186,7 @@ find_dir_entry (struct stat *dot_sb, struct file_name *file_name,
errno = e;
/* Arrange to give a diagnostic after exiting this loop. */
- dirp = nullptr;
+ dirp = NULL;
}
break;
}
@@ -217,7 +217,7 @@ find_dir_entry (struct stat *dot_sb, struct file_name *file_name,
}
}
- if (dirp == nullptr || closedir (dirp) != 0)
+ if (dirp == NULL || closedir (dirp) != 0)
{
/* Note that this diagnostic serves for both readdir
and closedir failures. */
@@ -263,7 +263,7 @@ robust_getcwd (struct file_name *file_name)
struct dev_ino dev_ino_buf;
struct dev_ino *root_dev_ino = get_root_dev_ino (&dev_ino_buf);
- if (root_dev_ino == nullptr)
+ if (root_dev_ino == NULL)
error (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
quoteaf ("/"));
@@ -287,7 +287,7 @@ robust_getcwd (struct file_name *file_name)
/* Return PWD from the environment if it is acceptable for 'pwd -L'
- output, otherwise nullptr. */
+ output, otherwise NULL. */
static char const *
logical_getcwd (void)
{
@@ -295,13 +295,13 @@ logical_getcwd (void)
/* Textual validation first. */
if (!wd || wd[0] != '/')
- return nullptr;
+ return NULL;
char const *p = wd;
while ((p = strstr (p, "/.")))
{
if (!p[2] || p[2] == '/'
|| (p[2] == '.' && (!p[3] || p[3] == '/')))
- return nullptr;
+ return NULL;
p++;
}
@@ -310,7 +310,7 @@ logical_getcwd (void)
struct stat st2;
if (stat (wd, &st1) == 0 && stat (".", &st2) == 0 && psame_inode (&st1, &st2))
return wd;
- return nullptr;
+ return NULL;
}
@@ -320,7 +320,7 @@ main (int argc, char **argv)
/* POSIX requires a default of -L, but most scripts expect -P.
Currently shells default to -L, while stand-alone
pwd implementations default to -P. */
- bool logical = (getenv ("POSIXLY_CORRECT") != nullptr);
+ bool logical = (getenv ("POSIXLY_CORRECT") != NULL);
initialize_main (&argc, &argv);
set_program_name (argv[0]);
@@ -332,7 +332,7 @@ main (int argc, char **argv)
while (true)
{
- int c = getopt_long (argc, argv, "LP", longopts, nullptr);
+ int c = getopt_long (argc, argv, "LP", longopts, NULL);
if (c == -1)
break;
switch (c)
@@ -367,7 +367,7 @@ main (int argc, char **argv)
}
char *wd = xgetcwd ();
- if (wd != nullptr)
+ if (wd != NULL)
{
puts (wd);
free (wd);
diff --git a/src/readlink.c b/src/readlink.c
index 498826882c..ea76fb3fbf 100644
--- a/src/readlink.c
+++ b/src/readlink.c
@@ -38,17 +38,17 @@ static bool verbose;
static struct option const longopts[] =
{
- {"canonicalize", no_argument, nullptr, 'f'},
- {"canonicalize-existing", no_argument, nullptr, 'e'},
- {"canonicalize-missing", no_argument, nullptr, 'm'},
- {"no-newline", no_argument, nullptr, 'n'},
- {"quiet", no_argument, nullptr, 'q'},
- {"silent", no_argument, nullptr, 's'},
- {"verbose", no_argument, nullptr, 'v'},
- {"zero", no_argument, nullptr, 'z'},
+ {"canonicalize", no_argument, NULL, 'f'},
+ {"canonicalize-existing", no_argument, NULL, 'e'},
+ {"canonicalize-missing", no_argument, NULL, 'm'},
+ {"no-newline", no_argument, NULL, 'n'},
+ {"quiet", no_argument, NULL, 'q'},
+ {"silent", no_argument, NULL, 's'},
+ {"verbose", no_argument, NULL, 'v'},
+ {"zero", no_argument, NULL, 'z'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
void
@@ -108,7 +108,7 @@ main (int argc, char **argv)
atexit (close_stdout);
- while ((optc = getopt_long (argc, argv, "efmnqsvz", longopts, nullptr)) != -1)
+ while ((optc = getopt_long (argc, argv, "efmnqsvz", longopts, NULL)) != -1)
{
switch (optc)
{
@@ -156,7 +156,7 @@ main (int argc, char **argv)
/* POSIX requires a diagnostic message written to standard error and a
non-zero exit status when given a file that is not a symbolic link. */
- if (getenv ("POSIXLY_CORRECT") != nullptr)
+ if (getenv ("POSIXLY_CORRECT") != NULL)
verbose = true;
for (; optind < argc; ++optind)
diff --git a/src/realpath.c b/src/realpath.c
index d6c3864890..2a28708bef 100644
--- a/src/realpath.c
+++ b/src/realpath.c
@@ -44,20 +44,20 @@ static char const *can_relative_base;
static struct option const longopts[] =
{
- {"canonicalize", no_argument, nullptr, 'E'},
- {"canonicalize-existing", no_argument, nullptr, 'e'},
- {"canonicalize-missing", no_argument, nullptr, 'm'},
- {"relative-to", required_argument, nullptr, RELATIVE_TO_OPTION},
- {"relative-base", required_argument, nullptr, RELATIVE_BASE_OPTION},
- {"quiet", no_argument, nullptr, 'q'},
- {"strip", no_argument, nullptr, 's'},
- {"no-symlinks", no_argument, nullptr, 's'},
- {"zero", no_argument, nullptr, 'z'},
- {"logical", no_argument, nullptr, 'L'},
- {"physical", no_argument, nullptr, 'P'},
+ {"canonicalize", no_argument, NULL, 'E'},
+ {"canonicalize-existing", no_argument, NULL, 'e'},
+ {"canonicalize-missing", no_argument, NULL, 'm'},
+ {"relative-to", required_argument, NULL, RELATIVE_TO_OPTION},
+ {"relative-base", required_argument, NULL, RELATIVE_BASE_OPTION},
+ {"quiet", no_argument, NULL, 'q'},
+ {"strip", no_argument, NULL, 's'},
+ {"no-symlinks", no_argument, NULL, 's'},
+ {"zero", no_argument, NULL, 'z'},
+ {"logical", no_argument, NULL, 'L'},
+ {"physical", no_argument, NULL, 'P'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
void
@@ -159,7 +159,7 @@ process_path (char const *fname, int can_mode)
if (!can_relative_to
|| (can_relative_base && !path_prefix (can_relative_base, can_fname))
- || (can_relative_to && !relpath (can_fname, can_relative_to, nullptr, 0)))
+ || (can_relative_to && !relpath (can_fname, can_relative_to, NULL, 0)))
fputs (can_fname, stdout);
putchar (use_nuls ? '\0' : '\n');
@@ -177,8 +177,8 @@ main (int argc, char **argv)
{
bool ok = true;
int can_mode = CAN_ALL_BUT_LAST;
- char const *relative_to = nullptr;
- char const *relative_base = nullptr;
+ char const *relative_to = NULL;
+ char const *relative_base = NULL;
initialize_main (&argc, &argv);
set_program_name (argv[0]);
@@ -190,7 +190,7 @@ main (int argc, char **argv)
while (true)
{
- int c = getopt_long (argc, argv, "EeLmPqsz", longopts, nullptr);
+ int c = getopt_long (argc, argv, "EeLmPqsz", longopts, NULL);
if (c == -1)
break;
switch (c)
@@ -273,7 +273,7 @@ main (int argc, char **argv)
{
free (base);
can_relative_base = can_relative_to;
- can_relative_to = nullptr;
+ can_relative_to = NULL;
}
}
diff --git a/src/remove.c b/src/remove.c
index 1879377736..99696e5de6 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -490,7 +490,7 @@ rm_fts (FTS *fts, FTSENT *ent, struct rm_options const *x)
if (x->preserve_all_root)
{
bool failed = false;
- char *parent = file_name_concat (ent->fts_accpath, "..", nullptr);
+ char *parent = file_name_concat (ent->fts_accpath, "..", NULL);
struct stat statbuf;
if (!parent || lstat (parent, &statbuf))
@@ -611,14 +611,14 @@ rm (char *const *file, struct rm_options const *x)
if (x->one_file_system)
bit_flags |= FTS_XDEV;
- FTS *fts = xfts_open (file, bit_flags, nullptr);
+ FTS *fts = xfts_open (file, bit_flags, NULL);
while (true)
{
FTSENT *ent;
ent = fts_read (fts);
- if (ent == nullptr)
+ if (ent == NULL)
{
if (errno != 0)
{
diff --git a/src/rm.c b/src/rm.c
index ac6a2b572e..9b06c45926 100644
--- a/src/rm.c
+++ b/src/rm.c
@@ -60,32 +60,32 @@ enum interactive_type
static struct option const long_opts[] =
{
- {"force", no_argument, nullptr, 'f'},
- {"interactive", optional_argument, nullptr, INTERACTIVE_OPTION},
+ {"force", no_argument, NULL, 'f'},
+ {"interactive", optional_argument, NULL, INTERACTIVE_OPTION},
- {"one-file-system", no_argument, nullptr, ONE_FILE_SYSTEM},
- {"no-preserve-root", no_argument, nullptr, NO_PRESERVE_ROOT},
- {"preserve-root", optional_argument, nullptr, PRESERVE_ROOT},
+ {"one-file-system", no_argument, NULL, ONE_FILE_SYSTEM},
+ {"no-preserve-root", no_argument, NULL, NO_PRESERVE_ROOT},
+ {"preserve-root", optional_argument, NULL, PRESERVE_ROOT},
/* This is solely for testing. Do not document. */
/* It is relatively difficult to ensure that there is a tty on stdin.
Since rm acts differently depending on that, without this option,
it'd be harder to test the parts of rm that depend on that setting. */
- {"-presume-input-tty", no_argument, nullptr, PRESUME_INPUT_TTY_OPTION},
+ {"-presume-input-tty", no_argument, NULL, PRESUME_INPUT_TTY_OPTION},
- {"recursive", no_argument, nullptr, 'r'},
- {"dir", no_argument, nullptr, 'd'},
- {"verbose", no_argument, nullptr, 'v'},
+ {"recursive", no_argument, NULL, 'r'},
+ {"dir", no_argument, NULL, 'd'},
+ {"verbose", no_argument, NULL, 'v'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
static char const *const interactive_args[] =
{
"never", "no", "none",
"once",
- "always", "yes", nullptr
+ "always", "yes", NULL
};
static enum interactive_type const interactive_types[] =
{
@@ -198,7 +198,7 @@ rm_option_init (struct rm_options *x)
x->one_file_system = false;
x->remove_empty_directories = false;
x->recursive = false;
- x->root_dev_ino = nullptr;
+ x->root_dev_ino = NULL;
x->preserve_all_root = false;
x->stdin_tty = isatty (STDIN_FILENO);
x->verbose = false;
@@ -229,7 +229,7 @@ main (int argc, char **argv)
/* Try to disable the ability to unlink a directory. */
priv_set_remove_linkdir ();
- while ((c = getopt_long (argc, argv, "dfirvIR", long_opts, nullptr)) != -1)
+ while ((c = getopt_long (argc, argv, "dfirvIR", long_opts, NULL)) != -1)
{
switch (c)
{
@@ -345,7 +345,7 @@ main (int argc, char **argv)
{
static struct dev_ino dev_ino_buf;
x.root_dev_ino = get_root_dev_ino (&dev_ino_buf);
- if (x.root_dev_ino == nullptr)
+ if (x.root_dev_ino == NULL)
error (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
quoteaf ("/"));
}
diff --git a/src/rmdir.c b/src/rmdir.c
index 0f84c79bbf..60b62861a2 100644
--- a/src/rmdir.c
+++ b/src/rmdir.c
@@ -57,15 +57,15 @@ static struct option const longopts[] =
{
/* Don't name this '--force' because it's not close enough in meaning
to e.g. rm's -f option. */
- {"ignore-fail-on-non-empty", no_argument, nullptr,
+ {"ignore-fail-on-non-empty", no_argument, NULL,
IGNORE_FAIL_ON_NON_EMPTY_OPTION},
- {"path", no_argument, nullptr, 'p'}, /* Deprecated. */
- {"parents", no_argument, nullptr, 'p'},
- {"verbose", no_argument, nullptr, 'v'},
+ {"path", no_argument, NULL, 'p'}, /* Deprecated. */
+ {"parents", no_argument, NULL, 'p'},
+ {"verbose", no_argument, NULL, 'v'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
/* Return true if ERROR_NUMBER is one of the values associated
@@ -118,7 +118,7 @@ remove_parents (char *dir)
while (true)
{
char *slash = strrchr (dir, '/');
- if (slash == nullptr)
+ if (slash == NULL)
break;
/* Remove any characters after the slash, skipping any extra
slashes in a row. */
@@ -207,7 +207,7 @@ main (int argc, char **argv)
remove_empty_parents = false;
int optc;
- while ((optc = getopt_long (argc, argv, "pv", longopts, nullptr)) != -1)
+ while ((optc = getopt_long (argc, argv, "pv", longopts, NULL)) != -1)
{
switch (optc)
{
diff --git a/src/runcon.c b/src/runcon.c
index f7313a752e..9cd2292576 100644
--- a/src/runcon.c
+++ b/src/runcon.c
@@ -56,14 +56,14 @@
static struct option const long_options[] =
{
- {"role", required_argument, nullptr, 'r'},
- {"type", required_argument, nullptr, 't'},
- {"user", required_argument, nullptr, 'u'},
- {"range", required_argument, nullptr, 'l'},
- {"compute", no_argument, nullptr, 'c'},
+ {"role", required_argument, NULL, 'r'},
+ {"type", required_argument, NULL, 't'},
+ {"user", required_argument, NULL, 'u'},
+ {"range", required_argument, NULL, 'l'},
+ {"compute", no_argument, NULL, 'c'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
void
@@ -103,14 +103,14 @@ With neither CONTEXT nor COMMAND, print the current security context.\n\
int
main (int argc, char **argv)
{
- char *role = nullptr;
- char *range = nullptr;
- char *user = nullptr;
- char *type = nullptr;
- char *context = nullptr;
- char *cur_context = nullptr;
- char *file_context = nullptr;
- char *new_context = nullptr;
+ char *role = NULL;
+ char *range = NULL;
+ char *user = NULL;
+ char *type = NULL;
+ char *context = NULL;
+ char *cur_context = NULL;
+ char *file_context = NULL;
+ char *new_context = NULL;
bool compute_trans = false;
context_t con;
@@ -252,7 +252,7 @@ main (int argc, char **argv)
if (setexeccon (context_str (con)) != 0)
error (EXIT_CANCELED, errno, _("unable to set security context %s"),
quote (context_str (con)));
- if (cur_context != nullptr)
+ if (cur_context != NULL)
freecon (cur_context);
(compute_trans ? execv : execvp) (argv[optind], argv + optind);
diff --git a/src/selinux.c b/src/selinux.c
index c96c2d07d1..17103caa02 100644
--- a/src/selinux.c
+++ b/src/selinux.c
@@ -71,8 +71,8 @@ mode_to_security_class (mode_t m)
static int
computecon_raw (char const *path, mode_t mode, char **con)
{
- char *scon_raw = nullptr;
- char *tcon_raw = nullptr;
+ char *scon_raw = NULL;
+ char *tcon_raw = NULL;
security_class_t tclass;
int rc = -1;
@@ -111,12 +111,12 @@ defaultcon (struct selabel_handle *selabel_handle,
char const *path, mode_t mode)
{
int rc = -1;
- char *scon_raw = nullptr;
- char *tcon_raw = nullptr;
+ char *scon_raw = NULL;
+ char *tcon_raw = NULL;
context_t scontext = NULL, tcontext = NULL;
char const *contype;
char const *constr;
- char *newpath = nullptr;
+ char *newpath = NULL;
if (! IS_ABSOLUTE_FILE_NAME (path))
{
@@ -179,8 +179,8 @@ restorecon_private (struct selabel_handle *selabel_handle, char const *path)
{
int rc = -1;
struct stat sb;
- char *scon_raw = nullptr;
- char *tcon_raw = nullptr;
+ char *scon_raw = NULL;
+ char *tcon_raw = NULL;
context_t scontext = NULL, tcontext = NULL;
char const *contype;
char const *constr;
@@ -285,7 +285,7 @@ bool
restorecon (struct selabel_handle *selabel_handle,
char const *path, bool recurse)
{
- char *newpath = nullptr;
+ char *newpath = NULL;
if (! IS_ABSOLUTE_FILE_NAME (path))
{
@@ -307,8 +307,8 @@ restorecon (struct selabel_handle *selabel_handle,
return ok;
}
- char const *ftspath[2] = { path, nullptr };
- FTS *fts = xfts_open ((char *const *) ftspath, FTS_PHYSICAL, nullptr);
+ char const *ftspath[2] = { path, NULL };
+ FTS *fts = xfts_open ((char *const *) ftspath, FTS_PHYSICAL, NULL);
int err = 0;
for (FTSENT *ent; (ent = fts_read (fts)); )
diff --git a/src/seq.c b/src/seq.c
index 15782cd300..f728758628 100644
--- a/src/seq.c
+++ b/src/seq.c
@@ -63,12 +63,12 @@ static char const terminator[] = "\n";
static struct option const long_options[] =
{
- { "equal-width", no_argument, nullptr, 'w'},
- { "format", required_argument, nullptr, 'f'},
- { "separator", required_argument, nullptr, 's'},
+ { "equal-width", no_argument, NULL, 'w'},
+ { "format", required_argument, NULL, 'f'},
+ { "separator", required_argument, NULL, 's'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- { nullptr, 0, nullptr, 0}
+ { NULL, 0, NULL, 0}
};
void
@@ -151,7 +151,7 @@ scan_arg (char const *arg)
{
operand ret;
- if (! xstrtold (arg, nullptr, &ret.value, cl_strtold))
+ if (! xstrtold (arg, NULL, &ret.value, cl_strtold))
{
error (0, 0, _("invalid floating point argument: %s"), quote (arg));
usage (EXIT_FAILURE);
@@ -198,7 +198,7 @@ scan_arg (char const *arg)
e = strchr (arg, 'E');
if (e)
{
- long exponent = MAX (strtol (e + 1, nullptr, 10), -LONG_MAX);
+ long exponent = MAX (strtol (e + 1, NULL, 10), -LONG_MAX);
ret.precision += exponent < 0 ? -exponent
: - MIN (ret.precision, exponent);
/* Don't account for e.... in the width since this is not output. */
@@ -337,11 +337,11 @@ print_numbers (char const *fmt, struct layout layout,
xalloc_die ();
x_str[x_strlen - layout.suffix_len] = '\0';
- if (xstrtold (x_str + layout.prefix_len, nullptr,
+ if (xstrtold (x_str + layout.prefix_len, NULL,
&x_val, cl_strtold)
&& x_val == last)
{
- char *x0_str = nullptr;
+ char *x0_str = NULL;
int x0_strlen = asprintf (&x0_str, fmt, x0);
if (x0_strlen < 0)
xalloc_die ();
@@ -507,7 +507,7 @@ seq_fast (char const *a, char const *b, uintmax_t step)
/* Grow number buffer if needed for the inf case. */
if (p == p0)
{
- char *new_p0 = xpalloc (nullptr, &inc_size, 1, -1, 1);
+ char *new_p0 = xpalloc (NULL, &inc_size, 1, -1, 1);
idx_t saved_p_len = endp - p;
endp = new_p0 + inc_size;
p = memcpy (endp - saved_p_len, p0, saved_p_len);
@@ -552,7 +552,7 @@ main (int argc, char **argv)
struct layout layout = { 0, 0 };
/* The printf(3) format used for output. */
- char const *format_str = nullptr;
+ char const *format_str = NULL;
initialize_main (&argc, &argv);
set_program_name (argv[0]);
@@ -577,7 +577,7 @@ main (int argc, char **argv)
break;
}
- optc = getopt_long (argc, argv, "+f:s:w", long_options, nullptr);
+ optc = getopt_long (argc, argv, "+f:s:w", long_options, NULL);
if (optc == -1)
break;
@@ -620,7 +620,7 @@ main (int argc, char **argv)
if (format_str)
format_str = long_double_format (format_str, &layout);
- if (format_str != nullptr && equal_width)
+ if (format_str != NULL && equal_width)
{
error (0, 0, _("format string may not be specified"
" when printing equal width strings"));
@@ -639,7 +639,7 @@ main (int argc, char **argv)
bool fast_step_ok = false;
if (n_args != 3
|| (all_digits_p (argv[optind + 1])
- && xstrtold (argv[optind + 1], nullptr, &step.value, cl_strtold)
+ && xstrtold (argv[optind + 1], NULL, &step.value, cl_strtold)
&& 0 < step.value && step.value <= SEQ_FAST_STEP_LIMIT))
fast_step_ok = true;
@@ -701,7 +701,7 @@ main (int argc, char **argv)
/* Upon any failure, let the more general code deal with it. */
}
- if (format_str == nullptr)
+ if (format_str == NULL)
format_str = get_default_format (first, step, last);
print_numbers (format_str, layout, first.value, step.value, last.value);
diff --git a/src/set-fields.c b/src/set-fields.c
index 4e665023ae..523549214c 100644
--- a/src/set-fields.c
+++ b/src/set-fields.c
@@ -73,7 +73,7 @@ complement_rp (void)
struct field_range_pair *c = frp;
idx_t n = n_frp;
- frp = nullptr;
+ frp = NULL;
n_frp = 0;
n_frp_allocated = 0;
diff --git a/src/shred.c b/src/shred.c
index 9979f8df26..c963e51a1d 100644
--- a/src/shred.c
+++ b/src/shred.c
@@ -119,7 +119,7 @@ enum remove_method
static char const *const remove_args[] =
{
- "unlink", "wipe", "wipesync", nullptr
+ "unlink", "wipe", "wipesync", NULL
};
static enum remove_method const remove_methods[] =
@@ -147,17 +147,17 @@ enum
static struct option const long_opts[] =
{
- {"exact", no_argument, nullptr, 'x'},
- {"force", no_argument, nullptr, 'f'},
- {"iterations", required_argument, nullptr, 'n'},
- {"size", required_argument, nullptr, 's'},
- {"random-source", required_argument, nullptr, RANDOM_SOURCE_OPTION},
- {"remove", optional_argument, nullptr, 'u'},
- {"verbose", no_argument, nullptr, 'v'},
- {"zero", no_argument, nullptr, 'z'},
+ {"exact", no_argument, NULL, 'x'},
+ {"force", no_argument, NULL, 'f'},
+ {"iterations", required_argument, NULL, 'n'},
+ {"size", required_argument, NULL, 's'},
+ {"random-source", required_argument, NULL, RANDOM_SOURCE_OPTION},
+ {"remove", optional_argument, NULL, 'u'},
+ {"verbose", no_argument, NULL, 'v'},
+ {"zero", no_argument, NULL, 'z'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
void
@@ -1169,7 +1169,7 @@ main (int argc, char **argv)
char **file;
int n_files;
int c;
- char const *random_source = nullptr;
+ char const *random_source = NULL;
initialize_main (&argc, &argv);
set_program_name (argv[0]);
@@ -1182,7 +1182,7 @@ main (int argc, char **argv)
flags.n_iterations = DEFAULT_PASSES;
flags.size = -1;
- while ((c = getopt_long (argc, argv, "fn:s:uvxz", long_opts, nullptr)) != -1)
+ while ((c = getopt_long (argc, argv, "fn:s:uvxz", long_opts, NULL)) != -1)
{
switch (c)
{
@@ -1204,7 +1204,7 @@ main (int argc, char **argv)
break;
case 'u':
- if (optarg == nullptr)
+ if (optarg == NULL)
flags.remove_file = remove_wipesync;
else
flags.remove_file = XARGMATCH ("--remove", optarg,
diff --git a/src/shuf.c b/src/shuf.c
index e21b38adc0..9a8c558353 100644
--- a/src/shuf.c
+++ b/src/shuf.c
@@ -94,13 +94,13 @@ enum
static struct option const long_opts[] =
{
- {"echo", no_argument, nullptr, 'e'},
- {"input-range", required_argument, nullptr, 'i'},
- {"head-count", required_argument, nullptr, 'n'},
- {"output", required_argument, nullptr, 'o'},
- {"random-source", required_argument, nullptr, RANDOM_SOURCE_OPTION},
- {"repeat", no_argument, nullptr, 'r'},
- {"zero-terminated", no_argument, nullptr, 'z'},
+ {"echo", no_argument, NULL, 'e'},
+ {"input-range", required_argument, NULL, 'i'},
+ {"head-count", required_argument, NULL, 'n'},
+ {"output", required_argument, NULL, 'o'},
+ {"random-source", required_argument, NULL, RANDOM_SOURCE_OPTION},
+ {"repeat", no_argument, NULL, 'r'},
+ {"zero-terminated", no_argument, NULL, 'z'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0},
@@ -172,8 +172,8 @@ read_input_reservoir_sampling (FILE *in, char eolbyte, idx_t k,
{
randint n_lines = 0;
idx_t n_alloc_lines = 0;
- struct linebuffer *line = nullptr;
- struct linebuffer *rsrv = nullptr;
+ struct linebuffer *line = NULL;
+ struct linebuffer *rsrv = NULL;
/* Fill the first K lines, directly into the reservoir. */
for (n_lines = 0; n_lines < k; n_lines++)
@@ -192,7 +192,7 @@ read_input_reservoir_sampling (FILE *in, char eolbyte, idx_t k,
}
/* last line wasn't null - so there may be more lines to read. */
- if (line != nullptr)
+ if (line != NULL)
{
struct linebuffer dummy;
initbuffer (&dummy); /* space for lines not put in reservoir. */
@@ -211,7 +211,7 @@ read_input_reservoir_sampling (FILE *in, char eolbyte, idx_t k,
randint j = randint_choose (s, n_lines + 1); /* 0 .. n_lines. */
line = (j < k) ? (&rsrv[j]) : (&dummy);
}
- while (readlinebuffer_delim (line, in, eolbyte) != nullptr && n_lines++);
+ while (readlinebuffer_delim (line, in, eolbyte) != NULL && n_lines++);
if (! n_lines)
error (EXIT_FAILURE, EOVERFLOW, _("too many input lines"));
@@ -251,7 +251,7 @@ static size_t
read_input (FILE *in, char eolbyte, char ***pline)
{
char *p;
- char *buf = nullptr;
+ char *buf = NULL;
size_t used;
char *lim;
char **line;
@@ -367,10 +367,10 @@ main (int argc, char **argv)
size_t lo_input = SIZE_MAX;
size_t hi_input = 0;
idx_t head_lines = MIN (IDX_MAX, SIZE_MAX);
- char const *outfile = nullptr;
- char *random_source = nullptr;
+ char const *outfile = NULL;
+ char *random_source = NULL;
char eolbyte = '\n';
- char **input_lines = nullptr;
+ char **input_lines = NULL;
bool use_reservoir_sampling = false;
bool repeat = false;
@@ -378,10 +378,10 @@ main (int argc, char **argv)
int n_operands;
char **operand;
size_t n_lines;
- char **line = nullptr;
- struct linebuffer *reservoir = nullptr;
+ char **line = NULL;
+ struct linebuffer *reservoir = NULL;
struct randint_source *randint_source;
- size_t *permutation = nullptr;
+ size_t *permutation = NULL;
int i;
initialize_main (&argc, &argv);
@@ -392,7 +392,7 @@ main (int argc, char **argv)
atexit (close_stdout);
- while ((optc = getopt_long (argc, argv, "ei:n:o:rz", long_opts, nullptr))
+ while ((optc = getopt_long (argc, argv, "ei:n:o:rz", long_opts, NULL))
!= -1)
switch (optc)
{
@@ -408,7 +408,7 @@ main (int argc, char **argv)
uintmax_t u;
char *lo_end;
- strtol_error err = xstrtoumax (optarg, &lo_end, 10, &u, nullptr);
+ strtol_error err = xstrtoumax (optarg, &lo_end, 10, &u, NULL);
if (err == LONGINT_OK)
{
lo_input = u;
@@ -418,7 +418,7 @@ main (int argc, char **argv)
err = LONGINT_INVALID;
else
{
- err = xstrtoumax (lo_end + 1, nullptr, 10, &u, "");
+ err = xstrtoumax (lo_end + 1, NULL, 10, &u, "");
if (err == LONGINT_OK)
{
hi_input = u;
@@ -439,7 +439,7 @@ main (int argc, char **argv)
case 'n':
{
uintmax_t argval;
- strtol_error e = xstrtoumax (optarg, nullptr, 10, &argval, "");
+ strtol_error e = xstrtoumax (optarg, NULL, 10, &argval, "");
if (e == LONGINT_OK)
head_lines = MIN (head_lines, argval);
@@ -494,7 +494,7 @@ main (int argc, char **argv)
if (head_lines == 0)
{
n_lines = 0;
- line = nullptr;
+ line = NULL;
}
else if (echo)
{
@@ -505,7 +505,7 @@ main (int argc, char **argv)
else if (input_range)
{
IF_LINT (n_lines = hi_input - lo_input + 1); /* Avoid GCC 10 warning. */
- line = nullptr;
+ line = NULL;
}
else
{
diff --git a/src/sleep.c b/src/sleep.c
index b8a9cca9d1..eb86de95b1 100644
--- a/src/sleep.c
+++ b/src/sleep.c
@@ -106,7 +106,7 @@ main (int argc, char **argv)
parse_gnu_standard_options_only (argc, argv, PROGRAM_NAME, PACKAGE_NAME,
Version, true, usage, AUTHORS,
- (char const *) nullptr);
+ (char const *) NULL);
if (argc == 1)
{
diff --git a/src/sort.c b/src/sort.c
index 59ae72c54b..e5f31b1799 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -382,7 +382,7 @@ cleanup (void)
{
for (struct tempnode const *node = temphead; node; node = node->next)
unlink (node->name);
- temphead = nullptr;
+ temphead = NULL;
}
/* Handle interrupts and hangups. */
@@ -555,37 +555,37 @@ static char const short_options[] = "-bcCdfghik:mMno:rRsS:t:T:uVy:z";
static struct option const long_options[] =
{
- {"ignore-leading-blanks", no_argument, nullptr, 'b'},
- {"check", optional_argument, nullptr, CHECK_OPTION},
- {"compress-program", required_argument, nullptr, COMPRESS_PROGRAM_OPTION},
- {"debug", no_argument, nullptr, DEBUG_PROGRAM_OPTION},
- {"dictionary-order", no_argument, nullptr, 'd'},
- {"ignore-case", no_argument, nullptr, 'f'},
- {"files0-from", required_argument, nullptr, FILES0_FROM_OPTION},
- {"general-numeric-sort", no_argument, nullptr, 'g'},
- {"ignore-nonprinting", no_argument, nullptr, 'i'},
- {"key", required_argument, nullptr, 'k'},
- {"merge", no_argument, nullptr, 'm'},
- {"month-sort", no_argument, nullptr, 'M'},
- {"numeric-sort", no_argument, nullptr, 'n'},
- {"human-numeric-sort", no_argument, nullptr, 'h'},
- {"version-sort", no_argument, nullptr, 'V'},
- {"random-sort", no_argument, nullptr, 'R'},
- {"random-source", required_argument, nullptr, RANDOM_SOURCE_OPTION},
- {"sort", required_argument, nullptr, SORT_OPTION},
- {"output", required_argument, nullptr, 'o'},
- {"reverse", no_argument, nullptr, 'r'},
- {"stable", no_argument, nullptr, 's'},
- {"batch-size", required_argument, nullptr, NMERGE_OPTION},
- {"buffer-size", required_argument, nullptr, 'S'},
- {"field-separator", required_argument, nullptr, 't'},
- {"temporary-directory", required_argument, nullptr, 'T'},
- {"unique", no_argument, nullptr, 'u'},
- {"zero-terminated", no_argument, nullptr, 'z'},
- {"parallel", required_argument, nullptr, PARALLEL_OPTION},
+ {"ignore-leading-blanks", no_argument, NULL, 'b'},
+ {"check", optional_argument, NULL, CHECK_OPTION},
+ {"compress-program", required_argument, NULL, COMPRESS_PROGRAM_OPTION},
+ {"debug", no_argument, NULL, DEBUG_PROGRAM_OPTION},
+ {"dictionary-order", no_argument, NULL, 'd'},
+ {"ignore-case", no_argument, NULL, 'f'},
+ {"files0-from", required_argument, NULL, FILES0_FROM_OPTION},
+ {"general-numeric-sort", no_argument, NULL, 'g'},
+ {"ignore-nonprinting", no_argument, NULL, 'i'},
+ {"key", required_argument, NULL, 'k'},
+ {"merge", no_argument, NULL, 'm'},
+ {"month-sort", no_argument, NULL, 'M'},
+ {"numeric-sort", no_argument, NULL, 'n'},
+ {"human-numeric-sort", no_argument, NULL, 'h'},
+ {"version-sort", no_argument, NULL, 'V'},
+ {"random-sort", no_argument, NULL, 'R'},
+ {"random-source", required_argument, NULL, RANDOM_SOURCE_OPTION},
+ {"sort", required_argument, NULL, SORT_OPTION},
+ {"output", required_argument, NULL, 'o'},
+ {"reverse", no_argument, NULL, 'r'},
+ {"stable", no_argument, NULL, 's'},
+ {"batch-size", required_argument, NULL, NMERGE_OPTION},
+ {"buffer-size", required_argument, NULL, 'S'},
+ {"field-separator", required_argument, NULL, 't'},
+ {"temporary-directory", required_argument, NULL, 'T'},
+ {"unique", no_argument, NULL, 'u'},
+ {"zero-terminated", no_argument, NULL, 'z'},
+ {"parallel", required_argument, NULL, PARALLEL_OPTION},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0},
+ {NULL, 0, NULL, 0},
};
#define CHECK_TABLE \
@@ -596,7 +596,7 @@ static struct option const long_options[] =
static char const *const check_args[] =
{
#define _ct_(_s, _c) _s,
- CHECK_TABLE nullptr
+ CHECK_TABLE NULL
#undef _ct_
};
static char const check_types[] =
@@ -617,7 +617,7 @@ static char const check_types[] =
static char const *const sort_args[] =
{
#define _st_(_s, _c) _s,
- SORT_TABLE nullptr
+ SORT_TABLE NULL
#undef _st_
};
static char const sort_types[] =
@@ -652,7 +652,7 @@ cs_leave (struct cs_status const *status)
if (status->valid)
{
/* Ignore failure when restoring the signal mask. */
- pthread_sigmask (SIG_SETMASK, &status->sigs, nullptr);
+ pthread_sigmask (SIG_SETMASK, &status->sigs, NULL);
}
}
@@ -731,10 +731,10 @@ register_proc (struct tempnode *temp)
{
if (! proctab)
{
- proctab = hash_initialize (INIT_PROCTAB_SIZE, nullptr,
+ proctab = hash_initialize (INIT_PROCTAB_SIZE, NULL,
proctab_hasher,
proctab_comparator,
- nullptr);
+ NULL);
if (! proctab)
xalloc_die ();
}
@@ -819,7 +819,7 @@ exit_cleanup (void)
/* Create a new temporary file, returning its newly allocated tempnode.
Store into *PFD the file descriptor open for writing.
- If the creation fails, return nullptr and store -1 into *PFD if the
+ If the creation fails, return NULL and store -1 into *PFD if the
failure is due to file descriptor exhaustion and
SURVIVE_FD_EXHAUSTION; otherwise, die. */
@@ -839,7 +839,7 @@ create_temp_file (int *pfd, bool survive_fd_exhaustion)
memcpy (file, temp_dir, len);
memcpy (file + len, slashbase, sizeof slashbase);
- node->next = nullptr;
+ node->next = NULL;
if (++temp_dir_index == temp_dir_count)
temp_dir_index = 0;
@@ -861,14 +861,14 @@ create_temp_file (int *pfd, bool survive_fd_exhaustion)
error (SORT_FAILURE, errno, _("cannot create temporary file in %s"),
quoteaf (temp_dir));
free (node);
- node = nullptr;
+ node = NULL;
}
*pfd = fd;
return node;
}
-/* Return a pointer to stdout status, or nullptr on failure. */
+/* Return a pointer to stdout status, or NULL on failure. */
static struct stat *
get_outstatus (void)
@@ -877,7 +877,7 @@ get_outstatus (void)
static struct stat outstat;
if (outstat_errno == 0)
outstat_errno = fstat (STDOUT_FILENO, &outstat) == 0 ? -1 : errno;
- return outstat_errno < 0 ? &outstat : nullptr;
+ return outstat_errno < 0 ? &outstat : NULL;
}
/* Return a stream for FILE, opened with mode HOW. If HOW is "w",
@@ -885,7 +885,7 @@ get_outstatus (void)
truncated unless FILE is null. When opening for input, "-"
means standard input. To avoid confusion, do not return file
descriptors STDIN_FILENO, STDOUT_FILENO, or STDERR_FILENO when
- opening an ordinary FILE. Return nullptr if unsuccessful.
+ opening an ordinary FILE. Return NULL if unsuccessful.
Use fadvise to specify an access pattern for input files.
There are a few hints we could possibly provide,
@@ -943,7 +943,7 @@ stream_open (char const *file, char const *how)
else
{
int fd = open (file, O_RDONLY | O_CLOEXEC);
- fp = fd < 0 ? nullptr : fdopen (fd, how);
+ fp = fd < 0 ? NULL : fdopen (fd, how);
}
fadvise (fp, FADVISE_SEQUENTIAL);
}
@@ -1033,19 +1033,19 @@ posix_spawn_file_actions_move_fd (posix_spawn_file_actions_t *actions,
}
/* Look up COMPRESS_PROGRAM in $PATH, and return the resolved program name.
- Upon error, return nullptr with errno set. */
+ Upon error, return NULL with errno set. */
static char const *
get_resolved_compress_program (void)
{
/* Use a cache, to perform the search only once. */
- static char const *resolved_compress_program_cache /* = nullptr */;
+ static char const *resolved_compress_program_cache /* = NULL */;
- if (resolved_compress_program_cache == nullptr)
+ if (resolved_compress_program_cache == NULL)
{
resolved_compress_program_cache =
- find_in_given_path (compress_program, getenv ("PATH"), nullptr, false);
- /* If resolved_compress_program_cache == nullptr, errno is set here. */
+ find_in_given_path (compress_program, getenv ("PATH"), NULL, false);
+ /* If resolved_compress_program_cache == NULL, errno is set here. */
}
return resolved_compress_program_cache;
@@ -1073,7 +1073,7 @@ pipe_child (pid_t *pid, int pipefds[2], int tempfd, bool decompress,
implementations/emulations of posix_spawn we get only a
generic (fatal) error from the child in that case. */
resolved_compress_program = get_resolved_compress_program ();
- if (resolved_compress_program == nullptr)
+ if (resolved_compress_program == NULL)
return errno;
if ((result = posix_spawnattr_init (&attr)))
@@ -1121,8 +1121,8 @@ pipe_child (pid_t *pid, int pipefds[2], int tempfd, bool decompress,
char const *const argv[] =
{
resolved_compress_program,
- decompress ? "-d" : nullptr,
- nullptr
+ decompress ? "-d" : NULL,
+ NULL
};
/* At least NMERGE + 1 subprocesses are needed. More could be created, but
@@ -1141,7 +1141,7 @@ pipe_child (pid_t *pid, int pipefds[2], int tempfd, bool decompress,
if it receives a signal before exec-ing. */
cs_enter (&cs);
saved_temphead = temphead;
- temphead = nullptr;
+ temphead = NULL;
result = posix_spawnp (pid, resolved_compress_program, &actions, &attr,
(char * const *) argv, environ);
@@ -1179,7 +1179,7 @@ pipe_child (pid_t *pid, int pipefds[2], int tempfd, bool decompress,
/* Create a temporary file and, if asked for, start a compressor
to that file. Set *PFP to the file handle and return
the address of the new temp node. If the creation
- fails, return nullptr if the failure is due to file descriptor
+ fails, return NULL if the failure is due to file descriptor
exhaustion and SURVIVE_FD_EXHAUSTION; otherwise, die. */
static struct tempnode *
@@ -1188,7 +1188,7 @@ maybe_create_temp (FILE **pfp, bool survive_fd_exhaustion)
int tempfd;
struct tempnode *node = create_temp_file (&tempfd, survive_fd_exhaustion);
if (! node)
- return nullptr;
+ return NULL;
node->state = UNCOMPRESSED;
@@ -1236,7 +1236,7 @@ create_temp (FILE **pfp)
}
/* Open a compressed temp file and start a decompression process through
- which to filter the input. Return nullptr (setting errno to
+ which to filter the input. Return NULL (setting errno to
EMFILE) if we ran out of file descriptors, and die on any other
kind of failure. */
@@ -1244,14 +1244,14 @@ static FILE *
open_temp (struct tempnode *temp)
{
int tempfd, pipefds[2];
- FILE *fp = nullptr;
+ FILE *fp = NULL;
if (temp->state == UNREAPED)
wait_proc (temp->pid);
tempfd = open (temp->name, O_RDONLY);
if (tempfd < 0)
- return nullptr;
+ return NULL;
pid_t child;
int result = pipe_child (&child, pipefds, tempfd, true,
@@ -1386,7 +1386,7 @@ specify_nmerge (int oi, char c, char const *s)
{
uintmax_t n;
struct rlimit rlimit;
- enum strtol_error e = xstrtoumax (s, nullptr, 10, &n, "");
+ enum strtol_error e = xstrtoumax (s, NULL, 10, &n, "");
/* Try to find out how many file descriptors we'll be able
to open. We need at least nmerge + 3 (STDIN_FILENO,
@@ -1493,7 +1493,7 @@ static size_t
specify_nthreads (int oi, char c, char const *s)
{
uintmax_t nthreads;
- enum strtol_error e = xstrtoumax (s, nullptr, 10, &nthreads, "");
+ enum strtol_error e = xstrtoumax (s, NULL, 10, &nthreads, "");
if (e == LONGINT_OVERFLOW)
return SIZE_MAX;
if (e != LONGINT_OK)
@@ -2254,7 +2254,7 @@ compare_random (char *restrict texta, size_t lena,
char stackbuf[4000];
char *buf = stackbuf;
size_t bufsize = sizeof stackbuf;
- void *allocated = nullptr;
+ void *allocated = NULL;
uint32_t dig[2][MD5_DIGEST_SIZE / sizeof (uint32_t)];
struct md5_ctx s[2];
s[0] = s[1] = random_md5_state;
@@ -2299,7 +2299,7 @@ compare_random (char *restrict texta, size_t lena,
bool a_fits = sizea <= bufsize;
size_t sizeb =
(textb < limb
- ? (xstrxfrm ((a_fits ? buf + sizea : nullptr), textb,
+ ? (xstrxfrm ((a_fits ? buf + sizea : NULL), textb,
(a_fits ? bufsize - sizea : 0))
+ 1)
: 0);
@@ -2621,9 +2621,9 @@ key_warnings (struct keyfield const *gkey, bool gkey_only)
/* Flag global options not copied or specified in any key. */
if (ugkey.ignore && (ugkey.ignore == key->ignore))
- ugkey.ignore = nullptr;
+ ugkey.ignore = NULL;
if (ugkey.translate && (ugkey.translate == key->translate))
- ugkey.translate = nullptr;
+ ugkey.translate = NULL;
ugkey.skipsblanks &= !key->skipsblanks;
ugkey.skipeblanks &= !key->skipeblanks;
ugkey.month &= !key->month;
@@ -2768,7 +2768,7 @@ keycompare (struct line const *a, struct line const *b)
char enda = ta[tlena];
char endb = tb[tlenb];
- void *allocated = nullptr;
+ void *allocated = NULL;
char stackbuf[4000];
if (ignore || translate)
@@ -2812,7 +2812,7 @@ keycompare (struct line const *a, struct line const *b)
else if (key->human_numeric)
diff = human_numcompare (ta, tb);
else if (key->month)
- diff = getmonth (ta, nullptr) - getmonth (tb, nullptr);
+ diff = getmonth (ta, NULL) - getmonth (tb, NULL);
else if (key->random)
diff = compare_random (ta, tlena, tb, tlenb);
else if (key->version)
@@ -3025,7 +3025,7 @@ check (char const *file_name, char checkonly)
initbuf (&buf, sizeof (struct line),
MAX (merge_buffer_size, sort_size));
- temp.text = nullptr;
+ temp.text = NULL;
while (fillbuf (&buf, fp, file_name))
{
@@ -3131,7 +3131,7 @@ mergefps (struct sortfile *files, size_t ntemps, size_t nfiles,
struct buffer *buffer = xnmalloc (nfiles, sizeof *buffer);
/* Input buffers for each file. */
struct line saved; /* Saved line storage for unique check. */
- struct line const *savedline = nullptr;
+ struct line const *savedline = NULL;
/* &saved if there is a saved line. */
size_t savealloc = 0; /* Size allocated for the saved line. */
struct line const **cur = xnmalloc (nfiles, sizeof *cur);
@@ -3144,7 +3144,7 @@ mergefps (struct sortfile *files, size_t ntemps, size_t nfiles,
and will be next output. */
size_t t;
struct keyfield const *key = keylist;
- saved.text = nullptr;
+ saved.text = NULL;
/* Read initial lines from each input file. */
for (size_t i = 0; i < nfiles; )
@@ -3197,7 +3197,7 @@ mergefps (struct sortfile *files, size_t ntemps, size_t nfiles,
{
if (savedline && compare (savedline, smallest))
{
- savedline = nullptr;
+ savedline = NULL;
write_line (&saved, ofp, output_file);
}
if (!savedline)
@@ -3450,13 +3450,13 @@ merge_tree_init (size_t nthreads, size_t nlines, struct line *dest)
struct merge_node *merge_tree = xmalloc (2 * sizeof *merge_tree * nthreads);
struct merge_node *root = merge_tree;
- root->lo = root->hi = root->end_lo = root->end_hi = nullptr;
- root->dest = nullptr;
+ root->lo = root->hi = root->end_lo = root->end_hi = NULL;
+ root->dest = NULL;
root->nlo = root->nhi = nlines;
- root->parent = nullptr;
+ root->parent = NULL;
root->level = MERGE_END;
root->queued = false;
- pthread_mutex_init (&root->lock, nullptr);
+ pthread_mutex_init (&root->lock, NULL);
init_node (root, root + 1, dest, nthreads, nlines, false);
return merge_tree;
@@ -3507,7 +3507,7 @@ init_node (struct merge_node *restrict parent,
node->parent = parent;
node->level = parent->level + 1;
node->queued = false;
- pthread_mutex_init (&node->lock, nullptr);
+ pthread_mutex_init (&node->lock, NULL);
if (nthreads > 1)
{
@@ -3522,8 +3522,8 @@ init_node (struct merge_node *restrict parent,
}
else
{
- node->lo_child = nullptr;
- node->hi_child = nullptr;
+ node->lo_child = NULL;
+ node->hi_child = NULL;
}
return node_pool;
}
@@ -3577,8 +3577,8 @@ queue_init (struct merge_node_queue *queue, size_t nthreads)
time, the heap should accommodate all of them. Counting a null
dummy head for the heap, reserve 2 * NTHREADS nodes. */
queue->priority_queue = heap_alloc (compare_nodes, 2 * nthreads);
- pthread_mutex_init (&queue->mutex, nullptr);
- pthread_cond_init (&queue->cond, nullptr);
+ pthread_mutex_init (&queue->mutex, NULL);
+ pthread_cond_init (&queue->cond, NULL);
}
/* Insert NODE into QUEUE. The caller either holds a lock on NODE, or
@@ -3807,7 +3807,7 @@ sortlines_thread (void *data)
sortlines (args->lines, args->nthreads, args->total_lines,
args->node, args->queue, args->tfp,
args->output_temp);
- return nullptr;
+ return NULL;
}
/* Sort lines, possibly in parallel. The arguments are as in struct
@@ -3849,11 +3849,11 @@ sortlines (struct line *restrict lines, size_t nthreads,
node->lo_child, queue, tfp, temp_output};
if (nthreads > 1 && SUBTHREAD_LINES_HEURISTIC <= nlines
- && pthread_create (&thread, nullptr, sortlines_thread, &args) == 0)
+ && pthread_create (&thread, NULL, sortlines_thread, &args) == 0)
{
sortlines (lines - node->nlo, hi_threads, total_lines,
node->hi_child, queue, tfp, temp_output);
- pthread_join (thread, nullptr);
+ pthread_join (thread, NULL);
}
else
{
@@ -3899,7 +3899,7 @@ static void
avoid_trashing_input (struct sortfile *files, size_t ntemps,
size_t nfiles, char const *outfile)
{
- struct tempnode *tempcopy = nullptr;
+ struct tempnode *tempcopy = NULL;
for (size_t i = ntemps; i < nfiles; i++)
{
@@ -4152,7 +4152,7 @@ sort (char *const *files, size_t nfiles, char const *output_file,
break;
}
- saved_line.text = nullptr;
+ saved_line.text = NULL;
line = buffer_linelim (&buf);
if (buf.eof && !nfiles && !ntemps && !buf.left)
{
@@ -4231,7 +4231,7 @@ insertkey (struct keyfield *key_arg)
for (p = &keylist; *p; p = &(*p)->next)
continue;
*p = key;
- key->next = nullptr;
+ key->next = NULL;
}
/* Report a bad field specification SPEC, with extra info MSGID. */
@@ -4272,7 +4272,7 @@ check_ordering_compatibility (void)
/* Parse the leading integer in STRING and store the resulting value
(which must fit into size_t) into *VAL. Return the address of the
suffix after the integer. If the value is too large, silently
- substitute SIZE_MAX. If MSGID is null, return nullptr after
+ substitute SIZE_MAX. If MSGID is null, return NULL after
failure; otherwise, report MSGID and exit on failure. */
static char const *
@@ -4298,7 +4298,7 @@ parse_field_count (char const *string, size_t *val, char const *msgid)
if (msgid)
error (SORT_FAILURE, 0, _("%s: invalid count at start of %s"),
_(msgid), quote (string));
- return nullptr;
+ return NULL;
}
return suffix;
@@ -4384,17 +4384,17 @@ main (int argc, char **argv)
int c = 0;
char checkonly = 0;
bool mergeonly = false;
- char *random_source = nullptr;
+ char *random_source = NULL;
bool need_random = false;
size_t nthreads = 0;
size_t nfiles = 0;
- bool posixly_correct = (getenv ("POSIXLY_CORRECT") != nullptr);
+ bool posixly_correct = (getenv ("POSIXLY_CORRECT") != NULL);
int posix_ver = posix2_version ();
bool traditional_usage = ! (200112 <= posix_ver && posix_ver < 200809);
char **files;
- char *files_from = nullptr;
+ char *files_from = NULL;
struct Tokens tok;
- char const *outfile = nullptr;
+ char const *outfile = NULL;
bool locale_ok;
initialize_main (&argc, &argv);
@@ -4442,7 +4442,7 @@ main (int argc, char **argv)
{
if (term_sig[i] == SIGPIPE)
continue; /* Handled below. */
- sigaction (term_sig[i], nullptr, &act);
+ sigaction (term_sig[i], NULL, &act);
if (act.sa_handler != SIG_IGN)
sigaddset (&caught_signals, term_sig[i]);
}
@@ -4456,7 +4456,7 @@ main (int argc, char **argv)
if (term_sig[i] == SIGPIPE)
continue; /* Handled below. */
if (sigismember (&caught_signals, term_sig[i]))
- sigaction (term_sig[i], &act, nullptr);
+ sigaction (term_sig[i], &act, NULL);
}
}
signal (SIGCHLD, SIG_DFL); /* Don't inherit CHLD handling from parent. */
@@ -4495,7 +4495,7 @@ main (int argc, char **argv)
else switch (c)
{
case 1:
- key = nullptr;
+ key = NULL;
if (optarg[0] == '+')
{
bool minus_pos_usage = (optind != argc && argv[optind][0] == '-'
@@ -4506,13 +4506,13 @@ main (int argc, char **argv)
/* Treat +POS1 [-POS2] as a key if possible; but silently
treat an operand as a file if it is not a valid +POS1. */
key = key_init (&key_buf);
- s = parse_field_count (optarg + 1, &key->sword, nullptr);
+ s = parse_field_count (optarg + 1, &key->sword, NULL);
if (s && *s == '.')
- s = parse_field_count (s + 1, &key->schar, nullptr);
+ s = parse_field_count (s + 1, &key->schar, NULL);
if (! (key->sword || key->schar))
key->sword = SIZE_MAX;
if (! s || *set_ordering (s, key, bl_start))
- key = nullptr;
+ key = NULL;
else
{
if (minus_pos_usage)
@@ -4848,7 +4848,7 @@ main (int argc, char **argv)
error (0, 0, "%s", _("failed to set locale"));
if (hard_LC_COLLATE)
error (0, 0, _("text ordering performed using %s sorting rules"),
- quote (setlocale (LC_COLLATE, nullptr)));
+ quote (setlocale (LC_COLLATE, NULL)));
else
error (0, 0, "%s",
_("text ordering performed using simple byte comparison"));
diff --git a/src/split.c b/src/split.c
index 272ed3ce92..deeff03c33 100644
--- a/src/split.c
+++ b/src/split.c
@@ -133,25 +133,25 @@ enum
static struct option const longopts[] =
{
- {"bytes", required_argument, nullptr, 'b'},
- {"lines", required_argument, nullptr, 'l'},
- {"line-bytes", required_argument, nullptr, 'C'},
- {"number", required_argument, nullptr, 'n'},
- {"elide-empty-files", no_argument, nullptr, 'e'},
- {"unbuffered", no_argument, nullptr, 'u'},
- {"suffix-length", required_argument, nullptr, 'a'},
- {"additional-suffix", required_argument, nullptr,
+ {"bytes", required_argument, NULL, 'b'},
+ {"lines", required_argument, NULL, 'l'},
+ {"line-bytes", required_argument, NULL, 'C'},
+ {"number", required_argument, NULL, 'n'},
+ {"elide-empty-files", no_argument, NULL, 'e'},
+ {"unbuffered", no_argument, NULL, 'u'},
+ {"suffix-length", required_argument, NULL, 'a'},
+ {"additional-suffix", required_argument, NULL,
ADDITIONAL_SUFFIX_OPTION},
- {"numeric-suffixes", optional_argument, nullptr, 'd'},
- {"hex-suffixes", optional_argument, nullptr, 'x'},
- {"filter", required_argument, nullptr, FILTER_OPTION},
- {"verbose", no_argument, nullptr, VERBOSE_OPTION},
- {"separator", required_argument, nullptr, 't'},
- {"-io-blksize", required_argument, nullptr,
+ {"numeric-suffixes", optional_argument, NULL, 'd'},
+ {"hex-suffixes", optional_argument, NULL, 'x'},
+ {"filter", required_argument, NULL, FILTER_OPTION},
+ {"verbose", no_argument, NULL, VERBOSE_OPTION},
+ {"separator", required_argument, NULL, 't'},
+ {"-io-blksize", required_argument, NULL,
IO_BLKSIZE_OPTION}, /* do not document */
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
/* Return true if the errno value, ERR, is ignorable. */
@@ -182,7 +182,7 @@ set_suffix_length (intmax_t n_units, enum Split_type split_type)
if (numeric_suffix_start)
{
intmax_t n_start;
- strtol_error e = xstrtoimax (numeric_suffix_start, nullptr, 10,
+ strtol_error e = xstrtoimax (numeric_suffix_start, NULL, 10,
&n_start, "");
if (e == LONGINT_OK && n_start < n_units)
{
@@ -285,7 +285,7 @@ static off_t
copy_to_tmpfile (int fd, char *buf, idx_t bufsize)
{
FILE *tmp;
- if (!temp_stream (&tmp, nullptr))
+ if (!temp_stream (&tmp, NULL))
return -1;
off_t copied = 0;
off_t r;
@@ -554,10 +554,10 @@ create (char const *name)
char const *shell_prog = getenv ("SHELL");
- if (shell_prog == nullptr)
+ if (shell_prog == NULL)
shell_prog = "/bin/sh";
char const *const argv[] = { last_component (shell_prog), "-c",
- filter_command, nullptr };
+ filter_command, NULL };
result = posix_spawn (&child_pid, shell_prog, &actions, &attr,
(char * const *) argv, environ);
@@ -585,11 +585,11 @@ create (char const *name)
static void
closeout (FILE *fp, int fd, pid_t pid, char const *name)
{
- if (fp != nullptr && fclose (fp) != 0 && ! ignorable (errno))
+ if (fp != NULL && fclose (fp) != 0 && ! ignorable (errno))
error (EXIT_FAILURE, errno, "%s", quotef (name));
if (fd >= 0)
{
- if (fp == nullptr && close (fd) < 0)
+ if (fp == NULL && close (fd) < 0)
error (EXIT_FAILURE, errno, "%s", quotef (name));
for (int j = 0; j < n_open_pipes; ++j)
{
@@ -646,7 +646,7 @@ cwrite (bool new_file_flag, char const *bp, idx_t bytes)
{
if (!bp && bytes == 0 && elide_empty_files)
return true;
- closeout (nullptr, output_desc, filter_pid, outfile);
+ closeout (NULL, output_desc, filter_pid, outfile);
next_file_name ();
output_desc = create (outfile);
if (output_desc < 0)
@@ -740,7 +740,7 @@ bytes_split (intmax_t n_bytes, intmax_t rem_bytes,
any existing files or notifies any consumers on fifos.
FIXME: Should we do this before EXIT_FAILURE? */
while (opened++ < max_files)
- cwrite (true, nullptr, 0);
+ cwrite (true, NULL, 0);
}
/* Split into pieces of exactly N_LINES lines.
@@ -799,7 +799,7 @@ line_bytes_split (intmax_t n_bytes, char *buf, idx_t bufsize)
ssize_t n_read;
intmax_t n_out = 0; /* for each split. */
idx_t n_hold = 0;
- char *hold = nullptr; /* for lines > bufsize. */
+ char *hold = NULL; /* for lines > bufsize. */
idx_t hold_size = 0;
bool split_line = false; /* Whether a \n was output in a split. */
@@ -813,7 +813,7 @@ line_bytes_split (intmax_t n_bytes, char *buf, idx_t bufsize)
while (n_left)
{
idx_t split_rest = 0;
- char *eoc = nullptr;
+ char *eoc = NULL;
char *eol;
/* Determine End Of Chunk and/or End of Line,
@@ -1004,7 +1004,7 @@ lines_chunk_split (intmax_t k, intmax_t n, char *buf, idx_t bufsize,
if (chunk_end <= n_written)
{
if (! k)
- cwrite (true, nullptr, 0);
+ cwrite (true, NULL, 0);
}
else
next = false;
@@ -1020,7 +1020,7 @@ lines_chunk_split (intmax_t k, intmax_t n, char *buf, idx_t bufsize,
FIXME: Should we do this before EXIT_FAILURE? */
if (!k)
while (chunk_no++ <= n)
- cwrite (true, nullptr, 0);
+ cwrite (true, NULL, 0);
}
/* -n K/N: Extract Kth of N chunks. */
@@ -1150,7 +1150,7 @@ ofile_open (of_t *files, idx_t i_check, idx_t nfiles)
if (fclose (files[i_reopen].ofile) != 0)
error (EXIT_FAILURE, errno, "%s", quotef (files[i_reopen].of_name));
- files[i_reopen].ofile = nullptr;
+ files[i_reopen].ofile = NULL;
files[i_reopen].ofd = OFD_APPEND;
}
@@ -1180,7 +1180,7 @@ lines_rr (intmax_t k, intmax_t n, char *buf, idx_t bufsize, of_t **filesp)
bool wrote = false;
bool file_limit;
idx_t i_file;
- of_t *files IF_LINT (= nullptr);
+ of_t *files IF_LINT (= NULL);
intmax_t line_no;
if (k)
@@ -1197,7 +1197,7 @@ lines_rr (intmax_t k, intmax_t n, char *buf, idx_t bufsize, of_t **filesp)
next_file_name ();
files[i_file].of_name = xstrdup (outfile);
files[i_file].ofd = OFD_NEW;
- files[i_file].ofile = nullptr;
+ files[i_file].ofile = NULL;
files[i_file].opid = 0;
}
i_file = 0;
@@ -1270,7 +1270,7 @@ lines_rr (intmax_t k, intmax_t n, char *buf, idx_t bufsize, of_t **filesp)
if (fclose (files[i_file].ofile) != 0)
error (EXIT_FAILURE, errno, "%s",
quotef (files[i_file].of_name));
- files[i_file].ofile = nullptr;
+ files[i_file].ofile = NULL;
files[i_file].ofd = OFD_APPEND;
}
if (next && ++i_file == n)
@@ -1338,7 +1338,7 @@ static intmax_t
parse_n_units (char const *arg, char const *multipliers, char const *msgid)
{
intmax_t n;
- if (OVERFLOW_OK < xstrtoimax (arg, nullptr, 10, &n, multipliers) || n < 1)
+ if (OVERFLOW_OK < xstrtoimax (arg, NULL, 10, &n, multipliers) || n < 1)
strtoint_die (msgid, arg);
return n;
}
@@ -1397,7 +1397,7 @@ main (int argc, char **argv)
int this_optind = optind ? optind : 1;
c = getopt_long (argc, argv, "0123456789C:a:b:del:n:t:ux",
- longopts, nullptr);
+ longopts, NULL);
if (c == -1)
break;
@@ -1716,7 +1716,7 @@ main (int argc, char **argv)
if (close (STDIN_FILENO) != 0)
error (EXIT_FAILURE, errno, "%s", quotef (infile));
- closeout (nullptr, output_desc, filter_pid, outfile);
+ closeout (NULL, output_desc, filter_pid, outfile);
main_exit (EXIT_SUCCESS);
}
diff --git a/src/stat.c b/src/stat.c
index b6fd0950b8..5c265f903e 100644
--- a/src/stat.c
+++ b/src/stat.c
@@ -203,7 +203,7 @@ enum cached_mode
static char const *const cached_args[] =
{
- "default", "never", "always", nullptr
+ "default", "never", "always", NULL
};
static enum cached_mode const cached_modes[] =
@@ -213,15 +213,15 @@ static enum cached_mode const cached_modes[] =
static struct option const long_options[] =
{
- {"dereference", no_argument, nullptr, 'L'},
- {"file-system", no_argument, nullptr, 'f'},
- {"format", required_argument, nullptr, 'c'},
- {"printf", required_argument, nullptr, PRINTF_OPTION},
- {"terse", no_argument, nullptr, 't'},
- {"cached", required_argument, nullptr, 0},
+ {"dereference", no_argument, NULL, 'L'},
+ {"file-system", no_argument, NULL, 'f'},
+ {"format", required_argument, NULL, 'c'},
+ {"printf", required_argument, NULL, PRINTF_OPTION},
+ {"terse", no_argument, NULL, 't'},
+ {"cached", required_argument, NULL, 0},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
/* Whether to follow symbolic links; True for --dereference (-L). */
@@ -740,7 +740,7 @@ out_epoch_sec (char *pformat, size_t prefix_len,
if (c_isdigit (dot[1]))
{
- long int lprec = strtol (dot + 1, nullptr, 10);
+ long int lprec = strtol (dot + 1, NULL, 10);
precision = (lprec <= INT_MAX ? lprec : INT_MAX);
}
else
@@ -760,7 +760,7 @@ out_epoch_sec (char *pformat, size_t prefix_len,
--p;
while (c_isdigit (p[-1]));
- long int lwidth = strtol (p, nullptr, 10);
+ long int lwidth = strtol (p, NULL, 10);
width = (lwidth <= INT_MAX ? lwidth : INT_MAX);
if (1 < width)
{
@@ -843,7 +843,7 @@ out_file_context (char *pformat, size_t prefix_len, char const *filename)
{
error (0, errno, _("failed to get security context of %s"),
quoteaf (filename));
- scontext = nullptr;
+ scontext = NULL;
fail = true;
}
strcpy (pformat + prefix_len, "s");
@@ -943,12 +943,12 @@ print_statfs (char *pformat, size_t prefix_len, MAYBE_UNUSED char mod, char m,
/* Return any bind mounted source for a path.
The caller should not free the returned buffer.
- Return nullptr if no bind mount found. */
+ Return NULL if no bind mount found. */
NODISCARD
static char const *
find_bind_mount (char const * name)
{
- char const * bind_mount = nullptr;
+ char const * bind_mount = NULL;
static struct mount_entry *mount_list;
static bool tried_mount_list = false;
@@ -961,7 +961,7 @@ find_bind_mount (char const * name)
struct stat name_stats;
if (stat (name, &name_stats) != 0)
- return nullptr;
+ return NULL;
for (struct mount_entry *me = mount_list; me; me = me->me_next)
{
@@ -989,8 +989,8 @@ out_mount_point (char const *filename, char *pformat, size_t prefix_len,
const struct stat *statp)
{
- char const *np = "?", *bp = nullptr;
- char *mp = nullptr;
+ char const *np = "?", *bp = NULL;
+ char *mp = NULL;
bool fail = true;
/* Look for bind mounts first. Note we output the immediate alias,
@@ -1053,20 +1053,20 @@ getenv_quoting_style (void)
{
int i = ARGMATCH (q_style, quoting_style_args, quoting_style_vals);
if (0 <= i)
- set_quoting_style (nullptr, quoting_style_vals[i]);
+ set_quoting_style (NULL, quoting_style_vals[i]);
else
{
- set_quoting_style (nullptr, shell_escape_always_quoting_style);
+ set_quoting_style (NULL, shell_escape_always_quoting_style);
error (0, 0, _("ignoring invalid value of environment "
"variable QUOTING_STYLE: %s"), quote (q_style));
}
}
else
- set_quoting_style (nullptr, shell_escape_always_quoting_style);
+ set_quoting_style (NULL, shell_escape_always_quoting_style);
}
/* Equivalent to quotearg(), but explicit to avoid syntax checks. */
-#define quoteN(x) quotearg_style (get_quoting_style (nullptr), x)
+#define quoteN(x) quotearg_style (get_quoting_style (NULL), x)
/* Output a single-character \ escape. */
@@ -1517,7 +1517,7 @@ print_stat (char *pformat, size_t prefix_len, char mod, char m,
if (S_ISLNK (statbuf->st_mode))
{
char *linkname = areadlink_with_size (filename, statbuf->st_size);
- if (linkname == nullptr)
+ if (linkname == NULL)
{
error (0, errno, _("cannot read symbolic link %s"),
quoteaf (filename));
@@ -1878,7 +1878,7 @@ main (int argc, char *argv[])
int c;
bool fs = false;
bool terse = false;
- char *format = nullptr;
+ char *format = NULL;
char *format2;
bool ok = true;
@@ -1894,7 +1894,7 @@ main (int argc, char *argv[])
atexit (close_stdout);
- while ((c = getopt_long (argc, argv, "c:fLt", long_options, nullptr)) != -1)
+ while ((c = getopt_long (argc, argv, "c:fLt", long_options, NULL)) != -1)
{
switch (c)
{
diff --git a/src/stdbuf.c b/src/stdbuf.c
index 4cecd42e45..7e0a43912b 100644
--- a/src/stdbuf.c
+++ b/src/stdbuf.c
@@ -46,12 +46,12 @@ static struct
static struct option const longopts[] =
{
- {"input", required_argument, nullptr, 'i'},
- {"output", required_argument, nullptr, 'o'},
- {"error", required_argument, nullptr, 'e'},
+ {"input", required_argument, NULL, 'i'},
+ {"output", required_argument, NULL, 'o'},
+ {"error", required_argument, NULL, 'e'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
/* Set size to the value of STR, interpreted as a decimal integer,
@@ -64,7 +64,7 @@ static int
parse_size (char const *str, size_t *size)
{
uintmax_t tmp_size;
- enum strtol_error e = xstrtoumax (str, nullptr, 10,
+ enum strtol_error e = xstrtoumax (str, NULL, 10,
&tmp_size, "EGkKMPQRTYZ0");
if (e == LONGINT_OK && SIZE_MAX < tmp_size)
e = LONGINT_OVERFLOW;
@@ -147,10 +147,10 @@ set_program_path (char const *arg)
else if ((path = getenv ("PATH")))
{
path = xstrdup (path);
- for (char *dir = strtok (path, ":"); dir != nullptr;
- dir = strtok (nullptr, ":"))
+ for (char *dir = strtok (path, ":"); dir != NULL;
+ dir = strtok (NULL, ":"))
{
- char *candidate = file_name_concat (dir, arg, nullptr);
+ char *candidate = file_name_concat (dir, arg, NULL);
if (access (candidate, X_OK) == 0)
{
program_path = dir_name (candidate);
@@ -219,7 +219,7 @@ set_LD_PRELOAD (void)
char const *const search_path[] = {
program_path,
PKGLIBEXECDIR,
- nullptr
+ NULL
};
char const *const *path = search_path;
@@ -321,7 +321,7 @@ main (int argc, char **argv)
initialize_exit_failure (EXIT_CANCELED);
atexit (close_stdout);
- while ((c = getopt_long (argc, argv, "+i:o:e:", longopts, nullptr)) != -1)
+ while ((c = getopt_long (argc, argv, "+i:o:e:", longopts, NULL)) != -1)
{
int opt_fileno;
diff --git a/src/stty.c b/src/stty.c
index b4906fb870..3e5c306ab6 100644
--- a/src/stty.c
+++ b/src/stty.c
@@ -373,7 +373,7 @@ static struct mode_info const mode_info[] =
{"crt", combination, OMIT, 0, 0},
{"dec", combination, OMIT, 0, 0},
- {nullptr, control, 0, 0, 0}
+ {NULL, control, 0, 0, 0}
};
/* Control character settings. */
@@ -430,7 +430,7 @@ static struct control_info const control_info[] =
/* These must be last because of the display routines. */
{"min", 1, VMIN},
{"time", 0, VTIME},
- {nullptr, 0, 0}
+ {NULL, 0, 0}
};
static char const *visible (cc_t ch);
@@ -485,13 +485,13 @@ enum
static struct option const longopts[] =
{
- {"all", no_argument, nullptr, 'a'},
- {"save", no_argument, nullptr, 'g'},
- {"file", required_argument, nullptr, 'F'},
- {"-debug", no_argument, nullptr, DEV_DEBUG_OPTION},
+ {"all", no_argument, NULL, 'a'},
+ {"save", no_argument, NULL, 'g'},
+ {"file", required_argument, NULL, 'F'},
+ {"-debug", no_argument, NULL, DEV_DEBUG_OPTION},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
/* Print format string MESSAGE and optional args.
@@ -1129,7 +1129,7 @@ apply_settings (bool checking, char const *device_name,
tcsetattr_options = reversed ? TCSANOW : TCSADRAIN;
continue;
}
- for (int i = 0; mode_info[i].name != nullptr; ++i)
+ for (int i = 0; mode_info[i].name != NULL; ++i)
{
if (streq (arg, mode_info[i].name))
{
@@ -1150,7 +1150,7 @@ apply_settings (bool checking, char const *device_name,
}
if (!match_found)
{
- for (int i = 0; control_info[i].name != nullptr; ++i)
+ for (int i = 0; control_info[i].name != NULL; ++i)
{
if (streq (arg, control_info[i].name))
{
@@ -1294,7 +1294,7 @@ main (int argc, char **argv)
bool verbose_output;
bool recoverable_output;
bool noargs = true;
- char *file_name = nullptr;
+ char *file_name = NULL;
char const *device_name;
initialize_main (&argc, &argv);
@@ -1320,7 +1320,7 @@ main (int argc, char **argv)
short and long options, --, POSIXLY_CORRECT, etc. */
while ((optc = getopt_long (argc - argi, argv + argi, "-agF:",
- longopts, nullptr))
+ longopts, NULL))
!= -1)
{
switch (optc)
@@ -1369,7 +1369,7 @@ main (int argc, char **argv)
/* Clear fully-parsed arguments, so they don't confuse the 2nd pass. */
while (opti < optind)
- argv[argi + opti++] = nullptr;
+ argv[argi + opti++] = NULL;
}
/* Specifying both -a and -g gets an error. */
@@ -1490,7 +1490,7 @@ set_mode (struct mode_info const *info, bool reversed, struct termios *mode)
bitsp = mode_type_flag (info->type, mode);
- if (bitsp == nullptr)
+ if (bitsp == NULL)
{
/* Combination mode. */
if (streq (info->name, "evenp") || streq (info->name, "parity"))
@@ -1848,8 +1848,8 @@ screen_columns (void)
/* Use $COLUMNS if it's in [1..INT_MAX]. */
char *col_string = getenv ("COLUMNS");
long int n_columns;
- if (!(col_string != nullptr
- && xstrtol (col_string, nullptr, 0, &n_columns, "") == LONGINT_OK
+ if (!(col_string != NULL
+ && xstrtol (col_string, NULL, 0, &n_columns, "") == LONGINT_OK
&& 0 < n_columns
&& n_columns <= INT_MAX))
n_columns = 80;
@@ -1876,7 +1876,7 @@ mode_type_flag (enum mode_type type, struct termios *mode)
return &mode->c_lflag;
case combination:
- return nullptr;
+ return NULL;
default:
unreachable ();
@@ -1957,7 +1957,7 @@ display_changed (struct termios *mode)
current_col = 0;
empty_line = true;
- for (int i = 0; mode_info[i].name != nullptr; ++i)
+ for (int i = 0; mode_info[i].name != NULL; ++i)
{
if (mode_info[i].flags & OMIT)
continue;
@@ -2042,7 +2042,7 @@ display_all (struct termios *mode, char const *device_name)
putchar ('\n');
current_col = 0;
- for (int i = 0; mode_info[i].name != nullptr; ++i)
+ for (int i = 0; mode_info[i].name != NULL; ++i)
{
if (mode_info[i].flags & OMIT)
continue;
@@ -2241,7 +2241,7 @@ sane_mode (struct termios *mode)
mode->c_cc[control_info[i].offset] = control_info[i].saneval;
}
- for (int i = 0; mode_info[i].name != nullptr; ++i)
+ for (int i = 0; mode_info[i].name != NULL; ++i)
{
if (mode_info[i].flags & NO_SETATTR)
continue;
diff --git a/src/sync.c b/src/sync.c
index 415ea2e330..a74bd86f6c 100644
--- a/src/sync.c
+++ b/src/sync.c
@@ -44,11 +44,11 @@ enum sync_mode
static struct option const long_options[] =
{
- {"data", no_argument, nullptr, 'd'},
- {"file-system", no_argument, nullptr, 'f'},
+ {"data", no_argument, NULL, 'd'},
+ {"file-system", no_argument, NULL, 'f'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
void
@@ -178,7 +178,7 @@ main (int argc, char **argv)
atexit (close_stdout);
int c;
- while ((c = getopt_long (argc, argv, "df", long_options, nullptr))
+ while ((c = getopt_long (argc, argv, "df", long_options, NULL))
!= -1)
{
switch (c)
diff --git a/src/system.h b/src/system.h
index 417964b303..c93eef3530 100644
--- a/src/system.h
+++ b/src/system.h
@@ -261,7 +261,7 @@ readdir_ignoring_dot_and_dotdot (DIR *dirp)
while (true)
{
struct dirent const *dp = readdir (dirp);
- if (dp == nullptr || ! dot_or_dotdot (dp->d_name))
+ if (dp == NULL || ! dot_or_dotdot (dp->d_name))
return dp;
}
}
@@ -289,7 +289,7 @@ directory_status (int fd_cwd, char const *dir)
return errno;
dirp = fdopendir (fd);
- if (dirp == nullptr)
+ if (dirp == NULL)
{
saved_errno = errno;
close (fd);
@@ -315,11 +315,11 @@ enum
};
#define GETOPT_HELP_OPTION_DECL \
- "help", no_argument, nullptr, GETOPT_HELP_CHAR
+ "help", no_argument, NULL, GETOPT_HELP_CHAR
#define GETOPT_VERSION_OPTION_DECL \
- "version", no_argument, nullptr, GETOPT_VERSION_CHAR
+ "version", no_argument, NULL, GETOPT_VERSION_CHAR
#define GETOPT_SELINUX_CONTEXT_OPTION_DECL \
- "context", optional_argument, nullptr, 'Z'
+ "context", optional_argument, NULL, 'Z'
#define case_GETOPT_HELP_CHAR \
case GETOPT_HELP_CHAR: \
@@ -356,7 +356,7 @@ enum
#define case_GETOPT_VERSION_CHAR(Program_name, Authors) \
case GETOPT_VERSION_CHAR: \
version_etc (stdout, Program_name, PACKAGE_NAME, Version, Authors, \
- (char *) nullptr); \
+ (char *) NULL); \
exit (EXIT_SUCCESS); \
break;
@@ -646,7 +646,7 @@ emit_ancillary_info (char const *program)
{ "sha256sum", "sha2 utilities" },
{ "sha384sum", "sha2 utilities" },
{ "sha512sum", "sha2 utilities" },
- { nullptr, nullptr }
+ { NULL, NULL }
};
char const *node = program;
@@ -662,7 +662,7 @@ emit_ancillary_info (char const *program)
/* Don't output this redundant message for English locales.
Note we still output for 'C' so that it gets included in the man page. */
- char const *lc_messages = setlocale (LC_MESSAGES, nullptr);
+ char const *lc_messages = setlocale (LC_MESSAGES, NULL);
if (lc_messages && STRNCMP_LIT (lc_messages, "en_"))
{
/* TRANSLATORS: Replace LANG_CODE in this URL with your language code
diff --git a/src/tac-pipe.c b/src/tac-pipe.c
index 301b2c6dcf..3a10e655d7 100644
--- a/src/tac-pipe.c
+++ b/src/tac-pipe.c
@@ -60,7 +60,7 @@ buf_init_from_stdin (Buf *x, char eol_byte)
{
char *buf = malloc (BUFFER_SIZE);
- if (buf == nullptr)
+ if (buf == NULL)
{
/* Fall back on the code that relies on a temporary file.
Write all buffers to that file and free them. */
@@ -93,7 +93,7 @@ buf_init_from_stdin (Buf *x, char eol_byte)
if (!last_byte_is_eol_byte)
{
char *buf = malloc (1);
- if (buf == nullptr)
+ if (buf == NULL)
{
/* FIXME: just like above */
ok = false;
@@ -126,7 +126,7 @@ buf_free (Buf *x)
{
for (size_t i = 0; i < x->n_bufs; i++)
free (x->p[i].start);
- obstack_free (OBS, nullptr);
+ obstack_free (OBS, NULL);
}
Line_ptr
diff --git a/src/tac.c b/src/tac.c
index b893316834..635dd909d5 100644
--- a/src/tac.c
+++ b/src/tac.c
@@ -100,12 +100,12 @@ static struct re_registers regs;
static struct option const longopts[] =
{
- {"before", no_argument, nullptr, 'b'},
- {"regex", no_argument, nullptr, 'r'},
- {"separator", required_argument, nullptr, 's'},
+ {"before", no_argument, NULL, 'b'},
+ {"regex", no_argument, NULL, 'r'},
+ {"separator", required_argument, NULL, 's'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
void
@@ -489,7 +489,7 @@ main (int argc, char **argv)
/* Initializer for file_list if no file-arguments
were specified on the command line. */
- static char const *const default_file_list[] = {"-", nullptr};
+ static char const *const default_file_list[] = {"-", NULL};
char const *const *file;
initialize_main (&argc, &argv);
@@ -504,7 +504,7 @@ main (int argc, char **argv)
sentinel_length = 1;
separator_ends_record = true;
- while ((optc = getopt_long (argc, argv, "brs:", longopts, nullptr)) != -1)
+ while ((optc = getopt_long (argc, argv, "brs:", longopts, NULL)) != -1)
{
switch (optc)
{
@@ -529,10 +529,10 @@ main (int argc, char **argv)
if (*separator == 0)
error (EXIT_FAILURE, 0, _("separator cannot be empty"));
- compiled_separator.buffer = nullptr;
+ compiled_separator.buffer = NULL;
compiled_separator.allocated = 0;
compiled_separator.fastmap = compiled_separator_fastmap;
- compiled_separator.translate = nullptr;
+ compiled_separator.translate = NULL;
error_message = re_compile_pattern (separator, strlen (separator),
&compiled_separator);
if (error_message)
@@ -576,7 +576,7 @@ main (int argc, char **argv)
}
/* Flush the output buffer. */
- output ((char *) nullptr, (char *) nullptr);
+ output ((char *) NULL, (char *) NULL);
if (have_read_stdin && close (STDIN_FILENO) < 0)
{
diff --git a/src/tail.c b/src/tail.c
index 74b36ef157..75463c43b0 100644
--- a/src/tail.c
+++ b/src/tail.c
@@ -107,7 +107,7 @@ enum Follow_mode
static char const *const follow_mode_string[] =
{
- "descriptor", "name", nullptr
+ "descriptor", "name", NULL
};
static enum Follow_mode const follow_mode_map[] =
@@ -216,7 +216,7 @@ static count_t max_n_unchanged_stats_between_opens =
/* The process IDs of the processes to watch (those writing the followed
files, or perhaps other processes the user cares about). */
static int nbpids = 0;
-static pid_t * pids = nullptr;
+static pid_t * pids = NULL;
static idx_t pids_alloc;
/* Used to determine the buffer size when scanning backwards in a file. */
@@ -251,26 +251,26 @@ enum
static struct option const long_options[] =
{
- {"bytes", required_argument, nullptr, 'c'},
- {"debug", no_argument, nullptr, DEBUG_PROGRAM_OPTION},
- {"follow", optional_argument, nullptr, LONG_FOLLOW_OPTION},
- {"lines", required_argument, nullptr, 'n'},
- {"max-unchanged-stats", required_argument, nullptr,
+ {"bytes", required_argument, NULL, 'c'},
+ {"debug", no_argument, NULL, DEBUG_PROGRAM_OPTION},
+ {"follow", optional_argument, NULL, LONG_FOLLOW_OPTION},
+ {"lines", required_argument, NULL, 'n'},
+ {"max-unchanged-stats", required_argument, NULL,
MAX_UNCHANGED_STATS_OPTION},
- {"-disable-inotify", no_argument, nullptr,
+ {"-disable-inotify", no_argument, NULL,
DISABLE_INOTIFY_OPTION}, /* do not document */
- {"pid", required_argument, nullptr, PID_OPTION},
- {"-presume-input-pipe", no_argument, nullptr,
+ {"pid", required_argument, NULL, PID_OPTION},
+ {"-presume-input-pipe", no_argument, NULL,
PRESUME_INPUT_PIPE_OPTION}, /* do not document */
- {"quiet", no_argument, nullptr, 'q'},
- {"retry", no_argument, nullptr, RETRY_OPTION},
- {"silent", no_argument, nullptr, 'q'},
- {"sleep-interval", required_argument, nullptr, 's'},
- {"verbose", no_argument, nullptr, 'v'},
- {"zero-terminated", no_argument, nullptr, 'z'},
+ {"quiet", no_argument, NULL, 'q'},
+ {"retry", no_argument, NULL, RETRY_OPTION},
+ {"silent", no_argument, NULL, 'q'},
+ {"sleep-interval", required_argument, NULL, 's'},
+ {"verbose", no_argument, NULL, 'v'},
+ {"zero-terminated", no_argument, NULL, 'z'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
void
@@ -581,7 +581,7 @@ file_lines (char const *prettyname, int fd, struct stat const *sb,
{
char const *nl;
nl = memrchr (buffer, line_end, n);
- if (nl == nullptr)
+ if (nl == NULL)
break;
n = nl - buffer;
if (n_lines-- == 0)
@@ -643,7 +643,7 @@ pipe_lines (char const *prettyname, int fd, count_t n_lines)
first = last = xmalloc (sizeof (LBUFFER));
first->nbytes = first->nlines = 0;
- first->next = nullptr;
+ first->next = NULL;
tmp = xmalloc (sizeof (LBUFFER));
/* Input is always read into a fresh buffer. */
@@ -654,7 +654,7 @@ pipe_lines (char const *prettyname, int fd, count_t n_lines)
break;
tmp->nbytes = n_read;
tmp->nlines = 0;
- tmp->next = nullptr;
+ tmp->next = NULL;
/* Count the number of newlines just read. */
{
@@ -784,7 +784,7 @@ pipe_bytes (char const *prettyname, int fd, count_t n_bytes,
first = last = xmalloc (sizeof (CBUFFER));
first->nbytes = 0;
- first->next = nullptr;
+ first->next = NULL;
tmp = xmalloc (sizeof (CBUFFER));
/* Input is always read into a fresh buffer. */
@@ -795,7 +795,7 @@ pipe_bytes (char const *prettyname, int fd, count_t n_bytes,
break;
read_pos += n_read;
tmp->nbytes = n_read;
- tmp->next = nullptr;
+ tmp->next = NULL;
total_bytes += tmp->nbytes;
/* If there is enough room in the last buffer read, just append the new
@@ -1486,8 +1486,8 @@ tail_forever_inotify (int wd, struct File_spec *f, int n_files,
char *evbuf;
idx_t evbuf_off = 0;
- wd_to_name = hash_initialize (n_files, nullptr, wd_hasher, wd_comparator,
- nullptr);
+ wd_to_name = hash_initialize (n_files, NULL, wd_hasher, wd_comparator,
+ NULL);
if (! wd_to_name)
xalloc_die ();
*wd_to_namep = wd_to_name;
@@ -1560,7 +1560,7 @@ tail_forever_inotify (int wd, struct File_spec *f, int n_files,
continue;
}
- if (hash_insert (wd_to_name, &(f[i])) == nullptr)
+ if (hash_insert (wd_to_name, &(f[i])) == NULL)
xalloc_die ();
found_watchable_file = true;
@@ -1788,7 +1788,7 @@ tail_forever_inotify (int wd, struct File_spec *f, int n_files,
close_fd (prev->fd, prev);
}
- if (hash_insert (wd_to_name, fspec) == nullptr)
+ if (hash_insert (wd_to_name, fspec) == NULL)
xalloc_die ();
}
@@ -2167,7 +2167,7 @@ parse_options (int argc, char **argv,
int c;
while ((c = getopt_long (argc, argv, "c:n:fFqs:vz0123456789",
- long_options, nullptr))
+ long_options, NULL))
!= -1)
{
switch (c)
@@ -2196,7 +2196,7 @@ parse_options (int argc, char **argv,
case 'f':
case LONG_FOLLOW_OPTION:
forever = true;
- if (optarg == nullptr)
+ if (optarg == NULL)
follow_mode = DEFAULT_FOLLOW_MODE;
else
follow_mode = XARGMATCH ("--follow", optarg,
@@ -2293,7 +2293,7 @@ parse_options (int argc, char **argv,
: ("warning: PID ignored;"
" --pid=PID is useful only when following")));
free (pids);
- pids = nullptr;
+ pids = NULL;
}
}
diff --git a/src/tee.c b/src/tee.c
index 0365d73007..a647954b28 100644
--- a/src/tee.c
+++ b/src/tee.c
@@ -58,17 +58,17 @@ static enum output_error output_error;
static struct option const long_options[] =
{
- {"append", no_argument, nullptr, 'a'},
- {"ignore-interrupts", no_argument, nullptr, 'i'},
- {"output-error", optional_argument, nullptr, 'p'},
+ {"append", no_argument, NULL, 'a'},
+ {"ignore-interrupts", no_argument, NULL, 'i'},
+ {"output-error", optional_argument, NULL, 'p'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
static char const *const output_error_args[] =
{
- "warn", "warn-nopipe", "exit", "exit-nopipe", nullptr
+ "warn", "warn-nopipe", "exit", "exit-nopipe", NULL
};
static enum output_error const output_error_types[] =
{
@@ -130,7 +130,7 @@ main (int argc, char **argv)
ignore_interrupts = false;
int optc;
- while ((optc = getopt_long (argc, argv, "aip", long_options, nullptr)) != -1)
+ while ((optc = getopt_long (argc, argv, "aip", long_options, NULL)) != -1)
{
switch (optc)
{
@@ -213,7 +213,7 @@ fail_output (FILE **descriptors, char **files, int i)
|| output_error == output_error_exit_nopipe,
w_errno, "%s", quotef (files[i]));
}
- descriptors[i] = nullptr;
+ descriptors[i] = NULL;
return fail;
}
@@ -227,7 +227,7 @@ tee_files (int nfiles, char **files, bool pipe_check)
{
size_t n_outputs = 0;
FILE **descriptors;
- bool *out_pollable IF_LINT ( = nullptr);
+ bool *out_pollable IF_LINT ( = NULL);
char buffer[BUFSIZ];
ssize_t bytes_read = 0;
int first_out = 0; /* idx of first non-null output in descriptors */
@@ -252,14 +252,14 @@ tee_files (int nfiles, char **files, bool pipe_check)
if (pipe_check)
out_pollable[0] = iopoll_output_ok (fileno (descriptors[0]));
files[0] = bad_cast (_("standard output"));
- setvbuf (stdout, nullptr, _IONBF, 0);
+ setvbuf (stdout, NULL, _IONBF, 0);
n_outputs++;
for (int i = 1; i <= nfiles; i++)
{
/* Do not treat "-" specially - as mandated by POSIX. */
descriptors[i] = fopen (files[i], mode_string);
- if (descriptors[i] == nullptr)
+ if (descriptors[i] == NULL)
{
if (pipe_check)
out_pollable[i] = false;
@@ -272,7 +272,7 @@ tee_files (int nfiles, char **files, bool pipe_check)
{
if (pipe_check)
out_pollable[i] = iopoll_output_ok (fileno (descriptors[i]));
- setvbuf (descriptors[i], nullptr, _IONBF, 0);
+ setvbuf (descriptors[i], NULL, _IONBF, 0);
n_outputs++;
}
}
diff --git a/src/temp-stream.c b/src/temp-stream.c
index 0159a1c7ef..6641ed9e81 100644
--- a/src/temp-stream.c
+++ b/src/temp-stream.c
@@ -83,11 +83,11 @@ record_or_unlink_tempfile (char const *fn, MAYBE_UNUSED FILE *fp)
bool
temp_stream (FILE **fp, char **file_name)
{
- static char *tempfile = nullptr;
+ static char *tempfile = NULL;
static FILE *tmp_fp;
- if (tempfile == nullptr)
+ if (tempfile == NULL)
{
- char *tempbuf = nullptr;
+ char *tempbuf = NULL;
size_t tempbuf_len = 128;
while (true)
@@ -98,7 +98,7 @@ temp_stream (FILE **fp, char **file_name)
return false;
}
- if (path_search (tempbuf, tempbuf_len, nullptr, "cutmp", true) == 0)
+ if (path_search (tempbuf, tempbuf_len, NULL, "cutmp", true) == 0)
break;
if (errno != EINVAL || PATH_MAX / 2 < tempbuf_len)
@@ -139,7 +139,7 @@ temp_stream (FILE **fp, char **file_name)
unlink (tempfile);
Reset:
free (tempfile);
- tempfile = nullptr;
+ tempfile = NULL;
return false;
}
diff --git a/src/test.c b/src/test.c
index df259f1d32..9e791c9055 100644
--- a/src/test.c
+++ b/src/test.c
@@ -492,7 +492,7 @@ unary_operator (void)
unary_advance ();
arg = find_int (argv[pos - 1]);
errno = 0;
- fd = strtol (arg, nullptr, 10);
+ fd = strtol (arg, NULL, 10);
return (errno != ERANGE && 0 <= fd && fd <= INT_MAX && isatty (fd));
}
@@ -821,7 +821,7 @@ main (int margc, char **margv)
if (streq (margv[1], "--version"))
{
version_etc (stdout, PROGRAM_NAME, PACKAGE_NAME, Version, AUTHORS,
- (char *) nullptr);
+ (char *) NULL);
test_main_return (EXIT_SUCCESS);
}
}
diff --git a/src/timeout.c b/src/timeout.c
index d5d2e8feb1..41e67ce71f 100644
--- a/src/timeout.c
+++ b/src/timeout.c
@@ -96,14 +96,14 @@ static char const *command;
static struct option const long_options[] =
{
- {"foreground", no_argument, nullptr, 'f'},
- {"kill-after", required_argument, nullptr, 'k'},
- {"preserve-status", no_argument, nullptr, 'p'},
- {"signal", required_argument, nullptr, 's'},
- {"verbose", no_argument, nullptr, 'v'},
+ {"foreground", no_argument, NULL, 'f'},
+ {"kill-after", required_argument, NULL, 'k'},
+ {"preserve-status", no_argument, NULL, 'p'},
+ {"signal", required_argument, NULL, 's'},
+ {"verbose", no_argument, NULL, 'v'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
/* Start the timeout after which we'll receive a SIGALRM.
@@ -121,9 +121,9 @@ settimeout (double duration, bool warn)
struct timespec ts = dtotimespec (duration);
struct itimerspec its = {.it_interval = {0}, .it_value = ts};
timer_t timerid;
- if (timer_create (CLOCK_REALTIME, nullptr, &timerid) == 0)
+ if (timer_create (CLOCK_REALTIME, NULL, &timerid) == 0)
{
- if (timer_settime (timerid, 0, &its, nullptr) == 0)
+ if (timer_settime (timerid, 0, &its, NULL) == 0)
return;
else
{
@@ -154,7 +154,7 @@ settimeout (double duration, bool warn)
tv.tv_usec--;
}
struct itimerval it = {.it_interval = {0}, .it_value = tv };
- if (setitimer (ITIMER_REAL, &it, nullptr) == 0)
+ if (setitimer (ITIMER_REAL, &it, NULL) == 0)
return;
else
{
@@ -395,7 +395,7 @@ unblock_signal (int sig)
sigset_t unblock_set;
sigemptyset (&unblock_set);
sigaddset (&unblock_set, sig);
- if (sigprocmask (SIG_UNBLOCK, &unblock_set, nullptr) != 0)
+ if (sigprocmask (SIG_UNBLOCK, &unblock_set, NULL) != 0)
error (0, errno, _("warning: sigprocmask"));
}
@@ -408,7 +408,7 @@ install_sigchld (void)
sa.sa_flags = SA_RESTART; /* Restart syscalls if possible, as that's
more likely to work cleanly. */
- sigaction (SIGCHLD, &sa, nullptr);
+ sigaction (SIGCHLD, &sa, NULL);
/* We inherit the signal mask from our parent process,
so ensure SIGCHLD is not blocked. */
@@ -427,7 +427,7 @@ sig_needs_handling (int sig, int sigterm)
set to SIG_IGN by default. I.e., those signals will
not be propagated through background timeout jobs. */
struct sigaction old_sa;
- sigaction (sig, nullptr, &old_sa);
+ sigaction (sig, NULL, &old_sa);
bool ret = old_sa.sa_handler != SIG_IGN;
return ret;
}
@@ -443,14 +443,14 @@ install_cleanup (int sigterm)
for (int i = 0; i < countof (term_sig); i++)
if (sig_needs_handling (term_sig[i], sigterm))
- sigaction (term_sig[i], &sa, nullptr);
+ sigaction (term_sig[i], &sa, NULL);
/* Real Time signals also terminate by default. */
for (int s = SIGRTMIN; s <= SIGRTMAX; s++)
if (sig_needs_handling (s, sigterm))
- sigaction (s, &sa, nullptr);
+ sigaction (s, &sa, NULL);
- sigaction (sigterm, &sa, nullptr); /* user specified termination signal. */
+ sigaction (sigterm, &sa, NULL); /* user specified termination signal. */
}
/* Block all signals which were registered with cleanup() as the signal
@@ -518,7 +518,7 @@ main (int argc, char **argv)
initialize_exit_failure (EXIT_CANCELED);
atexit (close_stdout);
- while ((c = getopt_long (argc, argv, "+fk:ps:v", long_options, nullptr))
+ while ((c = getopt_long (argc, argv, "+fk:ps:v", long_options, NULL))
!= -1)
{
switch (c)
@@ -607,7 +607,7 @@ main (int argc, char **argv)
return EXIT_CANCELED;
/* Restore signal mask for child. */
- if (sigprocmask (SIG_SETMASK, &orig_set, nullptr) != 0)
+ if (sigprocmask (SIG_SETMASK, &orig_set, NULL) != 0)
{
error (0, errno, _("child failed to reset signal mask"));
return EXIT_CANCELED;
diff --git a/src/touch.c b/src/touch.c
index bc39d7ebcb..3090340c07 100644
--- a/src/touch.c
+++ b/src/touch.c
@@ -81,20 +81,20 @@ enum
static struct option const longopts[] =
{
- {"time", required_argument, nullptr, TIME_OPTION},
- {"no-create", no_argument, nullptr, 'c'},
- {"date", required_argument, nullptr, 'd'},
- {"reference", required_argument, nullptr, 'r'},
- {"no-dereference", no_argument, nullptr, 'h'},
+ {"time", required_argument, NULL, TIME_OPTION},
+ {"no-create", no_argument, NULL, 'c'},
+ {"date", required_argument, NULL, 'd'},
+ {"reference", required_argument, NULL, 'r'},
+ {"no-dereference", no_argument, NULL, 'h'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
/* Valid arguments to the '--time' option. */
static char const *const time_args[] =
{
- "atime", "access", "use", "mtime", "modify", nullptr
+ "atime", "access", "use", "mtime", "modify", NULL
};
/* The bits in 'change_times' that those arguments set. */
@@ -149,12 +149,12 @@ touch (char const *file)
if (amtime_now)
{
- /* Pass nullptr to futimens so it will not fail if we have
+ /* Pass NULL to futimens so it will not fail if we have
write access to the file, but don't own it. */
- t = nullptr;
+ t = NULL;
}
- char const *file_opt = fd == STDOUT_FILENO ? nullptr : file;
+ char const *file_opt = fd == STDOUT_FILENO ? NULL : file;
int atflag = no_dereference ? AT_SYMLINK_NOFOLLOW : 0;
int utime_errno = (fdutimensat (fd, AT_FDCWD, file_opt, t, atflag) == 0
? 0 : errno);
@@ -261,7 +261,7 @@ main (int argc, char **argv)
int c;
bool date_set = false;
bool ok = true;
- char const *flex_date = nullptr;
+ char const *flex_date = NULL;
initialize_main (&argc, &argv);
set_program_name (argv[0]);
@@ -274,7 +274,7 @@ main (int argc, char **argv)
change_times = 0;
no_create = use_ref = false;
- while ((c = getopt_long (argc, argv, "acd:fhmr:t:", longopts, nullptr)) != -1)
+ while ((c = getopt_long (argc, argv, "acd:fhmr:t:", longopts, NULL)) != -1)
{
switch (c)
{
@@ -402,7 +402,7 @@ main (int argc, char **argv)
struct tm const *tm = localtime (&newtime[0].tv_sec);
/* Technically, it appears that even a deliberate attempt to cause
- the above localtime to return nullptr will always fail because our
+ the above localtime to return NULL will always fail because our
posixtime implementation rejects all dates for which localtime
would fail. However, skip the warning if it ever fails. */
if (tm)
diff --git a/src/tr.c b/src/tr.c
index 051274b382..139cf971c5 100644
--- a/src/tr.c
+++ b/src/tr.c
@@ -267,13 +267,13 @@ static char xlate[N_CHARS];
static struct option const long_options[] =
{
- {"complement", no_argument, nullptr, 'c'},
- {"delete", no_argument, nullptr, 'd'},
- {"squeeze-repeats", no_argument, nullptr, 's'},
- {"truncate-set1", no_argument, nullptr, 't'},
+ {"complement", no_argument, NULL, 'c'},
+ {"delete", no_argument, NULL, 'd'},
+ {"squeeze-repeats", no_argument, NULL, 's'},
+ {"truncate-set1", no_argument, NULL, 't'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
void
@@ -589,7 +589,7 @@ make_printable_str (char const *s, size_t len)
for (size_t i = 0; i < len; i++)
{
char buf[5];
- char const *tmp = nullptr;
+ char const *tmp = NULL;
unsigned char c = s[i];
switch (c)
@@ -641,7 +641,7 @@ static void
append_normal_char (struct Spec_list *list, unsigned char c)
{
struct List_element *new = xmalloc (sizeof *new);
- new->next = nullptr;
+ new->next = NULL;
new->type = RE_NORMAL_CHAR;
new->u.normal_char = c;
list->tail->next = new;
@@ -669,7 +669,7 @@ append_range (struct Spec_list *list, unsigned char first, unsigned char last)
return false;
}
struct List_element *new = xmalloc (sizeof *new);
- new->next = nullptr;
+ new->next = NULL;
new->type = RE_RANGE;
new->u.range.first_char = first;
new->u.range.last_char = last;
@@ -691,7 +691,7 @@ append_char_class (struct Spec_list *list,
if (char_class == CC_NO_CLASS)
return false;
struct List_element *new = xmalloc (sizeof *new);
- new->next = nullptr;
+ new->next = NULL;
new->type = RE_CHAR_CLASS;
new->u.char_class = char_class;
list->tail->next = new;
@@ -709,7 +709,7 @@ append_repeated_char (struct Spec_list *list, unsigned char the_char,
count repeat_count)
{
struct List_element *new = xmalloc (sizeof *new);
- new->next = nullptr;
+ new->next = NULL;
new->type = RE_REPEATED_CHAR;
new->u.repeated_char.the_repeated_char = the_char;
new->u.repeated_char.repeat_count = repeat_count;
@@ -731,7 +731,7 @@ append_equiv_class (struct Spec_list *list,
return false;
struct List_element *new = xmalloc (sizeof *new);
- new->next = nullptr;
+ new->next = NULL;
new->type = RE_EQUIV_CLASS;
new->u.equiv_code = *equiv_class_str;
list->tail->next = new;
@@ -797,7 +797,7 @@ find_bracketed_repeat (const struct E_string *es, size_t start_idx,
char const *digit_str = &es->s[start_idx + 2];
char *d_end;
if ((xstrtoumax (digit_str, &d_end, *digit_str == '0' ? 8 : 10,
- repeat_count, nullptr)
+ repeat_count, NULL)
!= LONGINT_OK)
|| REPEAT_COUNT_MAXIMUM < *repeat_count
|| digit_str + digit_str_len != d_end)
@@ -1024,7 +1024,7 @@ get_next (struct Spec_list *s, enum Upper_Lower_class *class)
}
p = s->tail;
- if (p == nullptr)
+ if (p == NULL)
return -1;
switch (p->type)
@@ -1139,7 +1139,7 @@ card_of_complement (struct Spec_list *s)
bool in_set[N_CHARS] = {0};
s->state = BEGIN_STATE;
- while ((c = get_next (s, nullptr)) != -1)
+ while ((c = get_next (s, NULL)) != -1)
{
cardinality -= (!in_set[c]);
in_set[c] = true;
@@ -1327,7 +1327,7 @@ spec_init (struct Spec_list *spec_list)
{
struct List_element *new = xmalloc (sizeof *new);
spec_list->head = spec_list->tail = new;
- spec_list->head->next = nullptr;
+ spec_list->head->next = NULL;
}
/* This function makes two passes over the argument string S. The first
@@ -1410,10 +1410,10 @@ homogeneous_spec_list (struct Spec_list *s)
s->state = BEGIN_STATE;
- if ((b = get_next (s, nullptr)) == -1)
+ if ((b = get_next (s, NULL)) == -1)
return false;
- while ((c = get_next (s, nullptr)) != -1)
+ while ((c = get_next (s, NULL)) != -1)
if (c != b)
return false;
@@ -1660,7 +1660,7 @@ set_initialize (struct Spec_list *s, bool complement_this_set, bool *in_set)
int c;
s->state = BEGIN_STATE;
- while ((c = get_next (s, nullptr)) != -1)
+ while ((c = get_next (s, NULL)) != -1)
in_set[c] = true;
if (complement_this_set)
for (size_t i = 0; i < N_CHARS; i++)
@@ -1686,7 +1686,7 @@ main (int argc, char **argv)
atexit (close_stdout);
- while ((c = getopt_long (argc, argv, "+AcCdst", long_options, nullptr)) != -1)
+ while ((c = getopt_long (argc, argv, "+AcCdst", long_options, NULL)) != -1)
{
switch (c)
{
@@ -1765,7 +1765,7 @@ main (int argc, char **argv)
main_exit (EXIT_FAILURE);
}
else
- s2 = nullptr;
+ s2 = NULL;
validate (s1, s2);
@@ -1814,7 +1814,7 @@ main (int argc, char **argv)
{
if (!in_s1[i])
{
- int ch = get_next (s2, nullptr);
+ int ch = get_next (s2, NULL);
affirm (ch != -1 || truncate_set1);
if (ch == -1)
{
diff --git a/src/true.c b/src/true.c
index 866a50d5d3..f5d71bb6b9 100644
--- a/src/true.c
+++ b/src/true.c
@@ -73,7 +73,7 @@ main (int argc, char **argv)
if (streq (argv[1], "--version"))
version_etc (stdout, PROGRAM_NAME, PACKAGE_NAME, Version, AUTHORS,
- (char *) nullptr);
+ (char *) NULL);
}
return EXIT_STATUS;
diff --git a/src/truncate.c b/src/truncate.c
index 13de236875..50e6f70b18 100644
--- a/src/truncate.c
+++ b/src/truncate.c
@@ -47,13 +47,13 @@ static char const *ref_file;
static struct option const longopts[] =
{
- {"no-create", no_argument, nullptr, 'c'},
- {"io-blocks", no_argument, nullptr, 'o'},
- {"reference", required_argument, nullptr, 'r'},
- {"size", required_argument, nullptr, 's'},
+ {"no-create", no_argument, NULL, 'c'},
+ {"io-blocks", no_argument, NULL, 'o'},
+ {"reference", required_argument, NULL, 'r'},
+ {"size", required_argument, NULL, 's'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
typedef enum
@@ -212,7 +212,7 @@ main (int argc, char **argv)
atexit (close_stdout);
- while ((c = getopt_long (argc, argv, "cor:s:", longopts, nullptr)) != -1)
+ while ((c = getopt_long (argc, argv, "cor:s:", longopts, NULL)) != -1)
{
switch (c)
{
diff --git a/src/tsort.c b/src/tsort.c
index fd2c5d6f68..f73529e802 100644
--- a/src/tsort.c
+++ b/src/tsort.c
@@ -60,13 +60,13 @@ struct item
};
/* The head of the sorted list. */
-static struct item *head = nullptr;
+static struct item *head = NULL;
/* The tail of the list of 'zeros', strings that have no predecessors. */
-static struct item *zeros = nullptr;
+static struct item *zeros = NULL;
/* Used for loop detection. */
-static struct item *loop = nullptr;
+static struct item *loop = NULL;
/* The number of strings to sort. */
static size_t n_strings = 0;
@@ -123,7 +123,7 @@ search_item (struct item *root, char const *str)
/* Make sure the tree is not empty, since that is what the algorithm
below expects. */
- if (root->right == nullptr)
+ if (root->right == NULL)
return (root->right = new_item (str));
/* A1. Initialize. */
@@ -143,7 +143,7 @@ search_item (struct item *root, char const *str)
else
q = p->right;
- if (q == nullptr)
+ if (q == NULL)
{
/* A5. Insert. */
q = new_item (str);
@@ -288,7 +288,7 @@ scan_zeros (struct item *k)
/* Ignore strings that have already been printed. */
if (k->count == 0 && !k->printed)
{
- if (head == nullptr)
+ if (head == NULL)
head = k;
else
zeros->qlink = k;
@@ -325,7 +325,7 @@ detect_loop (struct item *k)
/* K does not have to be part of a cycle. It is however part of
a graph that contains a cycle. */
- if (loop == nullptr)
+ if (loop == NULL)
/* Start traversing the graph at K. */
loop = k;
else
@@ -358,7 +358,7 @@ detect_loop (struct item *k)
/* Tidy things up since we might have to
detect another loop. */
- loop->qlink = nullptr;
+ loop->qlink = NULL;
loop = tmp;
}
@@ -366,7 +366,7 @@ detect_loop (struct item *k)
{
struct item *tmp = loop->qlink;
- loop->qlink = nullptr;
+ loop->qlink = NULL;
loop = tmp;
}
@@ -396,16 +396,16 @@ detect_loop (struct item *k)
static bool
recurse_tree (struct item *root, bool (*action) (struct item *))
{
- if (root->left == nullptr && root->right == nullptr)
+ if (root->left == NULL && root->right == NULL)
return (*action) (root);
else
{
- if (root->left != nullptr)
+ if (root->left != NULL)
if (recurse_tree (root->left, action))
return true;
if ((*action) (root))
return true;
- if (root->right != nullptr)
+ if (root->right != NULL)
if (recurse_tree (root->right, action))
return true;
}
@@ -429,13 +429,13 @@ static _Noreturn void
tsort (char const *file)
{
bool ok = true;
- struct item *j = nullptr;
- struct item *k = nullptr;
+ struct item *j = NULL;
+ struct item *k = NULL;
token_buffer tokenbuffer;
bool is_stdin = streq (file, "-");
/* Initialize the head of the tree holding the strings we're sorting. */
- struct item *root = new_item (nullptr);
+ struct item *root = new_item (NULL);
if (!is_stdin && ! freopen (file, "r", stdin))
error (EXIT_FAILURE, errno, "%s", quotef (file));
@@ -462,13 +462,13 @@ tsort (char const *file)
{
/* T3. Record the relation. */
record_relation (j, k);
- k = nullptr;
+ k = NULL;
}
j = k;
}
- if (k != nullptr)
+ if (k != NULL)
error (EXIT_FAILURE, 0, _("%s: input contains an odd number of tokens"),
quotef (file));
@@ -544,9 +544,9 @@ main (int argc, char **argv)
{
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
- int c = getopt_long (argc, argv, "w", long_options, nullptr);
+ int c = getopt_long (argc, argv, "w", long_options, NULL);
if (c == -1)
break;
diff --git a/src/tty.c b/src/tty.c
index 0dc73a4acd..ae002f4475 100644
--- a/src/tty.c
+++ b/src/tty.c
@@ -48,11 +48,11 @@ static bool silent;
static struct option const longopts[] =
{
- {"silent", no_argument, nullptr, 's'},
- {"quiet", no_argument, nullptr, 's'},
+ {"silent", no_argument, NULL, 's'},
+ {"quiet", no_argument, NULL, 's'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
void
@@ -91,7 +91,7 @@ main (int argc, char **argv)
silent = false;
- while ((optc = getopt_long (argc, argv, "s", longopts, nullptr)) != -1)
+ while ((optc = getopt_long (argc, argv, "s", longopts, NULL)) != -1)
{
switch (optc)
{
diff --git a/src/uname.c b/src/uname.c
index 7f6873fc4c..09495ad9b4 100644
--- a/src/uname.c
+++ b/src/uname.c
@@ -81,27 +81,27 @@
static struct option const uname_long_options[] =
{
- {"all", no_argument, nullptr, 'a'},
- {"kernel-name", no_argument, nullptr, 's'},
- {"sysname", no_argument, nullptr, 's'}, /* Obsolescent. */
- {"nodename", no_argument, nullptr, 'n'},
- {"kernel-release", no_argument, nullptr, 'r'},
- {"release", no_argument, nullptr, 'r'}, /* Obsolescent. */
- {"kernel-version", no_argument, nullptr, 'v'},
- {"machine", no_argument, nullptr, 'm'},
- {"processor", no_argument, nullptr, 'p'},
- {"hardware-platform", no_argument, nullptr, 'i'},
- {"operating-system", no_argument, nullptr, 'o'},
+ {"all", no_argument, NULL, 'a'},
+ {"kernel-name", no_argument, NULL, 's'},
+ {"sysname", no_argument, NULL, 's'}, /* Obsolescent. */
+ {"nodename", no_argument, NULL, 'n'},
+ {"kernel-release", no_argument, NULL, 'r'},
+ {"release", no_argument, NULL, 'r'}, /* Obsolescent. */
+ {"kernel-version", no_argument, NULL, 'v'},
+ {"machine", no_argument, NULL, 'm'},
+ {"processor", no_argument, NULL, 'p'},
+ {"hardware-platform", no_argument, NULL, 'i'},
+ {"operating-system", no_argument, NULL, 'o'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
static struct option const arch_long_options[] =
{
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
void
@@ -191,7 +191,7 @@ decode_switches (int argc, char **argv)
if (uname_mode == UNAME_ARCH)
{
while ((c = getopt_long (argc, argv, "",
- arch_long_options, nullptr))
+ arch_long_options, NULL))
!= -1)
{
switch (c)
@@ -209,7 +209,7 @@ decode_switches (int argc, char **argv)
else
{
while ((c = getopt_long (argc, argv, "asnrvmpio",
- uname_long_options, nullptr))
+ uname_long_options, NULL))
!= -1)
{
switch (c)
diff --git a/src/unexpand.c b/src/unexpand.c
index be5128be3e..ec6b222ba0 100644
--- a/src/unexpand.c
+++ b/src/unexpand.c
@@ -58,12 +58,12 @@ enum
static struct option const longopts[] =
{
- {"tabs", required_argument, nullptr, 't'},
- {"all", no_argument, nullptr, 'a'},
- {"first-only", no_argument, nullptr, CONVERT_FIRST_ONLY_OPTION},
+ {"tabs", required_argument, NULL, 't'},
+ {"all", no_argument, NULL, 'a'},
+ {"first-only", no_argument, NULL, CONVERT_FIRST_ONLY_OPTION},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
void
@@ -104,7 +104,7 @@ static void
unexpand (void)
{
/* Input stream. */
- FILE *fp = next_file (nullptr);
+ FILE *fp = next_file (NULL);
/* The array of pending blanks. In non-POSIX locales, blanks can
include characters other than spaces, so the blanks must be
@@ -267,7 +267,7 @@ main (int argc, char **argv)
atexit (close_stdout);
- while ((c = getopt_long (argc, argv, ",0123456789at:", longopts, nullptr))
+ while ((c = getopt_long (argc, argv, ",0123456789at:", longopts, NULL))
!= -1)
{
switch (c)
@@ -311,7 +311,7 @@ main (int argc, char **argv)
finalize_tab_stops ();
- set_file_list ((optind < argc) ? &argv[optind] : nullptr);
+ set_file_list ((optind < argc) ? &argv[optind] : NULL);
unexpand ();
diff --git a/src/uniq.c b/src/uniq.c
index 4afcf29c87..ab6238878c 100644
--- a/src/uniq.c
+++ b/src/uniq.c
@@ -85,7 +85,7 @@ enum delimit_method
static char const *const delimit_method_string[] =
{
- "none", "prepend", "separate", nullptr
+ "none", "prepend", "separate", NULL
};
static enum delimit_method const delimit_method_map[] =
@@ -116,7 +116,7 @@ enum grouping_method
static char const *const grouping_method_string[] =
{
- "prepend", "append", "separate", "both", nullptr
+ "prepend", "append", "separate", "both", NULL
};
static enum grouping_method const grouping_method_map[] =
@@ -133,19 +133,19 @@ enum
static struct option const longopts[] =
{
- {"count", no_argument, nullptr, 'c'},
- {"repeated", no_argument, nullptr, 'd'},
- {"all-repeated", optional_argument, nullptr, 'D'},
- {"group", optional_argument, nullptr, GROUP_OPTION},
- {"ignore-case", no_argument, nullptr, 'i'},
- {"unique", no_argument, nullptr, 'u'},
- {"skip-fields", required_argument, nullptr, 'f'},
- {"skip-chars", required_argument, nullptr, 's'},
- {"check-chars", required_argument, nullptr, 'w'},
- {"zero-terminated", no_argument, nullptr, 'z'},
+ {"count", no_argument, NULL, 'c'},
+ {"repeated", no_argument, NULL, 'd'},
+ {"all-repeated", optional_argument, NULL, 'D'},
+ {"group", optional_argument, NULL, GROUP_OPTION},
+ {"ignore-case", no_argument, NULL, 'i'},
+ {"unique", no_argument, NULL, 'u'},
+ {"skip-fields", required_argument, NULL, 'f'},
+ {"skip-chars", required_argument, NULL, 's'},
+ {"check-chars", required_argument, NULL, 'w'},
+ {"zero-terminated", no_argument, NULL, 'z'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
void
@@ -227,7 +227,7 @@ static idx_t
size_opt (char const *opt, char const *msgid)
{
intmax_t size;
- if (LONGINT_OVERFLOW < xstrtoimax (opt, nullptr, 10, &size, "")
+ if (LONGINT_OVERFLOW < xstrtoimax (opt, NULL, 10, &size, "")
|| size < 0)
error (EXIT_FAILURE, 0, "%s: %s", opt, _(msgid));
return MIN (size, IDX_MAX);
@@ -352,7 +352,7 @@ check_file (char const *infile, char const *outfile, char delimiter)
*/
if (output_unique && output_first_repeated && !count_occurrences)
{
- char *prevfield = nullptr;
+ char *prevfield = NULL;
idx_t prevlen;
bool first_group_printed = false;
@@ -467,7 +467,7 @@ int
main (int argc, char **argv)
{
int optc = 0;
- bool posixly_correct = (getenv ("POSIXLY_CORRECT") != nullptr);
+ bool posixly_correct = (getenv ("POSIXLY_CORRECT") != NULL);
enum Skip_field_option_type skip_field_option_type = SFO_NONE;
int nfiles = 0;
char const *file[2];
@@ -493,7 +493,7 @@ main (int argc, char **argv)
|| (posixly_correct && nfiles != 0)
|| ((optc = getopt_long (argc, argv,
"-0123456789Dcdf:is:uw:z",
- longopts, nullptr))
+ longopts, NULL))
== -1))
{
if (argc <= optind)
@@ -512,7 +512,7 @@ main (int argc, char **argv)
intmax_t size;
if (optarg[0] == '+'
&& ! strict_posix2 ()
- && (xstrtoimax (optarg, nullptr, 10, &size, "")
+ && (xstrtoimax (optarg, NULL, 10, &size, "")
<= LONGINT_OVERFLOW))
skip_chars = MIN (size, IDX_MAX);
else if (nfiles == 2)
@@ -559,7 +559,7 @@ main (int argc, char **argv)
case 'D':
output_unique = false;
output_later_repeated = true;
- if (optarg == nullptr)
+ if (optarg == NULL)
delimit_groups = DM_NONE;
else
delimit_groups = XARGMATCH ("--all-repeated", optarg,
@@ -569,7 +569,7 @@ main (int argc, char **argv)
break;
case GROUP_OPTION:
- if (optarg == nullptr)
+ if (optarg == NULL)
grouping = GM_SEPARATE;
else
grouping = XARGMATCH ("--group", optarg,
diff --git a/src/unlink.c b/src/unlink.c
index a565b55016..0d1b0f6ea4 100644
--- a/src/unlink.c
+++ b/src/unlink.c
@@ -65,7 +65,7 @@ main (int argc, char **argv)
parse_gnu_standard_options_only (argc, argv, PROGRAM_NAME, PACKAGE_NAME,
Version, true, usage, AUTHORS,
- (char const *) nullptr);
+ (char const *) NULL);
if (argc < optind + 1)
{
diff --git a/src/uptime.c b/src/uptime.c
index 37d3206f92..a52b9567dc 100644
--- a/src/uptime.c
+++ b/src/uptime.c
@@ -60,8 +60,8 @@ print_uptime (idx_t n, STRUCT_UTMP const *utmp_buf)
status = EXIT_FAILURE;
}
- time_t time_now = time (nullptr);
- struct tm *tmn = time_now == (time_t) -1 ? nullptr : localtime (&time_now);
+ time_t time_now = time (NULL);
+ struct tm *tmn = time_now == (time_t) -1 ? NULL : localtime (&time_now);
/* procps' version of uptime also prints the seconds field, but
previous versions of coreutils don't. */
if (tmn)
@@ -132,7 +132,7 @@ uptime (char const *filename, int options)
{
error (0, errno, "%s", quotef (filename));
n_users = 0;
- utmp_buf = nullptr;
+ utmp_buf = NULL;
}
int print_uptime_status = print_uptime (n_users, utmp_buf);
@@ -186,7 +186,7 @@ main (int argc, char **argv)
parse_gnu_standard_options_only (argc, argv, PROGRAM_NAME, PACKAGE_NAME,
Version, true, usage, AUTHORS,
- (char const *) nullptr);
+ (char const *) NULL);
switch (argc - optind)
{
diff --git a/src/users.c b/src/users.c
index 82ccd32b71..4267126b8b 100644
--- a/src/users.c
+++ b/src/users.c
@@ -126,7 +126,7 @@ main (int argc, char **argv)
parse_gnu_standard_options_only (argc, argv, PROGRAM_NAME, PACKAGE_NAME,
Version, true, usage, AUTHORS,
- (char const *) nullptr);
+ (char const *) NULL);
switch (argc - optind)
{
diff --git a/src/wc.c b/src/wc.c
index 77bfc66bb5..88a386a0c9 100644
--- a/src/wc.c
+++ b/src/wc.c
@@ -99,17 +99,17 @@ enum
static struct option const longopts[] =
{
- {"bytes", no_argument, nullptr, 'c'},
- {"chars", no_argument, nullptr, 'm'},
- {"lines", no_argument, nullptr, 'l'},
- {"words", no_argument, nullptr, 'w'},
- {"debug", no_argument, nullptr, DEBUG_PROGRAM_OPTION},
- {"files0-from", required_argument, nullptr, FILES0_FROM_OPTION},
- {"max-line-length", no_argument, nullptr, 'L'},
- {"total", required_argument, nullptr, TOTAL_OPTION},
+ {"bytes", no_argument, NULL, 'c'},
+ {"chars", no_argument, NULL, 'm'},
+ {"lines", no_argument, NULL, 'l'},
+ {"words", no_argument, NULL, 'w'},
+ {"debug", no_argument, NULL, DEBUG_PROGRAM_OPTION},
+ {"files0-from", required_argument, NULL, FILES0_FROM_OPTION},
+ {"max-line-length", no_argument, NULL, 'L'},
+ {"total", required_argument, NULL, TOTAL_OPTION},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
enum total_type
@@ -121,7 +121,7 @@ enum total_type
};
static char const *const total_args[] =
{
- "auto", "always", "only", "never", nullptr
+ "auto", "always", "only", "never", NULL
};
static enum total_type const total_types[] =
{
@@ -750,7 +750,7 @@ main (int argc, char **argv)
int optc;
idx_t nfiles;
char **files;
- char *files_from = nullptr;
+ char *files_from = NULL;
struct fstatus *fstatus;
struct Tokens tok;
@@ -765,15 +765,15 @@ main (int argc, char **argv)
page_size = getpagesize ();
/* Line buffer stdout to ensure lines are written atomically and immediately
so that processes running in parallel do not intersperse their output. */
- setvbuf (stdout, nullptr, _IOLBF, 0);
+ setvbuf (stdout, NULL, _IOLBF, 0);
- posixly_correct = (getenv ("POSIXLY_CORRECT") != nullptr);
+ posixly_correct = (getenv ("POSIXLY_CORRECT") != NULL);
print_lines = print_words = print_chars = print_bytes = false;
print_linelength = false;
total_lines = total_words = total_chars = total_bytes = max_line_length = 0;
- while ((optc = getopt_long (argc, argv, "clLmw", longopts, nullptr)) != -1)
+ while ((optc = getopt_long (argc, argv, "clLmw", longopts, NULL)) != -1)
switch (optc)
{
case 'c':
@@ -848,7 +848,7 @@ main (int argc, char **argv)
else
{
stream = fopen (files_from, "r");
- if (stream == nullptr)
+ if (stream == NULL)
error (EXIT_FAILURE, errno, _("cannot open %s for reading"),
quoteaf (files_from));
}
@@ -871,14 +871,14 @@ main (int argc, char **argv)
}
else
{
- files = nullptr;
+ files = NULL;
nfiles = 0;
ai = argv_iter_init_stream (stream);
}
}
else
{
- static char *stdin_only[] = { nullptr };
+ static char *stdin_only[] = { NULL };
files = (optind < argc ? argv + optind : stdin_only);
nfiles = (optind < argc ? argc - optind : 1);
ai = argv_iter_init_argv (files);
@@ -915,7 +915,7 @@ main (int argc, char **argv)
among many, knowing the record number may help.
FIXME: currently print the record number only with
--files0-from=FILE. Maybe do it for argv, too? */
- if (files_from == nullptr)
+ if (files_from == NULL)
error (0, 0, "%s", _("invalid zero-length file name"));
else
{
@@ -957,7 +957,7 @@ main (int argc, char **argv)
However, no arguments on the --files0-from input stream is an error
means don't read anything. */
if (ok && !files_from && argv_iter_n_args (ai) == 0)
- ok &= wc_file (nullptr, &fstatus[0]);
+ ok &= wc_file (NULL, &fstatus[0]);
if (read_tokens)
readtokens0_free (&tok);
@@ -992,7 +992,7 @@ main (int argc, char **argv)
write_counts (total_lines, total_words, total_chars, total_bytes,
max_line_length,
- total_mode != total_only ? _("total") : nullptr);
+ total_mode != total_only ? _("total") : NULL);
}
argv_iter_free (ai);
diff --git a/src/who.c b/src/who.c
index fb834467a2..3326e697f6 100644
--- a/src/who.c
+++ b/src/who.c
@@ -152,24 +152,24 @@ enum
static struct option const longopts[] =
{
- {"all", no_argument, nullptr, 'a'},
- {"boot", no_argument, nullptr, 'b'},
- {"count", no_argument, nullptr, 'q'},
- {"dead", no_argument, nullptr, 'd'},
- {"heading", no_argument, nullptr, 'H'},
- {"login", no_argument, nullptr, 'l'},
- {"lookup", no_argument, nullptr, LOOKUP_OPTION},
- {"message", no_argument, nullptr, 'T'},
- {"mesg", no_argument, nullptr, 'T'},
- {"process", no_argument, nullptr, 'p'},
- {"runlevel", no_argument, nullptr, 'r'},
- {"short", no_argument, nullptr, 's'},
- {"time", no_argument, nullptr, 't'},
- {"users", no_argument, nullptr, 'u'},
- {"writable", no_argument, nullptr, 'T'},
+ {"all", no_argument, NULL, 'a'},
+ {"boot", no_argument, NULL, 'b'},
+ {"count", no_argument, NULL, 'q'},
+ {"dead", no_argument, NULL, 'd'},
+ {"heading", no_argument, NULL, 'H'},
+ {"login", no_argument, NULL, 'l'},
+ {"lookup", no_argument, NULL, LOOKUP_OPTION},
+ {"message", no_argument, NULL, 'T'},
+ {"mesg", no_argument, NULL, 'T'},
+ {"process", no_argument, NULL, 'p'},
+ {"runlevel", no_argument, NULL, 'r'},
+ {"short", no_argument, NULL, 's'},
+ {"time", no_argument, NULL, 't'},
+ {"users", no_argument, NULL, 'u'},
+ {"writable", no_argument, NULL, 'T'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {nullptr, 0, nullptr, 0}
+ {NULL, 0, NULL, 0}
};
/* Return a string representing the time between WHEN and now.
@@ -363,8 +363,8 @@ print_user (STRUCT_UTMP const *utmp_ent, time_t boottime)
#if HAVE_STRUCT_XTMP_UT_HOST
if (utmp_ent->ut_host[0])
{
- char *host = nullptr;
- char *display = nullptr;
+ char *host = NULL;
+ char *display = NULL;
char *ut_host = utmp_ent->ut_host;
/* Look for an X display. */
@@ -387,7 +387,7 @@ print_user (STRUCT_UTMP const *utmp_ent, time_t boottime)
if (hostlen < needed)
{
free (hoststr);
- hoststr = xpalloc (nullptr, &hostlen, needed - hostlen, -1, 1);
+ hoststr = xpalloc (NULL, &hostlen, needed - hostlen, -1, 1);
}
char *p = hoststr;
*p++ = '(';
@@ -401,7 +401,7 @@ print_user (STRUCT_UTMP const *utmp_ent, time_t boottime)
if (hostlen < needed)
{
free (hoststr);
- hoststr = xpalloc (nullptr, &hostlen, needed - hostlen, -1, 1);
+ hoststr = xpalloc (NULL, &hostlen, needed - hostlen, -1, 1);
}
char *p = hoststr;
*p++ = '(';
@@ -559,7 +559,7 @@ print_heading (void)
static void
scan_entries (idx_t n, STRUCT_UTMP const *utmp_buf)
{
- char *ttyname_b IF_LINT ( = nullptr);
+ char *ttyname_b IF_LINT ( = NULL);
time_t boottime = TYPE_MINIMUM (time_t);
if (include_heading)
@@ -689,7 +689,7 @@ main (int argc, char **argv)
atexit (close_stdout);
- while ((optc = getopt_long (argc, argv, "abdlmpqrstuwHT", longopts, nullptr))
+ while ((optc = getopt_long (argc, argv, "abdlmpqrstuwHT", longopts, NULL))
!= -1)
{
switch (optc)
diff --git a/src/whoami.c b/src/whoami.c
index 74728d9416..31a98f31ab 100644
--- a/src/whoami.c
+++ b/src/whoami.c
@@ -67,7 +67,7 @@ main (int argc, char **argv)
parse_gnu_standard_options_only (argc, argv, PROGRAM_NAME, PACKAGE_NAME,
Version, true, usage, AUTHORS,
- (char const *) nullptr);
+ (char const *) NULL);
if (optind != argc)
{
@@ -77,7 +77,7 @@ main (int argc, char **argv)
errno = 0;
uid_t uid = geteuid ();
- struct passwd *pw = uid == NO_UID && errno ? nullptr : getpwuid (uid);
+ struct passwd *pw = uid == NO_UID && errno ? NULL : getpwuid (uid);
if (!pw)
error (EXIT_FAILURE, errno, _("cannot find name for user ID %ju"),
(uintmax_t) uid);
diff --git a/src/yes.c b/src/yes.c
index 67198b33aa..0634d939c0 100644
--- a/src/yes.c
+++ b/src/yes.c
@@ -67,7 +67,7 @@ main (int argc, char **argv)
parse_gnu_standard_options_only (argc, argv, PROGRAM_NAME, PACKAGE_NAME,
Version, true, usage, AUTHORS,
- (char const *) nullptr);
+ (char const *) NULL);
char **operands = argv + optind;
char **operand_lim = argv + argc;
diff --git a/tests/df/no-mtab-status.sh b/tests/df/no-mtab-status.sh
index 334e724189..af8dd721fc 100755
--- a/tests/df/no-mtab-status.sh
+++ b/tests/df/no-mtab-status.sh
@@ -28,8 +28,8 @@ grep '^#define HAVE_GETMNTENT 1' $CONFIG_HEADER > /dev/null \
|| skip_ "getmntent is not used on this system"
# Simulate "mtab" failure.
-# Replace gnulib streq and C23 nullptr as that are not available here.
-sed 's/streq/0==str''cmp/; s/nullptr/NU''LL/' > k.c < k.c <
#include
@@ -54,7 +54,7 @@ FILE* fopen(const char *path, const char *mode)
{
fprintf (stderr, "Failed to find fopen()\n");
errno = ESRCH;
- return nullptr;
+ return NULL;
}
}
@@ -63,7 +63,7 @@ FILE* fopen(const char *path, const char *mode)
if (streq (path, "/proc/self/mountinfo"))
{
errno = ENOENT;
- return nullptr;
+ return NULL;
}
return fopen_func(path, mode);
@@ -115,7 +115,7 @@ struct mntent *getmntent (FILE *fp)
}
/* Now simulate the failure. */
errno = ENOENT;
- return nullptr;
+ return NULL;
}
EOF
diff --git a/tests/df/skip-duplicates.sh b/tests/df/skip-duplicates.sh
index 2b2c7b3367..ed7657bf62 100755
--- a/tests/df/skip-duplicates.sh
+++ b/tests/df/skip-duplicates.sh
@@ -38,8 +38,8 @@ grep '^#define HAVE_GETMNTENT 1' $CONFIG_HEADER > /dev/null \
|| skip_ "getmntent is not used on this system"
# Simulate an mtab file to test various cases.
-# Replace gnulib streq and C23 nullptr as that are not available here.
-sed 's/streq/0==str''cmp/; s/nullptr/NU''LL/' > k.c < k.c <
#include
@@ -64,7 +64,7 @@ FILE* fopen(const char *path, const char *mode)
{
fprintf (stderr, "Failed to find fopen()\n");
errno = ESRCH;
- return nullptr;
+ return NULL;
}
}
@@ -73,7 +73,7 @@ FILE* fopen(const char *path, const char *mode)
if (streq (path, "/proc/self/mountinfo"))
{
errno = ENOENT;
- return nullptr;
+ return NULL;
}
return fopen_func(path, mode);