Plan 9 from Bell Labs’s /usr/web/sources/contrib/boyd/sys/src/cmd/b2a.html

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


<html>
<body>
<pre>
<tt>
#!/bin/sh

# baudot to ascii

awk '
BEGIN	{
	letters["| o o .       |"] = "A"
	figures["| o o .       |"] = "-"
	letters["| o   .   o o |"] = "B"
	figures["| o   .   o o |"] = "?"
	letters["|   o . o o   |"] = "C"
	figures["|   o . o o   |"] = ":"
	letters["| o   .   o   |"] = "D"
	figures["| o   .   o   |"] = "$"
	letters["| o   .       |"] = "E"
	figures["| o   .       |"] = "3"
	letters["| o   . o o   |"] = "F"
	figures["| o   . o o   |"] = "!"
	letters["|   o .   o o |"] = "G"
	figures["|   o .   o o |"] = "&amp;"
	letters["|     . o   o |"] = "H"
	figures["|     . o   o |"] = "STOP"
	letters["|   o . o     |"] = "I"
	figures["|   o . o     |"] = "8"
	letters["| o o .   o   |"] = "J"
	figures["| o o .   o   |"] = "'\''"
	letters["| o o . o o   |"] = "K"
	figures["| o o . o o   |"] = "("
	letters["|   o .     o |"] = "L"
	figures["|   o .     o |"] = ")"
	letters["|     . o o o |"] = "M"
	figures["|     . o o o |"] = "."
	letters["|     . o o   |"] = "N"
	figures["|     . o o   |"] = ","
	letters["|     .   o o |"] = "O"
	figures["|     .   o o |"] = "9"
	letters["|   o . o   o |"] = "P"
	figures["|   o . o   o |"] = "0"
	letters["| o o . o   o |"] = "Q"
	figures["| o o . o   o |"] = "1"
	letters["|   o .   o   |"] = "R"
	figures["|   o .   o   |"] = "4"
	letters["| o   . o     |"] = "S"
	figures["| o   . o     |"] = "BELL"
	letters["|     .     o |"] = "T"
	figures["|     .     o |"] = "5"
	letters["| o o . o     |"] = "U"
	figures["| o o . o     |"] = "7"
	letters["|   o . o o o |"] = "V"
	figures["|   o . o o o |"] = ";"
	letters["| o o .     o |"] = "W"
	figures["| o o .     o |"] = "2"
	letters["| o   . o o o |"] = "X"
	figures["| o   . o o o |"] = "/"
	letters["| o   . o   o |"] = "Y"
	figures["| o   . o   o |"] = "6"
	letters["| o   .     o |"] = "Z"
	figures["| o   .     o |"] = "\""
	letters["|     .       |"] = ""
	figures["|     .       |"] = ""
	letters["|     .   o   |"] = "\r"
	figures["|     .   o   |"] = "\r"
	letters["|   o .       |"] = "\n"
	figures["|   o .       |"] = "\n"
	letters["|     . o     |"] = " "
	figures["|     . o     |"] = " "
	letters["| o o . o o o |"] = "LTRS"
	figures["| o o . o o o |"] = "LTRS"
	letters["| o o .   o o |"] = "FIGS"
	figures["| o o .   o o |"] = "FIGS"
	end =	"|-------------|"

	figs = 0
}

#$0 == end	{ next }

figs != 0 &amp;&amp; figures[$0] == "LTRS" {
	figs = 0
	next
}

figs == 0 &amp;&amp; letters[$0] == "FIGS" {
	figs = 1
	next
}

{
	if (figs)
	{
		if (figures[$0] == "BELL")
			printf("%c", '\007')
		else
			printf("%s", figures[$0])
	}
	else
		printf("%s", letters[$0])
		
}
' | tr '[A-Z]' '[a-z]'
</tt>
</pre>
<HR>
&copy 1998,
Boyd Roberts:
<A HREF="mailto:boyd@fr.inter.net">boyd@fr.inter.net</A>
</body>
</html>

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.