[PATCH aiaiai 4/9] aiaiai: add checks to configuration file

Artem Bityutskiy dedekind1 at gmail.com
Fri Apr 25 15:59:59 PDT 2014


Yeah, this patch makes a lot of sense, thanks!

On Wed, 2014-04-09 at 15:26 -0700, Jacob Keller wrote:
> +# Like config_check_number, except doesn't fail on empty number.

Made an amendment here:

s/config_check_number/op_check_number/

and pushed this one to the devel branch, thank you!

> +# Arguments: $1 is config name, $2 is config value.
> +# If $2 is a positive decimal, outputs it, otherwise fails.
> +config_check_number()
> +{
> +       if [ -n "$2" ]; then
> +               [ -n "${2##0*}" -a -n "${2##*![0-9]*}" ] &&
> +               [ "$2" -gt 0 ] 2>/dev/null ||
> +                       fatal "$1: $2: invalid number."
> +       fi
> +       printf %s "$2"
> +}

-- 
Best Regards,
Artem Bityutskiy




More information about the aiaiai mailing list