summaryrefslogtreecommitdiffstats
path: root/morse
diff options
context:
space:
mode:
authoreuer <root@euer.krebsco.de>2012-12-23 22:37:34 +0100
committereuer <root@euer.krebsco.de>2012-12-23 22:37:34 +0100
commitbefe04dcd3276c0c51bc9d79e4d327ed5dceb3c0 (patch)
tree21acf24c63d6a29d1621598f5ca07a438fa52a5d /morse
parent3b8a155589443ecf3012805a316421fcbd08c9ae (diff)
//morse -> //util/morse
Diffstat (limited to 'morse')
-rw-r--r--morse/COPYING14
-rw-r--r--morse/Makefile3
-rw-r--r--morse/README32
-rwxr-xr-xmorse/morse.sh160
4 files changed, 0 insertions, 209 deletions
diff --git a/morse/COPYING b/morse/COPYING
deleted file mode 100644
index d28e4178..00000000
--- a/morse/COPYING
+++ /dev/null
@@ -1,14 +0,0 @@
- DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
- Version 23, December 1984
-
- Copyright (C) 2011 tv@shackspace
-
- Everyone is permitted to copy and distribute verbatim or modified
- copies of this license document, and changing it is allowed as long
- as the name is changed.
-
- DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. You just DO WHAT THE FUCK YOU WANT TO.
-
diff --git a/morse/Makefile b/morse/Makefile
deleted file mode 100644
index 2afa845e..00000000
--- a/morse/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-.phony: all
-all:
- ln -fs $$PWD/morse.sh ../bin/morse
diff --git a/morse/README b/morse/README
deleted file mode 100644
index 67951c00..00000000
--- a/morse/README
+++ /dev/null
@@ -1,32 +0,0 @@
-MORSE(1) MORSE(1)
-
-NAME
- morse.sh - morse code generator
-
-SYNOPSIS
- morse [-l N] [-f N] [-c|-x] [text...]
-
-DESCRIPTION
- Generate visible or audible from text or stdin.
-
-OPTIONS
- -l N use N milliseconds as length of dit. Default: 60 ms
-
- -f N beep at N Hz. Default: 2000 Hz
-
- -c compile only. Morse will output morse-executable morse code.
-
- -x execute only. Interpret text as morse code, i.e. do not try
- to convert text or stdin.
-
-BUGS
- None.^_^
-
-REPORTING BUGS
- Please use Github's issue tracking system.
-
-AUTHOR
- This program was written by tv@shackspace and is distributed under the
- Do What The Fuck You Want To Public License.
-
- April 2011 MORSE(1)
diff --git a/morse/morse.sh b/morse/morse.sh
deleted file mode 100755
index c84538ca..00000000
--- a/morse/morse.sh
+++ /dev/null
@@ -1,160 +0,0 @@
-#! /bin/sh
-set -euf
-
-freq=2000
-dit=60
-mode=compile+execute
-
-## plain stupid options "parser"
-while test $# -gt 0; do
- case "$1" in
- (-l) dit=$2; shift 2;;
- (-f) freq=$2; shift 2;;
- (-c) mode=compile; shift 1;;
- (-x) mode=execute; shift 1;;
- (*) break 2;;
- esac
-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 '
- # Die Pause zwischen Wörtern beträgt sieben Dits. (1/2)
- s:[[:space:]]\+::g
-
- # Zwischen Buchstaben in einem Wort wird eine Pause von Dah eingeschoben.
- s:[^ ]:& :g
-
- # Die Pause zwischen Wörtern beträgt sieben Dits. (2/2)
- s: : :g
-' |
-sed '
- # Lateinische Buchstaben
- # Die Pause zwischen zwei gesendeten Symbolen ist ein Dit lang.
- s:A:· −:g
- s:B:− · · ·:g
- s:C:− · − ·:g
- s:D:− · ·:g
- s:E:·:g
- s:F:· · − ·:g
- s:G:− − ·:g
- s:H:· · · ·:g
- s:I:· ·:g
- s:J:· − − −:g
- s:K:− · −:g
- s:L:· − · ·:g
- s:M:− −:g
- s:N:− ·:g
- s:O:− − −:g
- s:P:· − − ·:g
- s:Q:− − · −:g
- s:R:· − ·:g
- s:S:· · ·:g
- s:T:−:g
- s:U:· · −:g
- s:V:· · · −:g
- s:W:· − −:g
- s:X:− · · −:g
- s:Y:− · − −:g
- s:Z:− − · ·:g
-' |
-sed '
- # Ziffern
- # Die Pause zwischen zwei gesendeten Symbolen ist ein Dit lang.
- s:0:− − − − −:g
- s:1:· − − − −:g
- s:2:· · − − −:g
- s:3:· · · − −:g
- s:4:· · · · −:g
- s:5:· · · · ·:g
- s:6:− · · · ·:g
- s:7:− − · · ·:g
- s:8:− − − · ·:g
- s:9:− − − − ·:g
-' |
-sed '
- # TODO Sonder- und Satzzeichen
- #s:À, Å:· − − · −
- #s:Ä:· − · −
- #s:È:· − · · −
- #s:É:· · − · ·
- #s:Ö:− − − ·
- #s:Ü:· · − −
- #s:ß:· · · − − · ·
- #s:CH:− − − −
- #s:Ñ:− − · − −
- #s:. (AAA) · − · − · −
- #s:, (MIM) − − · · − −
- #s:: − − − · · ·
- #s:; − · − · − ·
- #s:? (IMI) · · − − · ·
- #s:- − · · · · −
- #s:_ · · − − · −
- #s:( − · − − ·
- #s:) − · − − · −
- #s:'\'' · − − − − ·
- #s:= − · · · −
- #s:+ · − · − ·
- #s:/ − · · − ·
- #s:@ (AC) · − − · − ·
-' |
-sed '
- # TODO Signale
- # KA
- # (Spruchanfang) − · − · −
- # BT
- # (Pause) − · · · −
- # AR
- # (Spruchende) · − · − ·
- # VE
- # (verstanden) · · · − ·
- # SK
- # (Verkehrsende) · · · − · −
- # SOS
- # (internationaler
- # (See-)Notruf) · · · − − − · · ·
- # HH
- # (Fehler; Irrung;
- # Wiederholung
- # ab letztem
- # vollständigen Wort) · · · · · · · ·
-'
-}
-
-## Convert morse code to beep(1) arguments.
-morse2beeparg() {
-sed "
- s: : -n -f 1 -l $dit:g
- s:·: -n -f $freq -l $dit:g
- s:−: -n -f $freq -l $dah:g
-" |
- sed '
- 1s:^:beep -f 1 -l 1:
-'
-}
-
-compile() {
- char2morse
-}
-
-execute() {
- `morse2beeparg`
-}
-
-## main - process either [any non-option] arguments or stdin.
-if test $# -gt 0; then
- echo "$*"
-else
- cat
-fi |
-case "$mode" in
- (compile) compile;;
- (execute) execute;;
- (compile+execute) compile | execute;;
- (*) echo bad mode: $mode >&2; exit 23;;
-esac