diff --git a/etc/MAKEDEV.tmpl b/etc/MAKEDEV.tmpl index 36382203c72c..eb6d49c6b96c 100644 --- a/etc/MAKEDEV.tmpl +++ b/etc/MAKEDEV.tmpl @@ -1,5 +1,5 @@ #!/bin/sh - -# $NetBSD: MAKEDEV.tmpl,v 1.42 2005/04/30 16:26:06 augustss Exp $ +# $NetBSD: MAKEDEV.tmpl,v 1.43 2005/05/02 00:46:46 lukem Exp $ # # Copyright (c) 2003 The NetBSD Foundation, Inc. # All rights reserved. @@ -296,7 +296,11 @@ _USAGE_ exit 1 } -zeropad() { +# zeropad width number +# display number with a zero (`0') padding of width digits. +# +zeropad() +{ case $(($1 - ${#2})) in 5) echo 00000$2;; 4) echo 0000$2;; @@ -308,6 +312,23 @@ zeropad() { esac } +# hexprint number +# display (base10) number as hexadecimal +# +hexprint() +{ + case $1 in + [0-9]) echo $1 ;; + 10) echo a ;; + 11) echo b ;; + 12) echo c ;; + 13) echo d ;; + 14) echo e ;; + 15) echo f ;; + *) echo $(hexprint $(($1 / 16)))$(hexprint $(($1 % 16))) ;; + esac +} + do_force=false do_specfile=false while getopts fm:s ch; do