[Toybox] [PATCH] id: support numeric lookup.

enh enh at google.com
Sat Nov 2 23:04:07 PDT 2019


Fall back to converting the "name" to an integer and calling getpwuid().
We need to update `username` for the later call to getgrouplist().

Also fix the separator printing logic to avoid a trailing ',' on `id 0`.

Switch to FLAG() and move some declarations down to where they can be
initialized, both for clarity.

Also add simple tests. Sadly, there's no always-present user that is in
multiple groups.
---
 tests/id.test   | 10 ++++++++++
 toys/posix/id.c | 49 ++++++++++++++++++++++++++-----------------------
 2 files changed, 36 insertions(+), 23 deletions(-)
 create mode 100755 tests/id.test
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-id-support-numeric-lookup.patch
Type: text/x-patch
Size: 5097 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20191102/cf2c771e/attachment-0002.bin>


More information about the Toybox mailing list