summaryrefslogtreecommitdiff
path: root/scripts/cleanup_printf2puts
diff options
context:
space:
mode:
authorDenis Vlasenko2007-04-08 15:12:21 +0000
committerDenis Vlasenko2007-04-08 15:12:21 +0000
commit5694d5f8d22be2f5be53b2d0ce2e0283ef57d93f (patch)
treea44a71eaec88155a5d5b8a2d0ab7bba6abecc01a /scripts/cleanup_printf2puts
parent8d9f495d68664017e0b87f2c0c2d0eae9f3c4836 (diff)
downloadbusybox-5694d5f8d22be2f5be53b2d0ce2e0283ef57d93f.zip
busybox-5694d5f8d22be2f5be53b2d0ce2e0283ef57d93f.tar.gz
adding small script, mostly for documentational purposes
Diffstat (limited to 'scripts/cleanup_printf2puts')
-rwxr-xr-xscripts/cleanup_printf2puts9
1 files changed, 9 insertions, 0 deletions
diff --git a/scripts/cleanup_printf2puts b/scripts/cleanup_printf2puts
new file mode 100755
index 0000000..446152e
--- /dev/null
+++ b/scripts/cleanup_printf2puts
@@ -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