[Toybox] [PATCH] Minor formatting and cleanup in getopt.c

Oliver Webb aquahobbyist at proton.me
Wed Feb 28 16:23:28 PST 2024


I've been looking at some of the other pending commands, And found a getopt implementation from 2017 by AOSP.
Looking at the source code, it doesn't seem unclean, nor overly large (about 100 lines).
It does use getopt_long_only, a GNU extension of glibc, but musl has that so it will work
on both glibc and musl. It is GNU compatible too, all test cases pass (even for TEST_HOST).

There were a few things I changed (printf to xputsn/putchar/xprintf), and added a link
to https://man7.org/linux/man-pages/man1/getopt.1.html, both in the attached patch.

There doesn't seem like a good reason for this command to be in pending, are the calls to
getopt_long_only a problem?

-   Oliver Webb <aquahobbyist at proton.me>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-getopt.c-Formatting-printf-xprintf-xputsn-putchar-Re.patch
Type: text/x-patch
Size: 2076 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20240229/ecbaf43b/attachment.bin>


More information about the Toybox mailing list