aboutsummaryrefslogtreecommitdiffstats
path: root/src/nl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nl.c')
-rw-r--r--src/nl.c45
1 files changed, 23 insertions, 22 deletions
diff --git a/src/nl.c b/src/nl.c
index ad5c36313..4cbad8e32 100644
--- a/src/nl.c
+++ b/src/nl.c
@@ -90,7 +90,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 = NULL;
+static struct re_pattern_buffer *current_regex = nullptr;
/* Separator string to print after line number (-s). */
static char const *separator_str = "\t";
@@ -99,19 +99,19 @@ static char const *separator_str = "\t";
static char *section_del = DEFAULT_SECTION_DELIMITERS;
/* Header delimiter string. */
-static char *header_del = NULL;
+static char *header_del = nullptr;
/* Header section delimiter length. */
static size_t header_del_len;
/* Body delimiter string. */
-static char *body_del = NULL;
+static char *body_del = nullptr;
/* Body section delimiter length. */
static size_t body_del_len;
/* Footer delimiter string. */
-static char *footer_del = NULL;
+static char *footer_del = nullptr;
/* Footer section delimiter length. */
static size_t footer_del_len;
@@ -120,7 +120,7 @@ static size_t footer_del_len;
static struct linebuffer line_buf;
/* printf format string for unnumbered lines. */
-static char *print_no_line_fmt = NULL;
+static char *print_no_line_fmt = nullptr;
/* Starting line number on each page (-v). */
static intmax_t starting_line_number = 1;
@@ -151,20 +151,20 @@ static bool have_read_stdin;
static struct option const longopts[] =
{
- {"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'},
+ {"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'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {NULL, 0, NULL, 0}
+ {nullptr, 0, nullptr, 0}
};
/* Print a usage message and quit. */
@@ -258,10 +258,10 @@ build_type_arg (char const **typep,
break;
case 'p':
*typep = optarg++;
- regexp->buffer = NULL;
+ regexp->buffer = nullptr;
regexp->allocated = 0;
regexp->fastmap = fastmap;
- regexp->translate = NULL;
+ regexp->translate = nullptr;
re_syntax_options =
RE_SYNTAX_POSIX_BASIC & ~RE_CONTEXT_INVALID_DUP & ~RE_NO_EMPTY_RANGES;
errmsg = re_compile_pattern (optarg, strlen (optarg), regexp);
@@ -366,7 +366,7 @@ proc_text (void)
break;
case 'p':
switch (re_search (current_regex, line_buf.buffer, line_buf.length - 1,
- 0, line_buf.length - 1, NULL))
+ 0, line_buf.length - 1, nullptr))
{
case -2:
die (EXIT_FAILURE, errno, _("error in regular expression search"));
@@ -446,7 +446,7 @@ nl_file (char const *file)
else
{
stream = fopen (file, "r");
- if (stream == NULL)
+ if (stream == nullptr)
{
error (0, errno, "%s", quotef (file));
return false;
@@ -492,7 +492,8 @@ 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,
- NULL)) != -1)
+ nullptr))
+ != -1)
{
switch (c)
{