Subject: Re: MAKEDEV is not portable
To: None <port-sparc@netbsd.org>
From: Robert Evans <r.evans@ic.ac.uk>
List: port-sparc
Date: 01/07/1999 10:53:34
> if [ whatever ]; then
>   mkdisk() {
>     mknod $1 b $2 $(($3 * 16 + $4))
>   }
>   ...
> else
>   mkdisk() {
>     mknod $1 b $2 `expr $3 * 16 + $4`
>   }
>   ...
> fi

If I'm right about the behaviour of the previous example on shells with
functions but no arithmetic, this will fail in the same way.  How about
putting the functions into something like makedev_expr_subr.sh and
makedev_arith_subr.sh and sourcing the appropriate file depending on
the shells abilities?  This should keep things fairly clean, and still
be pretty efficient on systems that handle shell arithmetic.

The only problem is that two extra files will now be updated when new
devices are added, although the makedev_expr_subr.sh need only handle
sufficient devices to bootstrap the system.

Cheers,
Rob