Chat applet matured
Denys Vlasenko
vda.linux at googlemail.com
Sun Feb 17 15:26:35 UTC 2008
On Sunday 17 February 2008 13:50, dronnikov at gmail.com wrote:
> Hello!
>
> Attached is the chat applet.
+#define chat_trivial_usage
+#define chat_full_usage
Please give at least rudimentary help text here.
(This one must be fixed prior to inclusion).
+// NOTE: moving these to BSS saves 58 bytes. Good or not?
The best way would be to use "struct globals" trick
(see, for example, networking/httpd.c).
This will make you use zero bytes in data and bss.
+ while (!exitcode
+ && safe_poll(&pfd, 1, timeout) > 0
+ && (pfd.revents & POLLIN))
The whole point of safe_poll is to loop internally on EINTR.
So signals will not interrupt it. Here your signal
handlers will set exitcode, but safe_poll
will still loop inside! Use ordinary poll.
+ register char c = *buf;
I think gcc pays no attention to "register"...
+ bb_signals(1 << SIGHUP, onoff ? signal_handler : SIG_IGN);
Maybe just use signal(). bb_signals is good when you want
to set many signals to one handler.
--
vda
More information about the busybox
mailing list