Improve the check for departures from C89, and fix the departures
[platform/upstream/coreutils.git] / src / dcgen
index a3f04c3..5df3c56 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";