* maint.mk (sc_const_long_option): New rule. Enforce global change.
* src/base64.c (long_options): Use "const" where possible.
* src/cat.c (main): Likewise.
* src/chcon.c (long_options): Likewise.
* src/chgrp.c (long_options): Likewise.
* src/chmod.c (long_options): Likewise.
* src/chown.c (long_options): Likewise.
* src/comm.c (long_options, OUTPUT_DELIMITER_OPTION): Likewise.
* src/cp.c (long_opts): Likewise.
* src/csplit.c (longopts): Likewise.
* src/cut.c (longopts): Likewise.
* src/date.c (long_options): Likewise.
* src/dd.c (conversions, flags, statuses): Likewise.
* src/df.c (long_options): Likewise.
* src/dircolors.c (long_options): Likewise.
* src/du.c (long_options): Likewise.
* src/env.c (longopts): Likewise.
* src/expand.c (longopts): Likewise.
* src/fmt.c (long_options): Likewise.
* src/fold.c (longopts): Likewise.
* src/groups.c (longopts): Likewise.
* src/head.c (long_options): Likewise.
* src/id.c (longopts): Likewise.
* src/install.c (long_options): Likewise.
* src/join.c (longopts): Likewise.
* src/kill.c (long_options): Likewise.
* src/ln.c (long_options): Likewise.
* src/ls.c (long_time_format, long_options, sort_functions): Likewise.
* src/md5sum.c (long_options): Likewise.
* src/mkdir.c (longopts): Likewise.
* src/mkfifo.c (longopts): Likewise.
* src/mknod.c (longopts): Likewise.
* src/mktemp.c (longopts): Likewise.
* src/mv.c (long_options): Likewise.
* src/nice.c (longopts): Likewise.
* src/nl.c (longopts): Likewise.
* src/od.c (charname, long_options): Likewise.
* src/paste.c (longopts): Likewise.
* src/pathchk.c (longopts): Likewise.
* src/pinky.c (longopts): Likewise.
* src/pr.c (long_options): Likewise.
* src/ptx.c (long_options): Likewise.
* src/readlink.c (longopts): Likewise.
* src/rm.c (long_opts): Likewise.
* src/rmdir.c (longopts): Likewise.
* src/runcon.c (long_options): Likewise.
* src/seq.c (long_options): Likewise.
* src/shred.c (long_opts): Likewise.
* src/shuf.c (long_opts): Likewise.
* src/sort.c (monthtab, long_options): Likewise.
* src/split.c (longopts): Likewise.
* src/stat.c (long_options): Likewise.
* src/stty.c (mode_info, control_info, longopts, set_mode) Likewise.
(set_control_char, speeds): Likewise.
* src/su.c (longopts): Likewise.
* src/sum.c (longopts): Likewise.
* src/tac.c (longopts): Likewise.
* src/tail.c (long_options): Likewise.
* src/tee.c (long_options): Likewise.
* src/timeout.c (long_options): Likewise.
* src/touch.c (longopts): Likewise.
* src/tr.c (long_options): Likewise.
* src/truncate.c (longopts): Likewise.
* src/tty.c (longopts): Likewise.
* src/uname.c (uname_long_options, arch_long_options): Likewise.
* src/unexpand.c (longopts): Likewise.
* src/uniq.c (longopts): Likewise.
* src/wc.c (longopts): Likewise.
* src/who.c (longopts): Likewise.
exit 1; } || :; \
fi
+sc_const_long_option:
+ @grep '^ *static.*struct option ' $$($(VC_LIST_EXCEPT)) \
+ | grep -v 'const struct option const' && { \
+ echo 1>&2 '$(ME): add "const" to the above declarations'; \
+ exit 1; } || :
+
# Update the hash stored above. Do this after each release and
# for any corrections to old entries.
update-NEWS-hash: NEWS
#define AUTHORS proper_name ("Simon Josefsson")
-static const struct option long_options[] = {
+static const struct option const long_options[] =
+{
{"decode", no_argument, 0, 'd'},
{"wrap", required_argument, 0, 'w'},
{"ignore-garbage", no_argument, 0, 'i'},
bool show_tabs = false;
int file_open_mode = O_RDONLY;
- static struct option const long_options[] =
+ static const struct option const long_options[] =
{
{"number-nonblank", no_argument, NULL, 'b'},
{"number", no_argument, NULL, 'n'},
REFERENCE_FILE_OPTION
};
-static struct option const long_options[] =
+static const struct option const long_options[] =
{
{"recursive", no_argument, NULL, 'R'},
{"dereference", no_argument, NULL, DEREFERENCE_OPTION},
REFERENCE_FILE_OPTION
};
-static struct option const long_options[] =
+static const struct option const long_options[] =
{
{"recursive", no_argument, NULL, 'R'},
{"changes", no_argument, NULL, 'c'},
REFERENCE_FILE_OPTION
};
-static struct option const long_options[] =
+static const struct option const long_options[] =
{
{"changes", no_argument, NULL, 'c'},
{"recursive", no_argument, NULL, 'R'},
REFERENCE_FILE_OPTION
};
-static struct option const long_options[] =
+static const struct option const long_options[] =
{
{"recursive", no_argument, NULL, 'R'},
{"changes", no_argument, NULL, 'c'},
OUTPUT_DELIMITER_OPTION
};
-
-static struct option const long_options[] =
+static const struct option const long_options[] =
{
{"check-order", no_argument, NULL, CHECK_ORDER_OPTION},
{"nocheck-order", no_argument, NULL, NOCHECK_ORDER_OPTION},
};
ARGMATCH_VERIFY (reply_args, reply_vals);
-static struct option const long_opts[] =
+static const struct option const long_opts[] =
{
{"archive", no_argument, NULL, 'a'},
{"backup", optional_argument, NULL, 'b'},
/* The set of signals that are caught. */
static sigset_t caught_signals;
-static struct option const longopts[] =
+static const struct option const longopts[] =
{
{"digits", required_argument, NULL, 'n'},
{"quiet", no_argument, NULL, 'q'},
COMPLEMENT_OPTION
};
-static struct option const longopts[] =
+static const struct option const longopts[] =
{
{"bytes", required_argument, NULL, 'b'},
{"characters", required_argument, NULL, 'c'},
static char const short_options[] = "d:f:I::r:Rs:u";
-static struct option const long_options[] =
+static const struct option const long_options[] =
{
{"date", required_argument, NULL, 'd'},
{"file", required_argument, NULL, 'f'},
};
/* Conversion symbols, for conv="...". */
-static struct symbol_value const conversions[] =
+static const struct symbol_value const conversions[] =
{
{"ascii", C_ASCII | C_TWOBUFS}, /* EBCDIC to ASCII. */
{"ebcdic", C_EBCDIC | C_TWOBUFS}, /* ASCII to EBCDIC. */
};
/* Flags, for iflag="..." and oflag="...". */
-static struct symbol_value const flags[] =
+static const struct symbol_value const flags[] =
{
{"append", O_APPEND},
{"binary", O_BINARY},
};
/* Status, for status="...". */
-static struct symbol_value const statuses[] =
+static const struct symbol_value const statuses[] =
{
{"noxfer", STATUS_NOXFER},
{"", 0}
SYNC_OPTION
};
-static struct option const long_options[] =
+static const struct option const long_options[] =
{
{"all", no_argument, NULL, 'a'},
{"block-size", required_argument, NULL, 'B'},
#define array_len(Array) (sizeof (Array) / sizeof *(Array))
verify (array_len (slack_codes) == array_len (ls_codes));
-static struct option const long_options[] =
+static const struct option const long_options[] =
{
{"bourne-shell", no_argument, NULL, 'b'},
{"sh", no_argument, NULL, 'b'},
TIME_STYLE_OPTION
};
-static struct option const long_options[] =
+static const struct option const long_options[] =
{
{"all", no_argument, NULL, 'a'},
{"apparent-size", no_argument, NULL, APPARENT_SIZE_OPTION},
extern char **environ;
-static struct option const longopts[] =
+static const struct option const longopts[] =
{
{"ignore-environment", no_argument, NULL, 'i'},
{"unset", required_argument, NULL, 'u'},
static char const shortopts[] = "it:0::1::2::3::4::5::6::7::8::9::";
-static struct option const longopts[] =
+static const struct option const longopts[] =
{
{"tabs", required_argument, NULL, 't'},
{"initial", no_argument, NULL, 'i'},
/* Decode options and launch execution. */
-static const struct option long_options[] =
+static const struct option const long_options[] =
{
{"crown-margin", no_argument, NULL, 'c'},
{"prefix", required_argument, NULL, 'p'},
static char const shortopts[] = "bsw:0::1::2::3::4::5::6::7::8::9::";
-static struct option const longopts[] =
+static const struct option const longopts[] =
{
{"bytes", no_argument, NULL, 'b'},
{"spaces", no_argument, NULL, 's'},
proper_name ("James Youngman")
-static struct option const longopts[] =
+static const struct option const longopts[] =
{
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
PRESUME_INPUT_PIPE_OPTION = CHAR_MAX + 1
};
-static struct option const long_options[] =
+static const struct option const long_options[] =
{
{"bytes", required_argument, NULL, 'c'},
{"lines", required_argument, NULL, 'n'},
knows when `context' has not been set to a meaningful value. */
static security_context_t context = NULL;
-static struct option const longopts[] =
+static const struct option const longopts[] =
{
{"context", no_argument, NULL, 'Z'},
{"group", no_argument, NULL, 'g'},
PRESERVE_CONTEXT_OPTION = CHAR_MAX + 1
};
-static struct option const long_options[] =
+static const struct option const long_options[] =
{
{"backup", optional_argument, NULL, 'b'},
{GETOPT_SELINUX_CONTEXT_OPTION_DECL},
};
-static struct option const longopts[] =
+static const struct option const longopts[] =
{
{"ignore-case", no_argument, NULL, 'i'},
{"check-order", no_argument, NULL, CHECK_ORDER_OPTION},
"N::O::P::Q::R::S::T::U::V::W::X::Y::Z::"
"ln:s:t";
-static struct option const long_options[] =
+static const struct option const long_options[] =
{
{"list", no_argument, NULL, 'l'},
{"signal", required_argument, NULL, 's'},
/* Initial size of the dest_set hash table. */
enum { DEST_INFO_INITIAL_CAPACITY = 61 };
-static struct option const long_options[] =
+static const struct option const long_options[] =
{
{"backup", optional_argument, NULL, 'b'},
{"directory", no_argument, NULL, 'F'},
/* strftime formats for non-recent and recent files, respectively, in
-l output. */
-static char const *long_time_format[2] =
+static const char const *long_time_format[2] =
{
/* strftime format for non-recent files (older than 6 months), in
-l output. This should contain the year, month and day (at
TIME_STYLE_OPTION
};
-static struct option const long_options[] =
+static const struct option const long_options[] =
{
{"all", no_argument, NULL, 'a'},
{"escape", no_argument, NULL, 'b'},
} \
}
-static qsortFunc sort_functions[][2][2][2] =
+static const qsortFunc const sort_functions[][2][2][2] =
{
LIST_SORTFUNCTION_VARIANTS (name),
LIST_SORTFUNCTION_VARIANTS (extension),
QUIET_OPTION
};
-static const struct option long_options[] =
+static const struct option const long_options[] =
{
{ "binary", no_argument, NULL, 'b' },
{ "check", no_argument, NULL, 'c' },
#define AUTHORS proper_name ("David MacKenzie")
-static struct option const longopts[] =
+static const struct option const longopts[] =
{
{GETOPT_SELINUX_CONTEXT_OPTION_DECL},
{"mode", required_argument, NULL, 'm'},
#define AUTHORS proper_name ("David MacKenzie")
-static struct option const longopts[] =
+static const struct option const longopts[] =
{
{GETOPT_SELINUX_CONTEXT_OPTION_DECL},
{"mode", required_argument, NULL, 'm'},
#define AUTHORS proper_name ("David MacKenzie")
-static struct option const longopts[] =
+static const struct option const longopts[] =
{
{GETOPT_SELINUX_CONTEXT_OPTION_DECL},
{"mode", required_argument, NULL, 'm'},
TMPDIR_OPTION = CHAR_MAX + 1
};
-static struct option const longopts[] =
+static const struct option const longopts[] =
{
{"directory", no_argument, NULL, 'd'},
{"quiet", no_argument, NULL, 'q'},
I_ALWAYS_YES, I_ALWAYS_NO, I_ASK_USER
};
-static struct option const long_options[] =
+static const struct option const long_options[] =
{
{"backup", optional_argument, NULL, 'b'},
{"force", no_argument, NULL, 'f'},
# define NZERO 20
#endif
-static struct option const longopts[] =
+static const struct option const longopts[] =
{
{"adjustment", required_argument, NULL, 'n'},
{NULL, 0, NULL, 0}
/* True if we have ever read standard input. */
static bool have_read_stdin;
-static struct option const longopts[] =
+static const struct option const longopts[] =
{
{"header-numbering", required_argument, NULL, 'h'},
{"body-numbering", required_argument, NULL, 'b'},
verify (sizeof width_bytes / sizeof width_bytes[0] == N_SIZE_SPECS);
/* Names for some non-printing characters. */
-static char const charname[33][4] =
+static const char const charname[33][4] =
{
"nul", "soh", "stx", "etx", "eot", "enq", "ack", "bel",
"bs", "ht", "nl", "vt", "ff", "cr", "so", "si",
TRADITIONAL_OPTION = CHAR_MAX + 1
};
-static struct option const long_options[] =
+static const struct option const long_options[] =
{
{"skip-bytes", required_argument, NULL, 'j'},
{"address-radix", required_argument, NULL, 'A'},
/* A pointer to the character after the end of `delims'. */
static char const *delim_end;
-static struct option const longopts[] =
+static const struct option const longopts[] =
{
{"serial", no_argument, NULL, 's'},
{"delimiters", required_argument, NULL, 'd'},
PORTABILITY_OPTION = CHAR_MAX + 1
};
-static struct option const longopts[] =
+static const struct option const longopts[] =
{
{"portability", no_argument, NULL, PORTABILITY_OPTION},
{GETOPT_HELP_OPTION_DECL},
static char const *time_format;
static int time_format_width;
-static struct option const longopts[] =
+static const struct option const longopts[] =
{
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
static char const short_options[] =
"-0123456789D:FJN:S::TW:abcde::fh:i::l:mn::o:rs::tvw:";
-static struct option const long_options[] =
+static const struct option const long_options[] =
{
{"pages", required_argument, NULL, PAGES_OPTION},
{"columns", required_argument, NULL, COLUMNS_OPTION},
`----------------------------------------------------------------------*/
/* Long options equivalences. */
-static const struct option long_options[] =
+static const struct option const long_options[] =
{
{"auto-reference", no_argument, NULL, 'A'},
{"break-file", required_argument, NULL, 'b'},
/* If true, report error messages. */
static bool verbose;
-static struct option const longopts[] =
+static const struct option const longopts[] =
{
{"canonicalize", no_argument, NULL, 'f'},
{"canonicalize-existing", no_argument, NULL, 'e'},
interactive_always /* 2: default, -i or --interactive=always */
};
-static struct option const long_opts[] =
+static const struct option const long_opts[] =
{
{"directory", no_argument, NULL, 'd'},
{"force", no_argument, NULL, 'f'},
IGNORE_FAIL_ON_NON_EMPTY_OPTION = CHAR_MAX + 1
};
-static struct option const longopts[] =
+static const struct option const longopts[] =
{
/* Don't name this `--force' because it's not close enough in meaning
to e.g. rm's -f option. */
#define AUTHORS proper_name ("Russell Coker")
-static struct option long_options[] = {
+static const struct option const long_options[] =
+{
{"role", required_argument, NULL, 'r'},
{"type", required_argument, NULL, 't'},
{"user", required_argument, NULL, 'u'},
/* FIXME: make this an option. */
static char const terminator[] = "\n";
-static struct option const long_options[] =
+static const struct option const long_options[] =
{
{ "equal-width", no_argument, NULL, 'w'},
{ "format", required_argument, NULL, 'f'},
RANDOM_SOURCE_OPTION = CHAR_MAX + 1
};
-static struct option const long_opts[] =
+static const struct option const long_opts[] =
{
{"exact", no_argument, NULL, 'x'},
{"force", no_argument, NULL, 'f'},
RANDOM_SOURCE_OPTION = CHAR_MAX + 1
};
-static struct option const long_opts[] =
+static const struct option const long_opts[] =
{
{"echo", no_argument, NULL, 'e'},
{"input-range", required_argument, NULL, 'i'},
/* Table mapping month names to integers.
Alphabetic order allows binary search. */
-static struct month monthtab[] =
+static const struct month const monthtab[] =
{
{"APR", 4},
{"AUG", 8},
static char const short_options[] = "-bcCdfgik:mMno:rRsS:t:T:uy:z";
-static struct option const long_options[] =
+static const struct option const long_options[] =
{
{"ignore-leading-blanks", no_argument, NULL, 'b'},
{"check", optional_argument, NULL, CHECK_OPTION},
VERBOSE_OPTION = CHAR_MAX + 1
};
-static struct option const longopts[] =
+static const struct option const longopts[] =
{
{"bytes", required_argument, NULL, 'b'},
{"lines", required_argument, NULL, 'l'},
PRINTF_OPTION = CHAR_MAX + 1
};
-static struct option const long_options[] = {
+static const struct option const long_options[] =
+{
{"context", no_argument, 0, 'Z'},
{"dereference", no_argument, NULL, 'L'},
{"file-system", no_argument, NULL, 'f'},
unsigned long mask; /* Other bits to turn off for this mode. */
};
-static struct mode_info mode_info[] =
+static const struct mode_info const mode_info[] =
{
{"parenb", control, REV, PARENB, 0},
{"parodd", control, REV, PARODD, 0},
/* Control characters. */
-static struct control_info control_info[] =
+static const struct control_info const control_info[] =
{
{"intr", CINTR, VINTR},
{"quit", CQUIT, VQUIT},
static unsigned long int baud_to_value (speed_t speed);
static bool recover_mode (char const *arg, struct termios *mode);
static int screen_columns (void);
-static bool set_mode (struct mode_info *info, bool reversed,
+static bool set_mode (struct mode_info const *info, bool reversed,
struct termios *mode);
static unsigned long int integer_arg (const char *s, unsigned long int max);
static speed_t string_to_baud (const char *arg);
static void display_speed (struct termios *mode, bool fancy);
static void display_window_size (bool fancy, char const *device_name);
static void sane_mode (struct termios *mode);
-static void set_control_char (struct control_info *info,
+static void set_control_char (struct control_info const *info,
const char *arg,
struct termios *mode);
static void set_speed (enum speed_setting type, const char *arg,
/* Current position, to know when to wrap. */
static int current_col;
-static struct option longopts[] =
+static const struct option const longopts[] =
{
{"all", no_argument, NULL, 'a'},
{"save", no_argument, NULL, 'g'},
return true. */
static bool
-set_mode (struct mode_info *info, bool reversed, struct termios *mode)
+set_mode (struct mode_info const *info, bool reversed, struct termios *mode)
{
tcflag_t *bitsp;
}
static void
-set_control_char (struct control_info *info, const char *arg,
+set_control_char (struct control_info const *info, const char *arg,
struct termios *mode)
{
unsigned long int value;
unsigned long int value; /* Numeric value. */
};
-static struct speed_map speeds[] =
+static const struct speed_map const speeds[] =
{
{"0", B0, 0},
{"50", B50, 50},
/* If true, change some environment vars to indicate the user su'd to. */
static bool change_environment;
-static struct option const longopts[] =
+static const struct option const longopts[] =
{
{"command", required_argument, NULL, 'c'},
{"fast", no_argument, NULL, 'f'},
/* True if any of the files read were the standard input. */
static bool have_read_stdin;
-static struct option const longopts[] =
+static const struct option const longopts[] =
{
{"sysv", no_argument, NULL, 's'},
{GETOPT_HELP_OPTION_DECL},
static char compiled_separator_fastmap[UCHAR_MAX + 1];
static struct re_registers regs;
-static struct option const longopts[] =
+static const struct option const longopts[] =
{
{"before", no_argument, NULL, 'b'},
{"regex", no_argument, NULL, 'r'},
LONG_FOLLOW_OPTION
};
-static struct option const long_options[] =
+static const struct option const long_options[] =
{
{"bytes", required_argument, NULL, 'c'},
{"follow", optional_argument, NULL, LONG_FOLLOW_OPTION},
/* If true, ignore interrupts. */
static bool ignore_interrupts;
-static struct option const long_options[] =
+static const struct option const long_options[] =
{
{"append", no_argument, NULL, 'a'},
{"ignore-interrupts", no_argument, NULL, 'i'},
static int monitored_pid;
static int sigs_to_ignore[NSIG]; /* so monitor can ignore sigs it resends. */
-static struct option const long_options[] = {
+static const struct option const long_options[] =
+{
{"signal", required_argument, NULL, 's'},
{NULL, 0, NULL, 0}
};
TIME_OPTION = CHAR_MAX + 1
};
-static struct option const longopts[] =
+static const struct option const longopts[] =
{
{"time", required_argument, NULL, TIME_OPTION},
{"no-create", no_argument, NULL, 'c'},
two specification strings and the delete switch is not given. */
static char xlate[N_CHARS];
-static struct option const long_options[] =
+static const struct option const long_options[] =
{
{"complement", no_argument, NULL, 'c'},
{"delete", no_argument, NULL, 'd'},
/* (-r) Reference file to use size from */
static char const *ref_file;
-static struct option const longopts[] = {
+static const struct option const longopts[] =
+{
{"no-create", no_argument, NULL, 'c'},
{"io-blocks", no_argument, NULL, 'o'},
{"reference", required_argument, NULL, 'r'},
/* If true, return an exit status but produce no output. */
static bool silent;
-static struct option const longopts[] =
+static const struct option const longopts[] =
{
{"silent", no_argument, NULL, 's'},
{"quiet", no_argument, NULL, 's'},
/* Operating system. */
#define PRINT_OPERATING_SYSTEM 128
-static struct option const uname_long_options[] =
+static const struct option const uname_long_options[] =
{
{"all", no_argument, NULL, 'a'},
{"kernel-name", no_argument, NULL, 's'},
{NULL, 0, NULL, 0}
};
-static struct option const arch_long_options[] =
+static const struct option const arch_long_options[] =
{
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
CONVERT_FIRST_ONLY_OPTION = CHAR_MAX + 1
};
-static struct option const longopts[] =
+static const struct option const longopts[] =
{
{"tabs", required_argument, NULL, 't'},
{"all", no_argument, NULL, 'a'},
/* Select whether/how to delimit groups of duplicate lines. */
static enum delimit_method delimit_groups;
-static struct option const longopts[] =
+static const struct option const longopts[] =
{
{"count", no_argument, NULL, 'c'},
{"repeated", no_argument, NULL, 'd'},
FILES0_FROM_OPTION = CHAR_MAX + 1
};
-static struct option const longopts[] =
+static const struct option const longopts[] =
{
{"bytes", no_argument, NULL, 'c'},
{"chars", no_argument, NULL, 'm'},
LOOKUP_OPTION = CHAR_MAX + 1
};
-static struct option const longopts[] = {
+static const struct option const longopts[] =
+{
{"all", no_argument, NULL, 'a'},
{"boot", no_argument, NULL, 'b'},
{"count", no_argument, NULL, 'q'},