morse.c (152306) | morse.c (179654) |
---|---|
1/* 2 * Copyright (c) 1988, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 18 unchanged lines hidden (view full) --- 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 */ 33 34/* | 1/* 2 * Copyright (c) 1988, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 18 unchanged lines hidden (view full) --- 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 */ 33 34/* |
35 * Taught to send *real* morse by Lyndon Nerenberg (VE7TCP/VE6BBM) 36 * <lyndon@orthanc.com> | 35 * Taught to send *real* morse by Lyndon Nerenberg (VE6BBM) 36 * <lyndon@orthanc.ca> |
37 */ 38 39#ifndef lint 40static const char copyright[] = 41"@(#) Copyright (c) 1988, 1993\n\ 42 The Regents of the University of California. All rights reserved.\n"; 43#endif /* not lint */ 44 45#ifndef lint 46#if 0 47static char sccsid[] = "@(#)morse.c 8.1 (Berkeley) 5/31/93"; 48#endif 49static const char rcsid[] = | 37 */ 38 39#ifndef lint 40static const char copyright[] = 41"@(#) Copyright (c) 1988, 1993\n\ 42 The Regents of the University of California. All rights reserved.\n"; 43#endif /* not lint */ 44 45#ifndef lint 46#if 0 47static char sccsid[] = "@(#)morse.c 8.1 (Berkeley) 5/31/93"; 48#endif 49static const char rcsid[] = |
50 "$FreeBSD: head/games/morse/morse.c 152306 2005-11-11 09:57:32Z ru $"; | 50 "$FreeBSD: head/games/morse/morse.c 179654 2008-06-08 19:35:47Z scf $"; |
51#endif /* not lint */ 52 53#include <sys/time.h> 54 55#include <ctype.h> 56#include <fcntl.h> 57#include <langinfo.h> 58#include <locale.h> --- 419 unchanged lines hidden (view full) --- 478show(const char *s) 479{ 480 if (lflag) { 481 printf("%s ", s); 482 } else if (sflag) { 483 printf(" %s\n", s); 484 } else { 485 for (; *s; ++s) | 51#endif /* not lint */ 52 53#include <sys/time.h> 54 55#include <ctype.h> 56#include <fcntl.h> 57#include <langinfo.h> 58#include <locale.h> --- 419 unchanged lines hidden (view full) --- 478show(const char *s) 479{ 480 if (lflag) { 481 printf("%s ", s); 482 } else if (sflag) { 483 printf(" %s\n", s); 484 } else { 485 for (; *s; ++s) |
486 printf(" %s", *s == '.' ? "dit" : "dah"); | 486 printf(" %s", *s == '.' ? *(s + 1) == '\0' ? "dit" : 487 "di" : "dah"); |
487 printf("\n"); 488 } 489} 490 491void 492play(const char *s) 493{ 494#ifdef SPEAKER --- 90 unchanged lines hidden --- | 488 printf("\n"); 489 } 490} 491 492void 493play(const char *s) 494{ 495#ifdef SPEAKER --- 90 unchanged lines hidden --- |