adding small script, mostly for documentational purposes
authorDenis Vlasenko <vda.linux@googlemail.com>
Sun, 8 Apr 2007 15:12:21 +0000 (15:12 -0000)
committerDenis Vlasenko <vda.linux@googlemail.com>
Sun, 8 Apr 2007 15:12:21 +0000 (15:12 -0000)
scripts/cleanup_printf2puts [new file with mode: 0755]

diff --git a/scripts/cleanup_printf2puts b/scripts/cleanup_printf2puts
new file mode 100755 (executable)
index 0000000..446152e
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# Processes current directory recursively:
+# printf("abc\n") -> puts("abc"). Beware of fprintf etc...
+
+# BTW, gcc 4.1.2 already does tha same! Can't believe it...
+
+grep -lr 'printf\([^%%]*\\n"\)' . | grep '.[ch]$' | xargs -n1 \
+    sed -e 's/\([^A-Za-z0-9_]\)printf(\( *"[^%]*\)\\n")/\1puts(\2")/' -i