summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@also>2011-04-24 13:23:14 +0200
committertv <tv@also>2011-04-24 13:23:14 +0200
commita735e187e28266912fa94028ccb5006398fc5fca (patch)
treefb2d7ce472a8e889c902d272ef24fe73b7673842
parented18b51bb535da53b4fdbbd09936badea3256cc9 (diff)
morse.sh: add more function comments
-rwxr-xr-xmorse.sh6
1 files changed, 5 insertions, 1 deletions
diff --git a/morse.sh b/morse.sh
index 336af305..c84538ca 100755
--- a/morse.sh
+++ b/morse.sh
@@ -5,6 +5,7 @@ freq=2000
dit=60
mode=compile+execute
+## plain stupid options "parser"
while test $# -gt 0; do
case "$1" in
(-l) dit=$2; shift 2;;
@@ -18,6 +19,8 @@ done
# Ein Dah ist dreimal so lang wie ein Dit.
dah=`echo "$dit * 3" | bc`
+## Convert a character to the corresponting morse code.
+## Note: any unknown characters are left unaltered.
char2morse() {
tr [a-z] [A-Z] |
sed '
@@ -123,6 +126,7 @@ sed '
'
}
+## Convert morse code to beep(1) arguments.
morse2beeparg() {
sed "
s: : -n -f 1 -l $dit:g
@@ -142,7 +146,7 @@ execute() {
`morse2beeparg`
}
-
+## main - process either [any non-option] arguments or stdin.
if test $# -gt 0; then
echo "$*"
else