Skip to content

Commit

Permalink
add a log alias function
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Hall <hsw@ms2.hinet.net>
  • Loading branch information
hxw committed Jul 26, 2016
1 parent 2eb6173 commit b29592a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
17 changes: 17 additions & 0 deletions bin/calc-init.bc
Expand Up @@ -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"


Expand Down
21 changes: 11 additions & 10 deletions bin/patchit
Expand Up @@ -16,7 +16,7 @@ USAGE()
exit 1
}


# main program
verbose=no
prompt=yes

Expand All @@ -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

Expand Down

0 comments on commit b29592a

Please sign in to comment.