summaryrefslogtreecommitdiff
path: root/src/dcgen
diff options
context:
space:
mode:
authorPaul Eggert <eggert@penguin.cs.ucla.edu>2006-11-27 11:27:46 +0100
committerJim Meyering <jim@meyering.net>2006-11-27 11:27:46 +0100
commit9b06af3367500dfe09067b047381e788969059cd (patch)
tree0b4858e328a2c8ceabf60d95fdfa0cc016faf5d4 /src/dcgen
parenta45772d52d86a2b1a39ee057b139af7eb36a2b76 (diff)
downloadcoreutils-9b06af3367500dfe09067b047381e788969059cd.tar.xz
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.
Diffstat (limited to 'src/dcgen')
-rwxr-xr-xsrc/dcgen12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/dcgen b/src/dcgen
index a3f04c37c..5df3c56b8 100755
--- 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";