]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Improve the check for departures from C89, and fix the departures
authorPaul Eggert <eggert@penguin.cs.ucla.edu>
Mon, 27 Nov 2006 10:27:46 +0000 (11:27 +0100)
committerJim Meyering <jim@meyering.net>
Mon, 27 Nov 2006 10:27:46 +0000 (11:27 +0100)
I found.
* Makefile.maint (my-distcheck): Also check for C89 compatibility
as best we can with GCC.
* src/stat.c (PRINTF_OPTION): Omit comma before } in enum
declaration; C89 doesn't allow this.
* src/dcgen: Don't generate string literals longer than
what C89 requires support for.
* src/cut.c (usage): Don't use string literals longer than
what C89 requires support for.
* src/date.c (usage): Likewise.
* src/dd.c (usage): Likewise.
* src/du.c (usage): Likewise.
* src/ls.c (usage): Likewise.
* src/od.c (usage): Likewise.
* src/readlink.c (usage): Likewise.
* src/seq.c (usage): Likewise.
* src/shred.c (usage): Likewise.

13 files changed:
ChangeLog
Makefile.maint
src/cut.c
src/date.c
src/dcgen
src/dd.c
src/du.c
src/ls.c
src/od.c
src/readlink.c
src/seq.c
src/shred.c
src/stat.c

index a2e537b72b5c67481e435f4f8bb6f0a7adf1e460..1a0a4bf20b8394bcd189afe9461ecc532d6aa456 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2006-11-26  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Improve the check for departures from C89, and fix the departures
+       I found.
+       * Makefile.maint (my-distcheck): Also check for C89 compatibility
+       as best we can with GCC.
+       * src/stat.c (PRINTF_OPTION): Omit comma before } in enum
+       declaration; C89 doesn't allow this.
+       * src/dcgen: Don't generate string literals longer than
+       what C89 requires support for.
+       * src/cut.c (usage): Don't use string literals longer than
+       what C89 requires support for.
+       * src/date.c (usage): Likewise.
+       * src/dd.c (usage): Likewise.
+       * src/du.c (usage): Likewise.
+       * src/ls.c (usage): Likewise.
+       * src/od.c (usage): Likewise.
+       * src/readlink.c (usage): Likewise.
+       * src/seq.c (usage): Likewise.
+       * src/shred.c (usage): Likewise.
+
 2006-11-26  Mike Frysinger  <vapier@gentoo.org>
 
        Recognize new archive, audio and image formats.
index 9400b4993b0741087311c37b7273bafd9dcaf900..821a53c6859088512a952a2846444414d3536a1f 100644 (file)
@@ -335,7 +335,7 @@ patch-check:
          diff -upr src src-c89 > new-diff || : ; fi
        fail=0; test -s $@.2 && fail=1 || : ; \
        rm -f src-c89/*.o || fail=1; \
-       $(MAKE) -C src-c89 CFLAGS='-g -Wdeclaration-after-statement -Werror' \
+       $(MAKE) -C src-c89 CFLAGS='-Wdeclaration-after-statement -Werror' \
          || fail=1; \
        rm -rf src-c89 $@.1 $@.2; \
        test $$fail = 0
@@ -528,6 +528,11 @@ my-distcheck: $(local-check) $(release_archive_dir)/$(prev-tgz)
        (cd $(t) && mv $(distdir) $(distdir).old        \
          && $(AMTAR) -zxf - ) < $(distdir).tar.gz
        diff -ur $(t)/$(distdir).old $(t)/$(distdir)
+       cd $(t)/$(distdir)                              \
+         && (cd src && patch -V never --fuzz=0 <c99-to-c89.diff) \
+         && ./configure --disable-largefile            \
+             CFLAGS='-Werror -ansi -pedantic -Wno-long-long' \
+         && $(MAKE)
        -rm -rf $(t)
        @echo "========================"; \
        echo "$(distdir).tar.gz is ready for distribution"; \
index 4faae4c5031e1a32495d52a9cd5d663369769184..73277faa304d5e0813eb9827d59d41bae49dd78d 100644 (file)
--- a/src/cut.c
+++ b/src/cut.c
@@ -223,6 +223,8 @@ Mandatory arguments to long options are mandatory for short options too.\n\
 Use one, and only one of -b, -c or -f.  Each LIST is made up of one\n\
 range, or many ranges separated by commas.  Selected input is written\n\
 in the same order that it is read, and is written exactly once.\n\
+"), stdout);
+      fputs (_("\
 Each range is one of:\n\
 \n\
   N     N'th byte, character or field, counted from 1\n\
index 187956a3115d4434f4e63ca87c89c2739127bea7..2dec4c37fed2640e8375365de7913a0b4220bbbc 100644 (file)
@@ -223,6 +223,8 @@ specifies Coordinated Universal Time.  Interpreted sequences are:\n\
   %Z   alphabetic time zone abbreviation (e.g., EDT)\n\
 \n\
 By default, date pads numeric fields with zeroes.\n\
+"), stdout);
+      fputs (_("\
 The following optional flags may follow `%':\n\
 \n\
   - (hyphen) do not pad the field\n\
index a3f04c37c2f98102719df22c82b4db36bd923177..5df3c56b896e368e5cc8e80da5140ff3138274ca 100755 (executable)
--- a/src/dcgen
+++ b/src/dcgen
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -w
 # dcgen -- convert dircolors.hin to dircolors.h.
 
-# Copyright (C) 1996, 1998, 2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 1996, 1998, 2004, 2005, 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
@@ -44,12 +44,14 @@ while (<>)
       and push @line, $_;
   }
 
-my $last_line = pop @line;
 my $indent = '  ';
 
-print "static char const G_line[] =\n";
+print "static char const G_line[] =\n{\n";
 foreach (@line)
   {
-    print "$indent\"$_\\0\"\n";
+    s/./'$&',/g;
+    s/'\\'/'\\\\'/g;
+    s/'''/'\\''/g;
+    print "$indent${_}0,\n";
   }
-print "$indent\"$last_line\";\n";
+print "};\n";
index f1dc47452321e19c3cd5f36477a189f58d436322..3449e1253c571c2f005fdf44f01f2a65e495acd7 100644 (file)
--- a/src/dd.c
+++ b/src/dd.c
@@ -448,6 +448,8 @@ Each CONV symbol may be:\n\
   notrunc   do not truncate the output file\n\
   ucase     change lower case to upper case\n\
   swab      swap every pair of input bytes\n\
+"), stdout);
+      fputs (_("\
   noerror   continue after read errors\n\
   sync      pad every input block with NULs to ibs-size; when used\n\
               with block or unblock, pad with spaces rather than NULs\n\
index 5f4e796dbdcbf70dd08552b17d3715d86697615b..6a4c8c7c8ac424d7b50933fb9a34218c9429be09 100644 (file)
--- a/src/du.c
+++ b/src/du.c
@@ -293,6 +293,8 @@ Mandatory arguments to long options are mandatory for short options too.\n\
                           the apparent size is usually smaller, it may be\n\
                           larger due to holes in (`sparse') files, internal\n\
                           fragmentation, indirect blocks, and the like\n\
+"), stdout);
+      fputs (_("\
   -B, --block-size=SIZE use SIZE-byte blocks\n\
   -b, --bytes           equivalent to `--apparent-size --block-size=1'\n\
   -c, --total           produce a grand total\n\
@@ -305,6 +307,8 @@ Mandatory arguments to long options are mandatory for short options too.\n\
                           change to be equivalent to --dereference-args (-D)\n\
   -h, --human-readable  print sizes in human readable format (e.g., 1K 234M 2G)\n\
       --si              like -h, but use powers of 1000 not 1024\n\
+"), stdout);
+      fputs (_("\
   -k                    like --block-size=1K\n\
   -l, --count-links     count sizes many times if hard linked\n\
   -m                    like --block-size=1M\n\
index 03164b167751cfe33fed02a97b6160a213188349..63d363fd262cb056ebc5dae3dae9d3b9d3a0ac68 100644 (file)
--- a/src/ls.c
+++ b/src/ls.c
@@ -4270,6 +4270,8 @@ Mandatory arguments to long options are mandatory for short options too.\n\
   -h, --human-readable       with -l, print sizes in human readable format\n\
                                (e.g., 1K 234M 2G)\n\
       --si                   likewise, but use powers of 1000 not 1024\n\
+"), stdout);
+      fputs (_("\
   -H, --dereference-command-line\n\
                              follow symbolic links listed on the command line\n\
       --dereference-command-line-symlink-to-dir\n\
@@ -4331,6 +4333,8 @@ Mandatory arguments to long options are mandatory for short options too.\n\
                              non-recent files and FORMAT2 to recent files;\n\
                              if STYLE is prefixed with `posix-', STYLE\n\
                              takes effect only outside the POSIX locale\n\
+"), stdout);
+      fputs (_("\
   -t                         sort by modification time\n\
   -T, --tabsize=COLS         assume tab stops at each COLS instead of 8\n\
 "), stdout);
index b358a0f1556a37f9bc72aa89b054048461b5a494..a0c247401959b8f87b354e9f443406e71bc6c060 100644 (file)
--- a/src/od.c
+++ b/src/od.c
@@ -358,6 +358,8 @@ An OFFSET operand means -j OFFSET.  LABEL is the pseudo-address\n\
 at first byte printed, incremented when dump is progressing.\n\
 For OFFSET and LABEL, a 0x or 0X prefix indicates hexadecimal;\n\
 suffixes may be . for octal and b for multiply by 512.\n\
+"), stdout);
+      fputs (_("\
 \n\
 TYPE is made up of one or more of these specifications:\n\
 \n\
index 533b9b9e18f7f2a36fa75330cc7455d41f3418f9..800d235b43a596b37546754dbf3450fa54fb87ee 100644 (file)
@@ -1,5 +1,5 @@
 /* readlink -- display value of a symbolic link.
-   Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004, 2005, 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
@@ -74,6 +74,8 @@ usage (int status)
   -e, --canonicalize-existing   canonicalize by following every symlink in\n\
                                 every component of the given name recursively,\n\
                                 all components must exist\n\
+"), stdout);
+      fputs (_("\
   -m, --canonicalize-missing    canonicalize by following every symlink in\n\
                                 every component of the given name recursively,\n\
                                 without requirements on components existence\n\
index 997fd730dedf3a3b304bd64d893e285d92ccec89..59dd318d4e735eab848c24962b0a007175854508 100644 (file)
--- a/src/seq.c
+++ b/src/seq.c
@@ -92,6 +92,8 @@ omitted INCREMENT defaults to 1 even when LAST is smaller than FIRST.\n\
 FIRST, INCREMENT, and LAST are interpreted as floating point values.\n\
 INCREMENT is usually positive if FIRST is smaller than LAST, and\n\
 INCREMENT is usually negative if FIRST is greater than LAST.\n\
+"), stdout);
+      fputs (_("\
 FORMAT must be suitable for printing one argument of type `double';\n\
 it defaults to %.PRECf if FIRST, INCREMENT, and LAST are all fixed point\n\
 decimal numbers with maximum precision PREC, and to %g otherwise.\n\
index 4c1819ccb189ff077a4fb45c7faf9f69e5e52d47..23a4944b0dd28489ca7cc8d3eea5267e403da60a 100644 (file)
@@ -220,6 +220,8 @@ version 3 clients\n\
 \n\
 * compressed file systems\n\
 \n\
+"), stdout);
+      fputs (_("\
 In the case of ext3 file systems, the above disclaimer applies\n\
 (and shred is thus of limited effectiveness) only in data=journal mode,\n\
 which journals file data in addition to just metadata.  In both the\n\
@@ -228,6 +230,8 @@ Ext3 journaling modes can be changed by adding the data=something option\n\
 to the mount options for a particular file system in the /etc/fstab file,\n\
 as documented in the mount man page (man mount).\n\
 \n\
+"), stdout);
+      fputs (_("\
 In addition, file system backups and remote mirrors may contain copies\n\
 of the file that cannot be removed, and that will allow a shredded file\n\
 to be recovered later.\n\
index 6de5e15c3d34bf9277c3578ab1fe2d4539424d75..315fe0c6502b76da9c8ae41505896f9e2652dd3b 100644 (file)
@@ -154,7 +154,7 @@ statfs (char const *filename, struct fs_info *buf)
 
 enum
 {
-  PRINTF_OPTION = CHAR_MAX + 1,
+  PRINTF_OPTION = CHAR_MAX + 1
 };
 
 static struct option const long_options[] = {