diff options
Diffstat (limited to 'parseutil/testdcf.c')
-rw-r--r-- | parseutil/testdcf.c | 79 |
1 files changed, 63 insertions, 16 deletions
diff --git a/parseutil/testdcf.c b/parseutil/testdcf.c index e3b71f319a377..223ab30838f24 100644 --- a/parseutil/testdcf.c +++ b/parseutil/testdcf.c @@ -1,23 +1,42 @@ /* - * /src/NTP/REPOSITORY/v4/parseutil/testdcf.c,v 3.18 1996/12/01 16:05:04 kardel Exp - * - * testdcf.c,v 3.18 1996/12/01 16:05:04 kardel Exp + * /src/NTP/ntp4-dev/parseutil/testdcf.c,v 4.10 2005/08/06 14:18:43 kardel RELEASE_20050806_A * + * testdcf.c,v 4.10 2005/08/06 14:18:43 kardel RELEASE_20050806_A + * * simple DCF77 100/200ms pulse test program (via 50Baud serial line) * - * Copyright (c) 1993,1994,1995,1996, 1998 by Frank Kardel - * Friedrich-Alexander Universität Erlangen-Nürnberg, Germany - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * Copyright (c) 1995-2005 by Frank Kardel <kardel <AT> ntp.org> + * Copyright (c) 1989-1994 by Frank Kardel, Friedrich-Alexander Universität Erlangen-Nürnberg, Germany + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the author nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. * - * This program may not be sold or used for profit without prior - * written consent of the author. */ #include "ntp_stdlib.h" +#include <sys/ioctl.h> #include <unistd.h> #include <stdio.h> #include <fcntl.h> @@ -47,6 +66,8 @@ struct clocktime /* clock time broken up from time code */ typedef struct clocktime clocktime_t; +static char type(unsigned int); + #define TIMES10(_X_) (((_X_) << 3) + ((_X_) << 1)) /* @@ -106,6 +127,8 @@ typedef struct clocktime clocktime_t; * 59 - usually missing (minute indication), except for leap insertion */ +static char revision[] = "4.10"; + static struct rawdcfcode { char offset; /* start bit */ @@ -264,13 +287,13 @@ convert_rawdcf( } } -char +static char type( unsigned int c ) { c ^= 0xFF; - return (c > 0xF); + return (c >= 0xF); } static const char *wday[8] = @@ -359,14 +382,17 @@ main( term.c_cc[VMIN] = 1; #ifdef NO_PARENB_IGNPAR /* Was: defined(SYS_IRIX4) || defined (SYS_IRIX5) */ /* somehow doesn't grok PARENB & IGNPAR (mj) */ - term.c_cflag = B50|CS8|CREAD|CLOCAL; + term.c_cflag = CS8|CREAD|CLOCAL; #else - term.c_cflag = B50|CS8|CREAD|CLOCAL|PARENB; + term.c_cflag = CS8|CREAD|CLOCAL|PARENB; #endif term.c_iflag = IGNPAR; term.c_oflag = 0; term.c_lflag = 0; + cfsetispeed(&term, B50); + cfsetospeed(&term, B50); + if (tcsetattr(fd, TCSANOW, &term) == -1) { perror("tcsetattr"); @@ -384,7 +410,7 @@ main( } #endif - printf(" DCF77 monitor - Copyright (C) 1993-1996, Frank Kardel\n\n"); + printf(" DCF77 monitor %s - Copyright (C) 1993-2005, Frank Kardel\n\n", revision); clock_time.hour = 0; clock_time.minute = 0; @@ -491,3 +517,24 @@ main( } return 0; } + +/* + * History: + * + * testdcf.c,v + * Revision 4.10 2005/08/06 14:18:43 kardel + * cleanup warnings + * + * Revision 4.9 2005/08/06 14:14:38 kardel + * document revision on startup + * + * Revision 4.8 2005/08/06 14:10:08 kardel + * fix setting of baud rate + * + * Revision 4.7 2005/04/16 17:32:10 kardel + * update copyright + * + * Revision 4.6 2004/11/14 15:29:42 kardel + * support PPSAPI, upgrade Copyright to Berkeley style + * + */ |