[PATCH] Add character and equivalence classes to tr

Rob Sullivan cogito.ergo.cogito at gmail.com
Mon Oct 3 19:21:12 UTC 2005


The attached patch adds character and equivalence classes to tr. For
instance, the following command now outputs ABC:
echo abc | tr [:lower:] [:upper:]

Both additions are created as separate options, so that the user may have
the basic tr if desired. This is probably useful in the case of equivalence
classes, as unless you've got some really sticky expression that you want to
give to tr, they're simply redundant.
The patch adds some for loops to create the various sets of characters
corresponding to the classes. These result in the same size tr.o compared
with something like:
strcat(buffer, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
for example, and in my opinion look somewhat cleaner.

Rob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.busybox.net/pipermail/busybox/attachments/20051003/19f75fd1/attachment-0001.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tr.patch
Type: application/octet-stream
Size: 3727 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20051003/19f75fd1/attachment.obj 


More information about the busybox mailing list