> So I lean towards if/else unless there's a good reason not to. :)
Can do.

> At some point, I need to do file. It's a posix command, but all the
> brains of the thing are in a file of match heuristics, and so far
> toybox doesn't depend on external data files.
> 
>   http://pubs.opengroup.org/onlinepubs/9699919799/utilities/file.html

funny you should mention that, I have a version of "file --mime-type" that
works similar to the blkid after checking the file extension(s).  Currently I
have about 30kb of extension-based mime-type checks some are not
very common though and could be commened out.  If the ext check fails
it then falls back to magic@offset checks (currently I only have common
image types implemented)  I only wrote this because it is a choke point
in a lot of web servers, so all the code is in 7 switch cases rather
than an external file (it is ~60x faster though, since most of the time
it doesn't even need to open the file)  again, if's may be better than
switch case in hind sight.  My initial implementation is here:
http://murga-linux.com/puppy/viewtopic.php?p=715660#715660
but I have fixed some stuff since and added the magic checks.

> The current command's name is this.which->name (because this.which is a
> pointer to our entry in toylist[], and then name is the command name
> field, main is the function pointer, and so on).

That should be enough to do a strncmp to determine whether to handle
the UUID and device name.  It will be early next week before I can get to
it though.

R,
Brad Conroy
_______________________________________________
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to