rsalz@uunet.uu.net (Rich Salz) (02/08/89)
Submitted-by: mtymp01@ux.acss.umn.edu Posting-number: Volume 17, Issue 81 Archive-name: morsecode [ Kind of fun, useful for Boy Scouts and similar groups... The copyright seems kind of excessive. --r$ ] Morse takes the standard input and turns it in to international morse code. It doesn't know what to do with spaces, chars it doesn't know about it replaces with carrage returns. Also, it doesn't know about uppercase. #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create: # Makefile # morse.l # morse.p export PATH; PATH=/bin:/usr/bin:$PATH if test -f 'Makefile' then echo shar: "will not over-write existing file 'Makefile'" else cat << \SHAR_EOF > 'Makefile' DESTDIR=/usr/bin DESTMAN=/usr/man/manl all: morse install: morse mandone cp morse ${DESTDIR} morse: morse.p pc -o morse morse.p mandone: morse.l cp morse.l ${DESTMAN} touch mandone SHAR_EOF fi if test -f 'morse.l' then echo shar: "will not over-write existing file 'morse.l'" else cat << \SHAR_EOF > 'morse.l' .TH MORSE LOCAL "Jan 21, 1989" "UNIX User's Manual" "" .SH NAME morse \- translate standard input into international morse code. .SH SYNOPSIS morse .SH DESCRIPTION Morse takes the standard input and turns it in to international morse code. .SH BUGS Morse doesn't know what to do with spaces, chars it doesn't know about it replaces with carrage returns. Also, it doesn't know about uppercase. .SH AUTHOR Nils McCarthy .SH INTERNET.ADDRESS mtymp01@ux.acss.umn.edu, ...!rutgers!umn-cs!ux.acss!mtymp01 SHAR_EOF fi if test -f 'morse.p' then echo shar: "will not over-write existing file 'morse.p'" else cat << \SHAR_EOF > 'morse.p' (* THIS PROGRAM IS COPYRIGHT 1989 NILS MCCARTHY ALL RIGHTS RESERVED INCLUFING THAT OF MODIFYING THIS PROGRAM WITHOUT THE AUTHOR'S CONSENT. THIS PROGRAM MAY BE FREELY DISTRIBUTABLE PROVIDED THIS HEADER IS KEPT WITH IT. Please send any and all comments to mtymp01@ux.acss.umn.edu, if user mtymp01 unknown, please send to mccarthy@ux.acss.umn.edu with subject 'To Nils', because that isn't my account. *) program genmorse(input,output); var let : char; begin repeat read(let); case let of 'a' : write('.- '); 'b' : write('-... '); 'c' : write('-.-. '); 'd' : write('-..'); 'e' : write('. '); 'f' : write('..-.'); 'g' : write('--.'); 'h' : write('....'); 'i' : write('..'); 'j' : write('.---'); 'k' : write('-.-'); 'l' : write('.-..'); 'm' : write('--'); 'n' : write('-.'); 'o' : write('---'); 'p' : write('.--.'); 'q' : write('--.-'); 'r' : write('.-.'); 's' : write('...'); 't' : write('-'); 'u' : write('.--'); 'v' : write('...-'); 'w' : write('.--'); 'x' : write('-..-'); 'y' : write('-.--'); 'z' : write('--..'); '1' : write('.----'); '2' : write('..---'); '3' : write('...--'); '4' : write('....-'); '5' : write('.....'); '6' : write('-....'); '7' : write('--...'); '8' : write('---..'); '9' : write('----.'); '0' : write('-----'); '.' : write('.-.-.-'); ',' : write('--..--'); '?' : write('..--..'); ':' : write('---...'); ';' : write('-.-.-.'); else write(chr(10)); end; write(' '); until EOF(input); writeln('.-.-.') end. SHAR_EOF fi exit 0 # End of shell archive Thank you... also, if you want a comment, this is it: [Sorry, no readme. just edit Makefile to change destdir and mandir, then do make install and have everything happen.] ---Nils McCarthy---mtymp01@ux.acss.umn.edu---...!rutgers!umn-cs!ux.acss!mtymp01 -- Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.