[PATCH] guess_fstype applet

James B jamesbond3142 at gmail.com
Wed Aug 21 16:25:57 UTC 2013


Because it was originally built as an independent static binary which
used busybox's volume_id code.
But you're right, now that it is an applet there is no reason to avoid printf.

Updated patch attached with Ralf's modification.
I didn't check to see which one is shorter, though, but the code is sure neater.

cheers!

On Wed, Aug 21, 2013 at 5:26 PM, Ralf Friedl <Ralf.Friedl at online.de> wrote:
> Why not use printf? It's already used in busybox, so it wont be included
> just for this applet. I'm sure it would also make the code shorter. (I do
> hope that the compiler can optimize out the calls to strlen for the constant
> strings.)
>
> How about this:
> char const *type;
> if ((!volume_id_probe_all (id, 0)) && id->type)
>   type = id->type;
> else {
>   type = "unknown";
>   retcode = 1;
> }
> if (argc > 2)
>   printf ("%s: ", argv[0]);
> printf ("%s\n", type);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bb-1.22-20130821-guess_fstype-applet.patch
Type: application/octet-stream
Size: 1697 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20130821/caa2decd/attachment.obj>


More information about the busybox mailing list