[Toybox] new toy : w command

Andre Renaud andre at bluewatersys.com
Wed Jul 18 12:43:32 PDT 2012


Hi Gaurang,

On 19 July 2012 01:40, Gaurang Shastri <gmshastri at gmail.com> wrote:
> Hi All,
>
> Please find attached the initial implementation of "w" command.
>
> Output after compiling my code with toybox :
> {{{
> [root at stark toybox-0.3.0]# ./toybox w
> USER     TTY             LOGIN@                 FROM
> root        tty2      Wed Jul 11 18:29:24 2012  ( )
> rpmuser  pts/1    Wed Jul 11 21:33:15 2012  (43.88.80.109)
> rpmuser  pts/2    Wed Jul 11 19:23:09 2012  (:0.0)
> rpmuser  pts/3    Tue Jul 17 20:33:41 2012  (43.88.80.208)
> }}}
>
> Dear Rob, let me know your comments if any.
>
> Thanks & Regards,
> Gaurang Shastri

I would recommend that you combine all of the xprintf's into a single
one, as well as some minor shuffling of your carriage returns:
if (x->ut_type==7)
    xprintf("%-9.8s%-9.8s %4.24s (%-1.12s)\n",
        x->ut_user, x->ut_line, ctime(&x->ut_tv.tv_sec), x->ut_host)

Regards,
Andre

 1342640612.0


More information about the Toybox mailing list