• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

My own rewrite of the BSD morse code recreational utility


Commit MetaInfo

Revisionb9a88d7c2576f91f49923ae02c1c4266b21a7437 (tree)
Time2021-08-29 19:49:35
AuthorJoel Matthew Rees <joel.rees@gmai...>
CommiterJoel Matthew Rees

Log Message

morse()

Change Summary

Incremental Difference

--- a/bsdmorseplus.c
+++ b/bsdmorseplus.c
@@ -122,10 +122,7 @@ const struct punc {
122122 { '\0', NULL }
123123 };
124124
125-int main(int, char *[]);
126-void morse(int);
127125 void decode(const char *);
128-/* void show(const char *); */
129126
130127 static int sflag;
131128 static int dflag;
@@ -144,6 +141,33 @@ show(s)
144141 }
145142
146143
144+void
145+morse(c)
146+ int c;
147+{
148+ int i;
149+
150+ if (isalpha(c))
151+ show(alph[c - (isupper(c) ? 'A' : 'a')]);
152+ else if (isdigit(c))
153+ show(digit[c - '0']);
154+ else if (isspace(c))
155+ show(""); /* could show BT for a pause */
156+ else {
157+ i = 0;
158+ while (other[i].c) {
159+ if (other[i].c == c) {
160+ show(other[i].morse);
161+ break;
162+ }
163+ i++;
164+ }
165+ }
166+}
167+
168+
169+int main(int, char *[]);
170+
147171 int
148172 main(argc, argv)
149173 int argc;
@@ -256,27 +280,3 @@ decode(s)
256280 putchar('x'); /* line noise */
257281 }
258282
259-void
260-morse(c)
261- int c;
262-{
263- int i;
264-
265- if (isalpha(c))
266- show(alph[c - (isupper(c) ? 'A' : 'a')]);
267- else if (isdigit(c))
268- show(digit[c - '0']);
269- else if (isspace(c))
270- show(""); /* could show BT for a pause */
271- else {
272- i = 0;
273- while (other[i].c) {
274- if (other[i].c == c) {
275- show(other[i].morse);
276- break;
277- }
278- i++;
279- }
280- }
281-}
282-