[Toybox] [CLEANUP] getty: clean up messages, simplify code
Rob Landley
rob at landley.net
Sat Apr 12 21:46:23 PDT 2014
On 04/12/14 16:25, Isaac Dunham wrote:
> getty: build fix, clean up messages, simplify code
>
> build fix: xmsprintf has been renamed
> shorten and lowercase the error messages
> use xexec() instead of execlp(); perror_exit();
> remove redundant variable setting
Applied.
> --
> And the rationale:
>
> First, perror_* spits out
> getty: ...
> so capitalizing the first letter does not make sense.
> getty: something:message
> looks rather messy; use either "something message" or "something: message"
perror_msg() or perror_exit() add strerror(errno) to the end of the
message. If errno isn't intersting (which it isn't for "too many
speeds"), best to drop the p at the beginning.
> If isatty() fails, then don't pretend the problem is "Not a character device";
> anyone who knows what a character device is will know what a tty is,
> and there are plenty of character devices that we don't want them using
> (ever tried logging in to the speaker?)
> Keep the messages concise, too.
>
> It's simpler to xexec(ptr) than to do the execlp(*ptr, *ptr, ...) dance--
> especially if we can make one call to xexec.
There's a reason I wrote it. :)
> c_iflag = 0;
> c_iflag |= ...;
> is equivalent to
> c_iflag = ...;
>
> I'm not sure whether to inline the terminal setting stuff yet, since
> it may be getting factored out soon.
> Locally, I've cut out the utmp stuff; it would be good to either
> cut it out or switch to utmpx, since we follow SUSv4.
I'm shoehorning strptime() into date at the moment, and _really_ need to
get an aboriginal release out. Not likely to poke at it this week. :)
> Thanks,
> Isaac Dunham
Rob
1397364383.0
More information about the Toybox
mailing list