aboutsummaryrefslogtreecommitdiff
path: root/toys/lsb/hostname.c
AgeCommit message (Collapse)Author
2019-10-12hostname: fix error reporting.Elliott Hughes
The <netdb.h> functions have their own errno :-(
2019-10-08Add dnsdomainname, fix "hostname -d" segfault on machine with no domain name,Rob Landley
and cleanup hostname to only call gethostname() once. It passes the one test in test_hostname, if that helps.
2019-01-19hostname: fix behavior when in jail.Elliott Hughes
Only -d and -f should cause a DNS lookup. The rest should just act directly on the result of gethostname(3). Encountered with the AOSP buildbots' use of nsjail, but tested with both the Debian hostname and toybox hostname thus: ``` unshare -Uunr sh hostname android-build hostname hostname -s hostname -d hostname -f ``` (Not sure how to add that to the tests.) Also fix a SEGV with -s if the hostname doesn't contain a '.'. Also switch to the FLAG() macro. Also add the missing -s to the synopsis. Bug: http://b/123123255
2018-12-04Clean up some --help formatting.Elliott Hughes
Be consistent about upper versus lower case. (Upper seems to have the majority, so I went with that, though I'm happy to provide the opposite patch as long as we're consistent!) Be consistent about using \t. (Though saving a few bytes seems like it might be better done in the code that generates help.h rather than directly in the source, since tabs make careful ASCII art layout hard enough that we regularly have things misaligned.) Remove trailing periods (most of which seem to have been added by me). Always use the US "human readable" rather than my British "human-readable", and be more consistent about declaring whether we're showing multiples of 1000 or 1024. Just say "verbose" rather than adding a useless "mode" or "output".
2018-11-17hostname: add -s/-f and -d.Elliott Hughes
At least the AOSP build doesn't try to _set_ the hostname...
2017-05-27Replace two space indents with tab indents in help text (for consistency).Rob Landley
2016-05-04Hostname cleanup, as described on the list.Rob Landley
2016-05-03Add -b and -F arguments to hostnamePaul Barker
These arguments are required to correctly set the hostname at boot time. They are used by the '/etc/init.d/hostname.sh' init script in an OpenEmbedded system.
2012-11-13Reindent to two spaces per level. Remove vi: directives that haven't worked ↵Rob Landley
right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style. The actual code should be the same afterward, this is just cosmetic refactoring.
2012-10-08New build infrastructure to generate FLAG_ macros and TT alias, #define ↵Rob Landley
FOR_commandname before #including toys.h to trigger it. Rename DEFINE_GLOBALS() to just GLOBALS() (because I could never remember if it was DECLARE_GLOBALS). Convert existing commands to use new infrastructure, and replace optflag constants with FLAG_ macros where appropriate.
2012-09-09gethostname: Tighten up error messages slightly, switch to default "y".Rob Landley
2012-08-25Regularize command headers, update links to standards documents.Rob Landley
2012-08-25Move commands into "posix", "lsb", and "other" menus/directories.Rob Landley