summaryrefslogtreecommitdiffstats
path: root/games/morse
diff options
context:
space:
mode:
authorbillf <billf@FreeBSD.org>1999-12-15 04:28:10 +0000
committerbillf <billf@FreeBSD.org>1999-12-15 04:28:10 +0000
commit6cbdd98986edb3c9c55c8e2ef83ad75093355c18 (patch)
tree85276a3a23a7668016893b79668444c0521e19c6 /games/morse
parenta67c7a1db7086ddd78f652b334cd7aa4685f8cb7 (diff)
downloadFreeBSD-src-6cbdd98986edb3c9c55c8e2ef83ad75093355c18.zip
FreeBSD-src-6cbdd98986edb3c9c55c8e2ef83ad75093355c18.tar.gz
-Wall fixes.
Diffstat (limited to 'games/morse')
-rw-r--r--games/morse/morse.c209
1 files changed, 104 insertions, 105 deletions
diff --git a/games/morse/morse.c b/games/morse/morse.c
index e915659..a05f83f 100644
--- a/games/morse/morse.c
+++ b/games/morse/morse.c
@@ -55,6 +55,7 @@ static const char rcsid[] =
#include <locale.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#ifdef SPEAKER
#include <machine/speaker.h>
@@ -66,130 +67,130 @@ struct morsetab {
char *morse;
};
-static struct morsetab mtab[] = {
+static const struct morsetab mtab[] = {
/* letters */
- 'a', ".-",
- 'b', "-...",
- 'c', "-.-.",
- 'd', "-..",
- 'e', ".",
- 'f', "..-.",
- 'g', "--.",
- 'h', "....",
- 'i', "..",
- 'j', ".---",
- 'k', "-.-",
- 'l', ".-..",
- 'm', "--",
- 'n', "-.",
- 'o', "---",
- 'p', ".--.",
- 'q', "--.-",
- 'r', ".-.",
- 's', "...",
- 't', "-",
- 'u', "..-",
- 'v', "...-",
- 'w', ".--",
- 'x', "-..-",
- 'y', "-.--",
- 'z', "--..",
+ {'a', ".-"},
+ {'b', "-..."},
+ {'c', "-.-."},
+ {'d', "-.."},
+ {'e', "."},
+ {'f', "..-."},
+ {'g', "--."},
+ {'h', "...."},
+ {'i', ".."},
+ {'j', ".---"},
+ {'k', "-.-"},
+ {'l', ".-.."},
+ {'m', "--"},
+ {'n', "-."},
+ {'o', "---"},
+ {'p', ".--."},
+ {'q', "--.-"},
+ {'r', ".-."},
+ {'s', "..."},
+ {'t', "-"},
+ {'u', "..-"},
+ {'v', "...-"},
+ {'w', ".--"},
+ {'x', "-..-"},
+ {'y', "-.--"},
+ {'z', "--.."},
/* digits */
- '0', "-----",
- '1', ".----",
- '2', "..---",
- '3', "...--",
- '4', "....-",
- '5', ".....",
- '6', "-....",
- '7', "--...",
- '8', "---..",
- '9', "----.",
+ {'0', "-----"},
+ {'1', ".----"},
+ {'2', "..---"},
+ {'3', "...--"},
+ {'4', "....-"},
+ {'5', "....."},
+ {'6', "-...."},
+ {'7', "--..."},
+ {'8', "---.."},
+ {'9', "----."},
/* punctuation */
- ',', "--..--",
- '.', ".-.-.-",
- '?', "..--..",
- '/', "-..-.",
- '-', "-....-",
- '=', "-...-", /* BT */
- ':', "---...",
- ';', "-.-.-.",
- '(', "-.--.", /* KN */
- ')', "-.--.-",
- '$', "...-..-",
- '+', ".-.-.", /* AR */
+ {',', "--..--"},
+ {'.', ".-.-.-"},
+ {'?', "..--.."},
+ {'/', "-..-."},
+ {'-', "-....-"},
+ {'=', "-...-"}, /* BT */
+ {':', "---..."},
+ {';', "-.-.-."},
+ {'(', "-.--."}, /* KN */
+ {')', "-.--.-"},
+ {'$', "...-..-"},
+ {'+', ".-.-."}, /* AR */
/* prosigns without already assigned values */
- '#', ".-...", /* AS */
- '@', "...-.-", /* SK */
- '*', "...-.", /* VE */
- '%', "-...-.-", /* BK */
+ {'#', ".-..."}, /* AS */
+ {'@', "...-.-"}, /* SK */
+ {'*', "...-."}, /* VE */
+ {'%', "-...-.-"}, /* BK */
- '\0', ""
+ {'\0', ""}
};
-static struct morsetab iso8859tab[] = {
- 'á', ".--.-",
- 'à', ".--.-",
- 'â', ".--.-",
- 'ä', ".-.-",
- 'ç', "-.-..",
- 'é', "..-..",
- 'è', "..-..",
- 'ê', "-..-.",
- 'ö', "---.",
- 'ü', "..--",
+static const struct morsetab iso8859tab[] = {
+ {'á', ".--.-"},
+ {'à', ".--.-"},
+ {'â', ".--.-"},
+ {'ä', ".-.-"},
+ {'ç', "-.-.."},
+ {'é', "..-.."},
+ {'è', "..-.."},
+ {'ê', "-..-."},
+ {'ö', "---."},
+ {'ü', "..--"},
- '\0', ""
+ {'\0', ""}
};
-static struct morsetab koi8rtab[] = {
+static const struct morsetab koi8rtab[] = {
/*
* the cyrillic alphabet; you'll need a KOI8R font in order
* to see the actual characters
*/
- 'Á', ".-", /* a */
- 'Â', "-...", /* be */
- '×', ".--", /* ve */
- 'Ç', "--.", /* ge */
- 'Ä', "-..", /* de */
- 'Å', ".", /* ye */
- '£', ".", /* yo, the same as ye */
- 'Ö', "...-", /* she */
- 'Ú', "--..", /* ze */
- 'É', "..", /* i */
- 'Ê', ".---", /* i kratkoye */
- 'Ë', "-.-", /* ka */
- 'Ì', ".-..", /* el */
- 'Í', "--", /* em */
- 'Î', "-.", /* en */
- 'Ï', "---", /* o */
- 'Ð', ".--.", /* pe */
- 'Ò', ".-.", /* er */
- 'Ó', "...", /* es */
- 'Ô', "-", /* te */
- 'Õ', "..-", /* u */
- 'Æ', "..-.", /* ef */
- 'È', "....", /* kha */
- 'Ã', "-.-.", /* ce */
- 'Þ', "---.", /* che */
- 'Û', "----", /* sha */
- 'Ý', "--.-", /* shcha */
- 'Ù', "-.--", /* yi */
- 'Ø', "-..-", /* myakhkij znak */
- 'Ü', "..-..", /* ae */
- 'À', "..--", /* yu */
- 'Ñ', ".-.-", /* ya */
-
- '\0', ""
+ {'Á', ".-"}, /* a */
+ {'Â', "-..."}, /* be */
+ {'×', ".--"}, /* ve */
+ {'Ç', "--."}, /* ge */
+ {'Ä', "-.."}, /* de */
+ {'Å', "."}, /* ye */
+ {'£', "."}, /* yo, the same as ye */
+ {'Ö', "...-"}, /* she */
+ {'Ú', "--.."}, /* ze */
+ {'É', ".."}, /* i */
+ {'Ê', ".---"}, /* i kratkoye */
+ {'Ë', "-.-"}, /* ka */
+ {'Ì', ".-.."}, /* el */
+ {'Í', "--"}, /* em */
+ {'Î', "-."}, /* en */
+ {'Ï', "---"}, /* o */
+ {'Ð', ".--."}, /* pe */
+ {'Ò', ".-."}, /* er */
+ {'Ó', "..."}, /* es */
+ {'Ô', "-"}, /* te */
+ {'Õ', "..-"}, /* u */
+ {'Æ', "..-."}, /* ef */
+ {'È', "...."}, /* kha */
+ {'Ã', "-.-."}, /* ce */
+ {'Þ', "---."}, /* che */
+ {'Û', "----"}, /* sha */
+ {'Ý', "--.-"}, /* shcha */
+ {'Ù', "-.--"}, /* yi */
+ {'Ø', "-..-"}, /* myakhkij znak */
+ {'Ü', "..-.."}, /* ae */
+ {'À', "..--"}, /* yu */
+ {'Ñ', ".-.-"}, /* ya */
+
+ {'\0', ""}
};
void show(const char *), play(const char *), morse(char);
@@ -208,13 +209,11 @@ int spkr;
tone_t sound;
#endif
-static struct morsetab *hightab = iso8859tab;
+static const struct morsetab *hightab = iso8859tab;
int
main(int argc, char **argv)
{
- extern char *optarg;
- extern int optind;
int ch;
char *p;
@@ -290,7 +289,7 @@ main(int argc, char **argv)
void
morse(char c)
{
- struct morsetab *m;
+ const struct morsetab *m;
if (isalpha((unsigned char)c))
c = tolower((unsigned char)c);
OpenPOWER on IntegriCloud