-/* Convert ASCII to morse code. Reads from stdin if provided with no argument
- or "-", otherwise reads from the first command line argument. Prints "*" if
- character is not found. */
+/* Convert ASCII to morse code. Reads from stdin if provided with no argument
+ or "-", otherwise reads from the first command line argument. Prints "?" if
+ character is not found. */
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-const char *aa[] = {"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", "1",
- "2", "3", "4", "5", "6", "7", "8", "9", "0", " "};
+const char *aa[] = {"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", "1", "2", "3", "4",
+ "5", "6", "7", "8", "9", "0", " "};
-const char *ma[] = {"•-", "-•••", "-•-•", "-••", "•", "••-•", "--•", "••••",
- "••", "•---", "-•-", "•-••", "--", "-•", "---", "•--•", "--•-", "•-•", "•••",
- "-", "•--", "•••-", "•--", "-••-", "-•--", "--••", "•----", "••---", "•••--",
- "••••-", "•••••", "-••••", "--•••", "---••", "----•", "-----", " "};
+const char *ma[] = {"•-", "-•••", "-•-•", "-••", "•", "••-•", "--•",
+ "••••", "••", "•---", "-•-", "•-••", "--", "-•",
+ "---", "•--•", "--•-", "•-•", "•••", "-", "•--",
+ "•••-", "•--", "-••-", "-•--", "--••", "•----",
+ "••---", "•••--", "••••-", "•••••", "-••••",
+ "--•••", "---••", "----•", "-----", " "};
void
convert(char *c)
printf("%s", ma[i]);
break;
} else if (i == sizeof(aa)/sizeof(char *) - 1) {
- printf("*");
+ printf("?");
}
}
printf(" ");
int
main(int argc, char **argv)
{
+ (void)argc;
char c[2];
c[1] = '\0';