diff --git a/bin/calc-init.bc b/bin/calc-init.bc index 9acd7e1..5f81d86 100644 --- a/bin/calc-init.bc +++ b/bin/calc-init.bc @@ -70,6 +70,23 @@ define factorial(n) { return(t) } +print "ln log(x,base) log2 log10\n" + +define ln(x) { + return(l(x)) +} + +define log(x, b) { + return(l(x)/l(b)) +} +define log2(x) { + return(log(x, 2)) +} +define log10(x) { + return(log(x, 10)) +} + + print "\n" diff --git a/bin/patchit b/bin/patchit index 487608d..5466d92 100755 --- a/bin/patchit +++ b/bin/patchit @@ -16,7 +16,7 @@ USAGE() exit 1 } - +# main program verbose=no prompt=yes @@ -32,41 +32,42 @@ eval set -- "${args}" while : do case "$1" in - -v|--verbose) + (-v|--verbose) verbose=yes - shift ;; - -y|--yes) + (-y|--yes) prompt=no - shift ;; - --debug) + (--debug) debug=yes - shift ;; - --) + (--) shift break ;; - -h|--help) + (-h|--help) USAGE ;; - *) + (*) USAGE invalid option: $1 ;; esac + shift done # verify arguments [ -z "${prompt}" ] && USAGE prompt is not set +#[ $# -eq 0 ] && USAGE missing arguments [ $# -ne 2 ] && USAGE exactly two arguments are required +[ X"${debug}" = X"yes" ] && set -x +# extract arguments src="$1"; shift dest="$1"; shift