[Toybox] Towards find cleanup

Rob Landley rob at landley.net
Wed Apr 10 17:57:18 PDT 2013


On 04/10/2013 12:41:35 PM, Felix Janda wrote:
> The toy also does not follow the whitespace conventions in toybox.  
> But I
> think that someone has scripts lying around to fix that.

That would be me. :)

My blog entry from when I did the reindent has some basic sed  
invocations to do a conversion:

   http://landley.net/notes-2012.html#02-11-2012

But the attached python file is another thing I used. It takes an input  
file and converts leading whitespace to a series of T and S characters  
for tab and space respectively. Then if you pipe the output to sort -u  
you can get an idea of what kind of indentation the file is currently  
using. In the case of find:

   $ stuff/whippet.py toys/pending/find.c  | sort -u
   toys/pending/find.c:S
   toys/pending/find.c:SSSSSSSSSS
   toys/pending/find.c:T
   toys/pending/find.c:TSS
   toys/pending/find.c:TT
   toys/pending/find.c:TTT
   toys/pending/find.c:TTTT
   toys/pending/find.c:TTTTT

I.E. mostly tabs but the occasional mix of tabs and spaces, and a  
couple lines indented with a lot of spaces. (In this case the lots of  
spaces line is the last line of the help text.

Another quick little gotcha:

   sed -i 's/^  *$//' toys/pending/find.c

Find lines with nothing but whitespace and blank them. (Some people's  
editors auto-indent lines and then it gets kept even though they left  
the line blank. I should just do a generic find and remove trailing  
whitespace thing...)

I'm checking in the whitespace change as its own commit because mixing  
whitespace and code changes is seldom a good idea. :)

Rob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: whippet.py
Type: text/x-python
Size: 403 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20130410/fe197758/attachment-0002.py>


More information about the Toybox mailing list