guile-snarf fix
[bpt/guile.git] / libguile / guile-snarf.in
index 043b3ed..36cb995 100644 (file)
@@ -1,7 +1,8 @@
 #!/bin/sh
 # Extract the initialization actions from source files.
 #
-#  Copyright (C) 1996, 97, 98, 99, 2000, 2001, 2002, 2004, 2006, 2008, 2009 Free Software Foundation, Inc.
+#  Copyright (C) 1996, 97, 98, 99, 2000, 2001, 2002, 2004, 2006, 2008,
+#    2009, 2014 Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU Lesser General Public License as
@@ -51,7 +52,23 @@ modern_snarf ()                         # writes stdout
     ## empty file.
     echo "/* cpp arguments: $@ */" ;
     ${cpp} -DSCM_MAGIC_SNARF_INITS -DSCM_MAGIC_SNARFER "$@" > ${temp} && cpp_ok_p=true
-    grep "^ *\^ *\^" ${temp} | sed -e "s/ *\^ *\^//g" -e "s/\^ *: *\^/;/g"
+    sed -ne '/^#define /d
+s/ *\^ *\^ */\
+/
+s/.*\n//
+t x
+d
+: x
+s/ *\^ *: *\^ */;\
+/
+t y
+N
+s/\n\(#.*\)/ /
+s/\n/ /
+t x
+: y
+P
+D' ${temp}
 }
 
 ## main