hush: initial trap support

Mike Frysinger vapier at gentoo.org
Sun Mar 29 23:38:38 UTC 2009


On Sunday 29 March 2009 17:57:32 Denys Vlasenko wrote:
> +                       sig = bb_strtou(argv[i], NULL, 10);
> +                       if (errno)
> +                               sig = get_signum(argv[i]);
>
> get_signum() already does this check for "numericity".

indeed

> +       if (strcmp(argv[1], "-") == 0)
> +               /* nothing! */;
> +       else
> +               new_cmd = argv[1];
> +       if (strcmp(argv[1], "") == 0)
>
> Smaller code would be:
>
> +       if (LONE_CHAR(argv[1], '-'))
> +               /* nothing! */;
> +       else
> +               new_cmd = argv[1];
> +       if (argv[1][0] == '\0')

there's a LONE_DASH() that can be used ... but why bother ?  gcc is smart 
enough to convert strcmp()'s of 0 and 1 byte long strings and avoid the 
function call ...

> Otherwise looks ok, please apply, unless you want to go all the way
> and implement "delayed handling" correctly.

i'll commit it as is now since this is known to work (mostly).  not sure if 
i'll look into the next part ...
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20090329/37a0e96c/attachment.pgp>


More information about the busybox mailing list