/ 2005-11-13 12:38:52 +0000
\ David Lee:
> +# Portability comments:
> +# o The following rely on Bourne "sh" pattern-matching, which is usually
> +#   that for filename generation (note: not regexp).
> +# o The "*) true ;;" clause is probably unnecessary, but is included
> +#   here for completeness.
> +# o The negation in the pattern uses "!".  This seems to be common
> +#   across many OSes (whereas the alternative "^" fails on some).
> +# o If an OS is encountered where this negation fails, then a possible
> +#   alternative would be to replace the function contents by (e.g.):
> +#    [ -z "`echo $1 | tr -d '[0-9]'`" ]
> +#
>  ocf_is_decimal() {
> -        # test: delete all decimal digits: result should be zero-length
> -        [ -z "`echo $1 | tr -d '[0-9]'`" ]
> +     case "$1" in
> +     *[!0-9]*)       # got invalid char
> +             false ;;
> +     *)
> +             true ;;
> +     esac
>  }

probably not important at all, and I may miss the point, but:
is undefined/empty a valid decimal/hexadecimal/octal?
if not:
      ""|*[!0-9]*) false;; # empty or invalid character
      ^^^
or similar

        Lars
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to