summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2006-10-25 01:05:30 +0200
committerJim Meyering <jim@meyering.net>2006-10-25 01:05:30 +0200
commite81a82b74f44bfddce247d566617137725f11b19 (patch)
tree49abf1426b3f7994ed5791afac1bd798d00325b5 /src
parent3e9cc761892d1601101e4b798046a6a5e47bc90d (diff)
downloadcoreutils-e81a82b74f44bfddce247d566617137725f11b19.tar.xz
* src/cat.c (infile): Add "const" to declaration.
* src/csplit.c (prefix): Likewise. * src/printf.c (cfcc_msg): Likewise. * src/tail.c (valid_file_spec): Likewise. * src/cut.c (cut_file): Likewise, for a parameter. * src/expr.c (str_value): Likewise. * src/fold.c (fold_file): Likewise. * src/pr.c (init_header): Likewise. * src/dircolors.c (dc_parse_stream): Likewise, for a local. * src/tr.c (make_printable_str): Likewise. * src/nl.c (body_type, header_type, footer_type, current_type): (separator_str, build_type_arg, nl_file): Likewise, for many. * src/paste.c (main): Don't assign a read-only string to 'optarg'. * src/tac.c (separator, tac_seekable, copy_to_temp): Likewise.
Diffstat (limited to 'src')
-rw-r--r--src/cat.c2
-rw-r--r--src/csplit.c6
-rw-r--r--src/cut.c4
-rw-r--r--src/dircolors.c2
-rw-r--r--src/expr.c2
-rw-r--r--src/fold.c4
-rw-r--r--src/nl.c17
-rw-r--r--src/paste.c4
-rw-r--r--src/pr.c4
-rw-r--r--src/printf.c2
-rw-r--r--src/tac.c6
-rw-r--r--src/tail.c2
-rw-r--r--src/tr.c2
13 files changed, 28 insertions, 29 deletions
diff --git a/src/cat.c b/src/cat.c
index ec2c52885..90a73c21b 100644
--- a/src/cat.c
+++ b/src/cat.c
@@ -55,7 +55,7 @@
char *program_name;
/* Name of input file. May be "-". */
-static char *infile;
+static char const *infile;
/* Descriptor on which input file is open. */
static int input_desc;
diff --git a/src/csplit.c b/src/csplit.c
index 07bcb2095..e174ee59e 100644
--- a/src/csplit.c
+++ b/src/csplit.c
@@ -149,13 +149,13 @@ static uintmax_t current_line = 0;
static bool have_read_eof = false;
/* Name of output files. */
-static char * volatile filename_space = NULL;
+static char *volatile filename_space = NULL;
/* Prefix part of output file names. */
-static char * volatile prefix = NULL;
+static char const *volatile prefix = NULL;
/* Suffix part of output file names. */
-static char * volatile suffix = NULL;
+static char *volatile suffix = NULL;
/* Number of digits to use in output file names. */
static int volatile digits = 2;
diff --git a/src/cut.c b/src/cut.c
index 43eecb9dd..4faae4c50 100644
--- a/src/cut.c
+++ b/src/cut.c
@@ -1,5 +1,5 @@
/* cut - remove parts of lines of files
- Copyright (C) 1997-2005 Free Software Foundation, Inc.
+ Copyright (C) 1997-2006 Free Software Foundation, Inc.
Copyright (C) 1984 David M. Ihnat
This program is free software; you can redistribute it and/or modify
@@ -702,7 +702,7 @@ cut_stream (FILE *stream)
Return true if successful. */
static bool
-cut_file (char *file)
+cut_file (char const *file)
{
FILE *stream;
diff --git a/src/dircolors.c b/src/dircolors.c
index fc9319b60..cf6e2a9c8 100644
--- a/src/dircolors.c
+++ b/src/dircolors.c
@@ -246,7 +246,7 @@ dc_parse_stream (FILE *fp, const char *filename)
char *input_line = NULL;
size_t input_line_size = 0;
char const *line;
- char *term;
+ char const *term;
bool ok = true;
/* State for the parser. */
diff --git a/src/expr.c b/src/expr.c
index 99bbdd8fd..7f9f5323d 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -236,7 +236,7 @@ int_value (intmax_t i)
/* Return a VALUE for S. */
static VALUE *
-str_value (char *s)
+str_value (char const *s)
{
VALUE *v = xmalloc (sizeof *v);
v->type = string;
diff --git a/src/fold.c b/src/fold.c
index cef98c1a8..0d4ea5860 100644
--- a/src/fold.c
+++ b/src/fold.c
@@ -1,5 +1,5 @@
/* fold -- wrap each input line to fit in specified width.
- Copyright (C) 91, 1995-2005 Free Software Foundation, Inc.
+ Copyright (C) 91, 1995-2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -122,7 +122,7 @@ adjust_column (size_t column, char c)
Return true if successful. */
static bool
-fold_file (char *filename, size_t width)
+fold_file (char const *filename, size_t width)
{
FILE *istream;
int c;
diff --git a/src/nl.c b/src/nl.c
index 7ee57b77d..e8502a8ce 100644
--- a/src/nl.c
+++ b/src/nl.c
@@ -64,16 +64,16 @@ enum section
char *program_name;
/* Format of body lines (-b). */
-static char *body_type = "t";
+static char const *body_type = "t";
/* Format of header lines (-h). */
-static char *header_type = "n";
+static char const *header_type = "n";
/* Format of footer lines (-f). */
-static char *footer_type = "n";
+static char const *footer_type = "n";
/* Format currently being used (body, header, or footer). */
-static char *current_type;
+static char const *current_type;
/* Regex for body lines to number (-bp). */
static struct re_pattern_buffer body_regex;
@@ -93,7 +93,7 @@ static char footer_fastmap[UCHAR_MAX + 1];
static struct re_pattern_buffer *current_regex = NULL;
/* Separator string to print after line number (-s). */
-static char *separator_str = "\t";
+static char const *separator_str = "\t";
/* Input section delimiter string (-d). */
static char const *section_del = DEFAULT_SECTION_DELIMITERS;
@@ -235,9 +235,10 @@ FORMAT is one of:\n\
according to `optarg'. */
static bool
-build_type_arg (char **typep, struct re_pattern_buffer *regexp, char *fastmap)
+build_type_arg (char const **typep,
+ struct re_pattern_buffer *regexp, char *fastmap)
{
- const char *errmsg;
+ char const *errmsg;
bool rval = true;
switch (*optarg)
@@ -414,7 +415,7 @@ process_file (FILE *fp)
Return true if successful. */
static bool
-nl_file (const char *file)
+nl_file (char const *file)
{
FILE *stream;
diff --git a/src/paste.c b/src/paste.c
index 1903bcd64..414fb8830 100644
--- a/src/paste.c
+++ b/src/paste.c
@@ -463,9 +463,7 @@ main (int argc, char **argv)
{
case 'd':
/* Delimiter character(s). */
- if (optarg[0] == '\0')
- optarg = "\\0";
- delim_arg = optarg;
+ delim_arg = (optarg[0] == '\0' ? "\\0" : optarg);
break;
case 's':
diff --git a/src/pr.c b/src/pr.c
index 096758888..bd694f49f 100644
--- a/src/pr.c
+++ b/src/pr.c
@@ -430,7 +430,7 @@ static void getoptarg (char *arg, char switch_char, char *character,
void usage (int status);
static void print_files (int number_of_files, char **av);
static void init_parameters (int number_of_files);
-static void init_header (char *filename, int desc);
+static void init_header (char const *filename, int desc);
static bool init_fps (int number_of_files, char **av);
static void init_funcs (void);
static void init_store_cols (void);
@@ -1653,7 +1653,7 @@ print_files (int number_of_files, char **av)
FILENAME for reading. */
static void
-init_header (char *filename, int desc)
+init_header (char const *filename, int desc)
{
char *buf = NULL;
struct stat st;
diff --git a/src/printf.c b/src/printf.c
index bfb40728c..43fe5baf5 100644
--- a/src/printf.c
+++ b/src/printf.c
@@ -76,7 +76,7 @@ static bool posixly_correct;
/* This message appears in N_() here rather than just in _() below because
the sole use would have been in a #define. */
-static char *const cfcc_msg =
+static char const *const cfcc_msg =
N_("warning: %s: character(s) following character constant have been ignored");
/* The name this program was run with. */
diff --git a/src/tac.c b/src/tac.c
index b3777b21a..dc166aaa3 100644
--- a/src/tac.c
+++ b/src/tac.c
@@ -78,7 +78,7 @@ tac -r -s '.\|
char *program_name;
/* The string that separates the records of the file. */
-static char *separator;
+static char const *separator;
/* True if we have ever read standard input. */
static bool have_read_stdin = false;
@@ -211,7 +211,7 @@ tac_seekable (int input_fd, const char *file)
Only used when the separator is attached to the preceding record. */
bool first_time = true;
char first_char = *separator; /* Speed optimization, non-regexp. */
- char *separator1 = separator + 1; /* Speed optimization, non-regexp. */
+ char const *separator1 = separator + 1; /* Speed optimization, non-regexp. */
size_t match_length1 = match_length - 1; /* Speed optimization, non-regexp. */
struct re_registers regs;
@@ -426,7 +426,7 @@ static bool
copy_to_temp (FILE **g_tmp, char **g_tempfile, int input_fd, char const *file)
{
static char *template = NULL;
- static char *tempdir;
+ static char const *tempdir;
char *tempfile;
FILE *tmp;
int fd;
diff --git a/src/tail.c b/src/tail.c
index 7d8f421e6..d17f40a9a 100644
--- a/src/tail.c
+++ b/src/tail.c
@@ -292,7 +292,7 @@ valid_file_spec (struct File_spec const *f)
return ((f->fd == -1) ^ (f->errnum == 0));
}
-static char *
+static char const *
pretty_name (struct File_spec const *f)
{
return (STREQ (f->name, "-") ? "standard input" : f->name);
diff --git a/src/tr.c b/src/tr.c
index e18e5588e..214eb2bc9 100644
--- a/src/tr.c
+++ b/src/tr.c
@@ -601,7 +601,7 @@ make_printable_str (char const *s, size_t len)
for (i = 0; i < len; i++)
{
char buf[5];
- char *tmp = NULL;
+ char const *tmp = NULL;
unsigned char c = s[i];
switch (c)