[Toybox] stat: Some cleanup

Felix Janda felix.janda at posteo.de
Fri Apr 19 15:28:27 PDT 2013


Hello,

attached are two patches cleaning up stat a bit. The first changes from
4 to 2 space indentation, the second is more interesting.

First of all it extends stat to correctly handle format strings.
(Previously it considered only the second char of the format string.)
This made it possible to remove duplication between print_stat_format()
and stat_main(). The option processing now uses the toybox infrastructure
better and by sorting the options in an appropriate way stat_main()
could be simplified greatly. get_access_str() is now no longer broken.
Apart from this there are various other small changes.

The functionality of get_access_str() is also implemented in the ls toy
(likely much better). Should something like it be in the library?
Actually since stat and ls are both frontends to the stat system call
more is duplicated.

I also wonder whether toybox will ever have SELinux support... My local
man page does even not document the -Z option to stat.

Felix
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stat-reindent.patch
Type: text/x-patch
Size: 18002 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20130420/42012297/attachment-0012.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stat-cleanup.patch
Type: text/x-patch
Size: 13564 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20130420/42012297/attachment-0013.bin>


More information about the Toybox mailing list