• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-c誰得cocoaqtpythonrubywindowsphpgameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwitterdombtronvb.nettestarduinodirectxpreviewerゲームエンジン

My own rewrite of the BSD morse code recreational utility


Commit MetaInfo

Revision793788138d47273e8db9c52f6f6f4e3f0dcbdc2e (tree)
Time2021-08-29 19:52:04
AuthorJoel Matthew Rees <joel.rees@gmai...>
CommiterJoel Matthew Rees

Log Message

was it morse or really decode?

Change Summary

Incremental Difference

--- a/bsdmorseplus.c
+++ b/bsdmorseplus.c
@@ -122,12 +122,41 @@ const struct punc {
122122 { '\0', NULL }
123123 };
124124
125-void decode(const char *);
126125
127126 static int sflag;
128127 static int dflag;
129128
130129
130+void
131+decode(s)
132+ const char *s;
133+{
134+ int i;
135+
136+ for (i = 0; i < 10; i++)
137+ if (strcmp(digit[i], s) == 0) {
138+ putchar('0' + i);
139+ return;
140+ }
141+
142+ for (i = 0; i < 26; i++)
143+ if (strcmp(alph[i], s) == 0) {
144+ putchar('A' + i);
145+ return;
146+ }
147+ i = 0;
148+ while (other[i].c) {
149+ if (strcmp(other[i].morse, s) == 0) {
150+ putchar(other[i].c);
151+ return;
152+ }
153+ i++;
154+ }
155+ if (strcmp("...-.-", s) == 0)
156+ return;
157+ putchar('x'); /* line noise */
158+}
159+
131160
132161 void
133162 show(s)
@@ -250,33 +279,3 @@ main(argc, argv)
250279 return 0;
251280 }
252281
253-void
254-decode(s)
255- const char *s;
256-{
257- int i;
258-
259- for (i = 0; i < 10; i++)
260- if (strcmp(digit[i], s) == 0) {
261- putchar('0' + i);
262- return;
263- }
264-
265- for (i = 0; i < 26; i++)
266- if (strcmp(alph[i], s) == 0) {
267- putchar('A' + i);
268- return;
269- }
270- i = 0;
271- while (other[i].c) {
272- if (strcmp(other[i].morse, s) == 0) {
273- putchar(other[i].c);
274- return;
275- }
276- i++;
277- }
278- if (strcmp("...-.-", s) == 0)
279- return;
280- putchar('x'); /* line noise */
281-}
282-