]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
add "const" attribute, where possible
authorJim Meyering <meyering@redhat.com>
Thu, 12 Jun 2008 20:06:15 +0000 (22:06 +0200)
committerJim Meyering <meyering@redhat.com>
Sat, 14 Jun 2008 20:24:28 +0000 (22:24 +0200)
* 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.

68 files changed:
maint.mk
src/base64.c
src/cat.c
src/chcon.c
src/chgrp.c
src/chmod.c
src/chown.c
src/comm.c
src/cp.c
src/csplit.c
src/cut.c
src/date.c
src/dd.c
src/df.c
src/dircolors.c
src/du.c
src/env.c
src/expand.c
src/fmt.c
src/fold.c
src/groups.c
src/head.c
src/id.c
src/install.c
src/join.c
src/kill.c
src/ln.c
src/ls.c
src/md5sum.c
src/mkdir.c
src/mkfifo.c
src/mknod.c
src/mktemp.c
src/mv.c
src/nice.c
src/nl.c
src/od.c
src/paste.c
src/pathchk.c
src/pinky.c
src/pr.c
src/ptx.c
src/readlink.c
src/rm.c
src/rmdir.c
src/runcon.c
src/seq.c
src/shred.c
src/shuf.c
src/sort.c
src/split.c
src/stat.c
src/stty.c
src/su.c
src/sum.c
src/tac.c
src/tail.c
src/tee.c
src/timeout.c
src/touch.c
src/tr.c
src/truncate.c
src/tty.c
src/uname.c
src/unexpand.c
src/uniq.c
src/wc.c
src/who.c

index 7f86349b2a1f9234b5d9c9790a52d29e5e5d34ac..6c21082572e67916d73a7f5569a796a95ba9c2fa 100644 (file)
--- a/maint.mk
+++ b/maint.mk
@@ -483,6 +483,12 @@ sc_proper_name_utf8_requires_ICONV:
              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
index 3e66c12e012fa031508440878e8d5fac2144af6e..e5c16e456ae2e50990a0d85ed5ecb0fc49a7bdb5 100644 (file)
@@ -37,7 +37,8 @@
 
 #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'},
index d762f454979161f791d193bd88ab19fae975798a..75d30d08fc3bbe2ab26cb49d12da40902ee8e14e 100644 (file)
--- a/src/cat.c
+++ b/src/cat.c
@@ -547,7 +547,7 @@ main (int argc, char **argv)
   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'},
index 659664e3d6ff16a13f6e4ddd26f4fd9a9afca637..a043413fae53d8002d6573cde0df8e54509271d6 100644 (file)
@@ -88,7 +88,7 @@ enum
   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},
index db83c59df8baa9095e4384011c8d6fa9b721006e..206d9bb20addf380e9fad7cd14d7e2c6ae2a99e1 100644 (file)
@@ -56,7 +56,7 @@ enum
   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'},
index 80fc363aa30d464c52e7ad71d3e49b54ec5aaacb..8f8d8a5f3388293b16ac6d8fdbc635ff70e04859 100644 (file)
@@ -91,7 +91,7 @@ enum
   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'},
index e5740d259be6c22fb44f3836db323ee9be9bdeb1..218aae08e95b2c47a8cf97e2677afc2dac3661af 100644 (file)
@@ -62,7 +62,7 @@ enum
   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'},
index 2bf876121b5750c12861cae836cbfa208b74a5ad..c855a3355f6ea8bf542c4b21ad33896526cb2541 100644 (file)
@@ -79,8 +79,7 @@ enum
   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},
index c768d1bc938935026b554f0a651bd20d60022a44..c3657179f27329973fe02e5e2ab2572964feafda 100644 (file)
--- a/src/cp.c
+++ b/src/cp.c
@@ -120,7 +120,7 @@ static int const reply_vals[] =
 };
 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'},
index 7e63ca831e560d39e915eab9e1a8ce0bc5e55ef5..26874c1a4f63ec4ee765bdb6ef7aeb4c4fd98bf3 100644 (file)
@@ -192,7 +192,7 @@ static size_t control_used;
 /* 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'},
index 0e151fd3e99b1b55e2bf5c430a38b0037af5bc8e..5a8745cd31c9bf11b70c3a18c150f70b4a1e9611 100644 (file)
--- a/src/cut.c
+++ b/src/cut.c
@@ -164,7 +164,7 @@ enum
   COMPLEMENT_OPTION
 };
 
-static struct option const longopts[] =
+static const struct option const longopts[] =
 {
   {"bytes", required_argument, NULL, 'b'},
   {"characters", required_argument, NULL, 'c'},
index 24390529c9cf80eb79493e2da8ad5a8186ea01da..4c575b164fcf13e6c4787d4011108380d72f38aa 100644 (file)
@@ -86,7 +86,7 @@ enum
 
 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'},
index ead957464550416fe42debbc1a6580841a964b6d..d811d245df86c31ad7b9070fcd6356630b2474cc 100644 (file)
--- a/src/dd.c
+++ b/src/dd.c
@@ -236,7 +236,7 @@ struct symbol_value
 };
 
 /* 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. */
@@ -257,7 +257,7 @@ static struct symbol_value const conversions[] =
 };
 
 /* Flags, for iflag="..." and oflag="...".  */
-static struct symbol_value const flags[] =
+static const struct symbol_value const flags[] =
 {
   {"append",   O_APPEND},
   {"binary",   O_BINARY},
@@ -275,7 +275,7 @@ static struct symbol_value const flags[] =
 };
 
 /* Status, for status="...".  */
-static struct symbol_value const statuses[] =
+static const struct symbol_value const statuses[] =
 {
   {"noxfer",   STATUS_NOXFER},
   {"",         0}
index 66e920774ddcef81e642e06dacdf7acf24ee0ae7..7212962c4ad44bbc297a8f06065cf53a7144d13d 100644 (file)
--- a/src/df.c
+++ b/src/df.c
@@ -117,7 +117,7 @@ enum
   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'},
index 56194f793e9e714a1f2813bde7c0abc055651bd7..73e6490f719f90d5fc6dfecd21f8231df852f14c 100644 (file)
@@ -75,7 +75,7 @@ static const char *const ls_codes[] =
 #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'},
index d9749919ed822c9d9b54e5af07abbcfe6eac7068..ebb84145a34608cd737b56b5461b2d3c10ff44af 100644 (file)
--- a/src/du.c
+++ b/src/du.c
@@ -200,7 +200,7 @@ enum
   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},
index 67e411f18699debcb3c0371adf654c35732a0e85..5baac0fce5a83930cc54c32700d253027ab3c6b6 100644 (file)
--- a/src/env.c
+++ b/src/env.c
@@ -96,7 +96,7 @@ int putenv ();
 
 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'},
index 8efb81b3355ae0a1981ca52242d1bc3155038765..ae70737ac03459efb89071169a6dcbc624af1877 100644 (file)
@@ -87,7 +87,7 @@ static int exit_status;
 
 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'},
index 708e60bca475444edd921f675396563fab9908f2..4df86d98bd70e9b955cc729887e5a1d4c77d92d7 100644 (file)
--- a/src/fmt.c
+++ b/src/fmt.c
@@ -300,7 +300,7 @@ With no FILE, or when FILE is -, read standard input.\n"),
 
 /* 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'},
index 57ff123c7231981f59fb747348ba5c686276746e..eb97753fc512164cd439d9cfc13999eb46be4786 100644 (file)
@@ -45,7 +45,7 @@ static bool have_read_stdin;
 
 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'},
index ef9640005f93f1ec986b6cdd279149347241c1f4..65873f9b565837ad8fb5c3a77b7f4c843b067487 100644 (file)
@@ -37,7 +37,7 @@
   proper_name ("James Youngman")
 
 
-static struct option const longopts[] =
+static const struct option const longopts[] =
 {
   {GETOPT_HELP_OPTION_DECL},
   {GETOPT_VERSION_OPTION_DECL},
index 7a0e2ada9d4d7e7db6612627dfc7dbff203d43da..798dcae66f4d5182a890915199f60ce370258d87 100644 (file)
@@ -82,7 +82,7 @@ enum
   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'},
index 14b558d65843897905b6f2cd0aa47c0c19480ebe..8977a656ba446c2e01de65b41aac7cf59404f847 100644 (file)
--- a/src/id.c
+++ b/src/id.c
@@ -58,7 +58,7 @@ static bool ok = true;
    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'},
index 0d3927df47d7b9dfd7e0b0ee00df78bb55553c8c..8133b5647966e0cc1971462056ebaa38078912ba 100644 (file)
@@ -138,7 +138,7 @@ enum
   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},
index 4c506d1ac045d2fbd12d0a7191a384352db755aa..c89fe8f18ed0b1e97a710a4d750b6ac6bab06a06 100644 (file)
@@ -130,7 +130,7 @@ enum
 };
 
 
-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},
index 1fd495840473f34b56710fe6cf096a0152f9495e..f29b12fc8fb4f26f40bf43c8d45cd60a2ab4db21 100644 (file)
@@ -66,7 +66,7 @@ static char const short_options[] =
   "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'},
index 2dc5628e88e9f228e5df4678959983552d231edc..52763ffbe71a246541e146bca2bd4be6df946aa9 100644 (file)
--- a/src/ln.c
+++ b/src/ln.c
@@ -93,7 +93,7 @@ static Hash_table *dest_set;
 /* 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'},
index 600d7a507d63fb411a58845620d6d9f68ca07055..efdab887cdc403c01a3278a92c0231533fab4f6c 100644 (file)
--- a/src/ls.c
+++ b/src/ls.c
@@ -672,7 +672,7 @@ enum { TIME_STAMP_LEN_MAXIMUM = MAX (1000, INT_STRLEN_BOUND (time_t)) };
 /* 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
@@ -741,7 +741,7 @@ enum
   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'},
@@ -3151,7 +3151,7 @@ static int rev_xstrcoll_df_version (V a, V 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),
index dcafe97336a2352c7e58bc2d11849b8a8f962863..bc708dc4d49b818a15b43e5a373b72952daa2815 100644 (file)
@@ -128,7 +128,7 @@ enum
   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' },
index 9644f4c9fe9cc93f38e8e2492b607194995c71dc..7cb03746f0ed5d6dd3ed510252e4359241262df6 100644 (file)
@@ -36,7 +36,7 @@
 
 #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'},
index d0d2c45197ddd2750c7c525bf6d1bc9f834accec..b77cfbab70e97afa1824410e2b0845fd107ac531 100644 (file)
@@ -32,7 +32,7 @@
 
 #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'},
index d93e2cb9d3978fae48c17110c1f1a6d107126b9b..f5c59905d646176b0ae03a7fa278904aadb21101 100644 (file)
@@ -33,7 +33,7 @@
 
 #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'},
index 8a09231f985213321152cd5c1286d499432512b4..2821c8cdf630ef4c517c3d2e995a194aef7325ce 100644 (file)
@@ -42,7 +42,7 @@ enum
   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'},
index fc255f368e7db1689cceb544cdb3a2080c0457ad..d58216c95e9353b9cd8e67eac76854ba5f236e13 100644 (file)
--- a/src/mv.c
+++ b/src/mv.c
@@ -71,7 +71,7 @@ static int const reply_vals[] =
   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'},
index 13033ec5e0acb7185aacc7c7dc3507ded800e5b0..278005f862aaec926e146fc906d36040f2c16beb 100644 (file)
@@ -55,7 +55,7 @@
 # define NZERO 20
 #endif
 
-static struct option const longopts[] =
+static const struct option const longopts[] =
 {
   {"adjustment", required_argument, NULL, 'n'},
   {NULL, 0, NULL, 0}
index ddd0fcfded5e180339069b888a15949a42ca7307..0d2c5ea2a838ede9dc8a39f6451fde626bea877f 100644 (file)
--- a/src/nl.c
+++ b/src/nl.c
@@ -144,7 +144,7 @@ static intmax_t line_no;
 /* 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'},
index 5b4b7bd4a6b6c297aadadab07a827582a05dac17..dec9decb54a4c376328b398e8d0c6d97976442e0 100644 (file)
--- a/src/od.c
+++ b/src/od.c
@@ -174,7 +174,7 @@ static const int width_bytes[] =
 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",
@@ -281,7 +281,7 @@ enum
   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'},
index 9dee94aa459559b42ad551aa617d553780d3024d..a40bee55ba6cd09118b61e4efaf1ad756bc68cc7 100644 (file)
@@ -67,7 +67,7 @@ static char *delims;
 /* 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'},
index 48001fc03d73f9a03e3ba1d43f42456759fd5eaf..fceda91304c1ecf91178523c6ec8604f64b39885 100644 (file)
@@ -78,7 +78,7 @@ enum
   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},
index 9c80d94d536300176a1632c45d4cade9f7c8113a..778ae0c84e99da566625ec25e35d5120af31488b 100644 (file)
@@ -78,7 +78,7 @@ static bool include_where = true;
 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},
index 6ffe8f1548ad7ef18ce019cce6dc725be783571f..464891a239d662a44ef2d7dd945572eb90517bbe 100644 (file)
--- a/src/pr.c
+++ b/src/pr.c
@@ -740,7 +740,7 @@ enum
 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},
index 28dfc875311af3f772e1a3f63360792a0d3bd0d8..6d457c5a899d594dc398686c4d3945f104802b4b 100644 (file)
--- a/src/ptx.c
+++ b/src/ptx.c
@@ -1935,7 +1935,7 @@ With no FILE or if FILE is -, read Standard Input.  `-F /' by default.\n\
 `----------------------------------------------------------------------*/
 
 /* 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'},
index 98a955c0ca4ad1cf0596aaeda95347c1138c3e11..405d467d79e20e6f0a1842a9e61122fbd5a7602d 100644 (file)
@@ -38,7 +38,7 @@ static bool no_newline;
 /* 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'},
index 7304330c87f07145d89898d671d2149f7b31327c..e1e987da54f12854f6ac90373c19a350a6b0a788 100644 (file)
--- a/src/rm.c
+++ b/src/rm.c
@@ -84,7 +84,7 @@ enum interactive_type
     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'},
index 64575b091889cf48fd317361ed1bd0d1f7767a45..25d72db5236ecf350de4f4c1dcd02d8ff8788f73 100644 (file)
@@ -55,7 +55,7 @@ enum
   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.  */
index a5c2300fca3a1dda14197b96bfdfa2e9615ce3d2..8c2b26168dac8fcee850b412a6f28bf5053dd74f 100644 (file)
@@ -61,7 +61,8 @@
 
 #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'},
index 55518dfaba1d2561cbd4d0f8786294bfdab51c1e..f0a04376fd022fca4357041dc669b4468582b783 100644 (file)
--- a/src/seq.c
+++ b/src/seq.c
@@ -51,7 +51,7 @@ static char const *separator;
 /* 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'},
index bfafa96f395e38781bc93820469382b9de92a9e4..91a89d257929b9dbba60a30bede333d72e67f233 100644 (file)
@@ -133,7 +133,7 @@ enum
   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'},
index ca5345b4bfe241e1d0777bbd044d24785c850e8a..118ba0bf613ca7d999132f53ebb59ddbc33769a8 100644 (file)
@@ -84,7 +84,7 @@ enum
   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'},
index 632c5c8363618b055a21f3d6fca4b8b3422da23e..218bd2986910620820103a3662949a3aa8fded95 100644 (file)
@@ -205,7 +205,7 @@ static char fold_toupper[UCHAR_LIM];
 
 /* 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},
@@ -399,7 +399,7 @@ enum
 
 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},
index 181d8378309519c903733b85016b289a31f28119..995a5a31eb01450c539b68891366188a2dfd59a4 100644 (file)
@@ -79,7 +79,7 @@ enum
   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'},
index 0d52c27b1ec45aaae19e9f7fbc225d5a12da8600..087bda3cb26bd8f0c387989c1f9bbc1868922003 100644 (file)
@@ -157,7 +157,8 @@ enum
   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'},
index 004c3186c25af1371857261bc1290f3b8fed15d8..548923da423ccb34b99e9295dc05fc75f0520810 100644 (file)
@@ -204,7 +204,7 @@ struct mode_info
     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},
@@ -368,7 +368,7 @@ struct control_info
 
 /* Control characters. */
 
-static struct control_info control_info[] =
+static const struct control_info const control_info[] =
 {
   {"intr", CINTR, VINTR},
   {"quit", CQUIT, VQUIT},
@@ -418,7 +418,7 @@ static char const *visible (cc_t ch);
 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);
@@ -432,7 +432,7 @@ static void display_settings (enum output_type output_type,
 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,
@@ -445,7 +445,7 @@ static int max_col;
 /* 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'},
@@ -1061,7 +1061,7 @@ main (int argc, char **argv)
    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;
 
@@ -1267,7 +1267,7 @@ set_mode (struct mode_info *info, bool reversed, struct termios *mode)
 }
 
 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;
@@ -1716,7 +1716,7 @@ struct speed_map
   unsigned long int value;     /* Numeric value. */
 };
 
-static struct speed_map speeds[] =
+static const struct speed_map const speeds[] =
 {
   {"0", B0, 0},
   {"50", B50, 50},
index f6b61f773557e45c97444025225e64c15377a586..fed27788ac37ae465eb0cf0edbeba2df089ff4d1 100644 (file)
--- a/src/su.c
+++ b/src/su.c
@@ -137,7 +137,7 @@ static bool simulate_login;
 /* 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'},
index 4dfc86797ae0a6094fb14a92ab9c51122dd2cb70..7bedb876c2d35eedf67f37a8f56f3c581e9ebf38 100644 (file)
--- a/src/sum.c
+++ b/src/sum.c
@@ -39,7 +39,7 @@
 /* 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},
index 9cf6d60dc218237fefed187fead0b21169c3b712..4a43e59ec774667eb941dfc37a33a5862a263a13 100644 (file)
--- a/src/tac.c
+++ b/src/tac.c
@@ -111,7 +111,7 @@ static struct re_pattern_buffer compiled_separator;
 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'},
index 1ce207e524ee64c66fff00de04b546050e424f26..72f8267dd49062168d72fbf7f24c647586eb3738 100644 (file)
@@ -185,7 +185,7 @@ enum
   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},
index 162455c536442afe067ced1870b3da8077fc2d97..284c97b350309c3cac0823fc00c9a9b6542f84f4 100644 (file)
--- a/src/tee.c
+++ b/src/tee.c
@@ -41,7 +41,7 @@ static bool append;
 /* 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'},
index 53ebf3c05b363deaa8d57cd05ba5b84c0d33ec36..b7993456d462048cb3103cf08d294b9847cbbf7e 100644 (file)
@@ -84,7 +84,8 @@ static int term_signal = SIGTERM;  /* same default as kill command.  */
 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}
 };
index bbc9c60129dc46b5e275ad5acaf3d1c6d3235228..bea51b52897ebba04dbb6b39c14a9e74c07ff88b 100644 (file)
@@ -77,7 +77,7 @@ enum
   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'},
index e1bb4049966370df2c4adf24a5129a65f07ea1ec..7a747109c1f8a33d3683d25e901465ace0a93b35 100644 (file)
--- a/src/tr.c
+++ b/src/tr.c
@@ -264,7 +264,7 @@ static bool in_delete_set[N_CHARS];
    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'},
index f26fd45a8ee0af4bc8076da46394b02ce315a5a6..cc4f5075d17f408e6ef3cbf42f243984fc43a202 100644 (file)
@@ -50,7 +50,8 @@ static bool block_mode;
 /* (-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'},
index c7b13dcabb6f638ec204c9b1d84d49a856bbe7e8..dd563b81a4154c4b152f8f9ca848655118800251 100644 (file)
--- a/src/tty.c
+++ b/src/tty.c
@@ -45,7 +45,7 @@ enum
 /* 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'},
index 3870dfa3d07f3c79cc9a7af8b86249da5de0add8..57778b9191b9b8e95bc0585873ea1c7f6eb17161 100644 (file)
@@ -86,7 +86,7 @@
 /* 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'},
@@ -104,7 +104,7 @@ static struct option const uname_long_options[] =
   {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},
index 5a2d0cdeb787d64521bc12502337b818ecf333a6..ec8831f42e26674ef41bf9d0e4aa87d20bc031d0 100644 (file)
@@ -96,7 +96,7 @@ enum
   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'},
index 5af52710c6f1a714eb5e4d5a6d1b86cce4a8857b..e837182f8e9f7f79df8c2b1051d32de4dde03c1f 100644 (file)
@@ -107,7 +107,7 @@ static enum delimit_method const delimit_method_map[] =
 /* 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'},
index e6b9a1ebbc0c1ab9277575938a9dd4ba18c1efa9..7990a7af190e0d00dd942439c7dabd4d3df5dd38 100644 (file)
--- a/src/wc.c
+++ b/src/wc.c
@@ -85,7 +85,7 @@ enum
   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'},
index 34b56481de0b5d321c77223a7833f643e980e91e..ae9320bb5c34489f7292d65a6edcfcf2d1460e8a 100644 (file)
--- a/src/who.c
+++ b/src/who.c
@@ -159,7 +159,8 @@ enum
   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'},