From 6cbdd98986edb3c9c55c8e2ef83ad75093355c18 Mon Sep 17 00:00:00 2001 From: billf Date: Wed, 15 Dec 1999 04:28:10 +0000 Subject: -Wall fixes. --- games/morse/morse.c | 209 ++++++++++++++++++++++++++-------------------------- 1 file changed, 104 insertions(+), 105 deletions(-) (limited to 'games') 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 #include #include +#include #ifdef SPEAKER #include @@ -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); -- cgit v1.1