[BusyBox] style guide and name changes (patch)

ldoolitt at recycle.lbl.gov ldoolitt at recycle.lbl.gov
Thu Dec 21 18:26:16 UTC 2000


--- /home/ldoolitt/cvs/busybox/docs/style-guide.txt	Thu Dec 21 08:50:34 2000
+++ style-guide.txt	Thu Dec 21 10:22:41 2000
@@ -214,10 +214,26 @@
 that are added to the repository. Furthermore, the maintainer of an existing
 file that uses alternate naming conventions should -- at his own convenience
 -- convert those names over to K&R style; converting variable names is a very
-low priority task. Perhaps in the future we will include some magical Perl
-script that can go through and convert variable names, left as an exercise for
-the reader for now.
+low priority task.
 
+Mark Whitley gave an example of a safe and effective way to put in targeted
+name changes using perl.  First edit the following template, noting the magic
+"\b" notation for matching a word boundary, and putting in your carefully
+thought out name mappings.  Then run it: 'perl to_knr.pl *.[ch]'.
+
+---start to_knr.pl---
+#!/usr/bin/perl -i -p
+# convert some function names to K&R style
+
+s/\bisDecimal\b/is_decimal/g;
+s/\bisOctal\b/is_octal/g;
+s/\berrorMsg\b/error_msg/g;
+s/\bverrorMsg\b/verror_msg/g;
+s/\bfatalError\b/error_msg_and_die/g;
+s/\bperrorMsg\b/perror_msg/g;
+s/\bvperrorMsg\b/vperror_msg/g;
+s/\bfatalPerror\b/perror_msg_and_die/g;
+---end to_knr.pl---
 
 
 Avoid The Preprocessor





More information about the busybox mailing list