summaryrefslogtreecommitdiff
path: root/libparse
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2015-04-07 08:29:34 +0000
committer <>2015-04-13 18:52:43 +0000
commitb2ccf8dd31d1457ae9f0ae270054117179220370 (patch)
tree4ccd4a16d5e9ef5869630ba624e822665a6e248c /libparse
parentbdab5265fcbf3f472545073a23f8999749a9f2b9 (diff)
downloadntp-b2ccf8dd31d1457ae9f0ae270054117179220370.tar.gz
Imported from /home/lorry/working-area/delta_ntp/ntp-4.2.8p2.tar.gz.HEADntp-4.2.8p2master
Diffstat (limited to 'libparse')
-rw-r--r--libparse/Makefile.am32
-rw-r--r--libparse/Makefile.in43
-rw-r--r--libparse/clk_computime.c62
-rw-r--r--libparse/clk_dcf7000.c27
-rw-r--r--libparse/clk_hopf6021.c39
-rw-r--r--libparse/clk_meinberg.c179
-rw-r--r--libparse/clk_rawdcf.c64
-rw-r--r--libparse/clk_rcc8000.c31
-rw-r--r--libparse/clk_schmid.c36
-rw-r--r--libparse/clk_sel240x.c16
-rw-r--r--libparse/clk_trimtaip.c23
-rw-r--r--libparse/clk_trimtsip.c62
-rw-r--r--libparse/clk_varitext.c87
-rw-r--r--libparse/clk_wharton.c13
-rw-r--r--libparse/data_mbg.c149
-rw-r--r--libparse/gpstolfp.c10
-rw-r--r--libparse/info_trimble.c4
-rw-r--r--libparse/mkinfo_rcmd.sed2
-rw-r--r--libparse/mkinfo_scmd.sed2
-rw-r--r--libparse/parse.c120
-rw-r--r--libparse/parse_conf.c4
-rw-r--r--libparse/parsesolaris.c108
-rw-r--r--libparse/parsestreams.c126
-rw-r--r--libparse/trim_info.c2
24 files changed, 657 insertions, 584 deletions
diff --git a/libparse/Makefile.am b/libparse/Makefile.am
index a92db15..2988e08 100644
--- a/libparse/Makefile.am
+++ b/libparse/Makefile.am
@@ -1,5 +1,5 @@
NULL=
-BUILT_SOURCES =
+BUILT_SOURCES = $(VPHACK) info_trimble.c $(VPHACK_AFTER)
CLEANFILES =
noinst_LIBRARIES = @MAKE_LIBPARSE@ @MAKE_LIBPARSE_KERNEL@
EXTRA_LIBRARIES = libparse.a libparse_kernel.a
@@ -12,6 +12,29 @@ K_CFLAGS = -DPARSESTREAM -DNTP_NEED_BOPS
# previously. It is located in $(srcdir) and any updates must
# end up there.
+#
+# VPHACK and VPHACK_AFTER are enabled on non-GNU makes (such as
+# BSD make) to work around build/dependency issues where we want
+# built source files to live in srcdir, as opposed to builddir.
+#
+
+if VPATH_HACK
+VPHACK= vphack
+VPHACK_AFTER= vphack_after
+else
+VPHACK=
+VPHACK_AFTER=
+endif
+
+vphack:
+ test -e info_trimble.c || ln -s $(srcdir)/info_trimble.c .
+
+vphack_after:
+ test -L info_trimble.c || ( \
+ mv info_trimble.c $(srcdir)/info_trimble.c && \
+ ln -s $(srcdir)/info_trimble.c . \
+ )
+
libparse_a_SOURCES = parse.c \
parse_conf.c \
clk_meinberg.c \
@@ -65,11 +88,16 @@ AM_CPPFLAGS += $(CPPFLAGS_NTP)
EXTRA_DIST = parsesolaris.c parsestreams.c mkinfo_scmd.sed mkinfo_rcmd.sed info_trimble.c
-$(srcdir)/info_trimble.c: $(top_srcdir)/include/trimble.h $(srcdir)/Makefile.am $(srcdir)/mkinfo_scmd.sed $(srcdir)/mkinfo_rcmd.sed
+info_trimble.c: $(top_srcdir)/include/trimble.h $(srcdir)/Makefile.am $(srcdir)/mkinfo_scmd.sed $(srcdir)/mkinfo_rcmd.sed
sed -n -f $(srcdir)/mkinfo_scmd.sed $(top_srcdir)/include/trimble.h > info_trimble.new
sed -n -f $(srcdir)/mkinfo_rcmd.sed $(top_srcdir)/include/trimble.h >> info_trimble.new
mv -f info_trimble.new $@
+#$(srcdir)/info_trimble.c: $(top_srcdir)/include/trimble.h $(srcdir)/Makefile.am $(srcdir)/mkinfo_scmd.sed $(srcdir)/mkinfo_rcmd.sed
+# sed -n -f $(srcdir)/mkinfo_scmd.sed $(top_srcdir)/include/trimble.h > info_trimble.new
+# sed -n -f $(srcdir)/mkinfo_rcmd.sed $(top_srcdir)/include/trimble.h >> info_trimble.new
+# mv -f info_trimble.new $@
+
kieee754io.o: $(srcdir)/ieee754io.c
$(COMPILE) $(K_CFLAGS) -c $(srcdir)/ieee754io.c -o $@
diff --git a/libparse/Makefile.in b/libparse/Makefile.in
index 0344c96..11dbc38 100644
--- a/libparse/Makefile.in
+++ b/libparse/Makefile.in
@@ -43,8 +43,7 @@ subdir = libparse
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/sntp/libopts/m4/libopts.m4 \
$(top_srcdir)/sntp/libopts/m4/stdnoreturn.m4 \
- $(top_srcdir)/sntp/libevent/m4/openldap-thread-check.m4 \
- $(top_srcdir)/sntp/libevent/m4/openldap.m4 \
+ $(top_srcdir)/sntp/m4/ax_c99_struct_init.m4 \
$(top_srcdir)/sntp/m4/define_dir.m4 \
$(top_srcdir)/sntp/m4/hms_search_lib.m4 \
$(top_srcdir)/sntp/m4/libtool.m4 \
@@ -55,6 +54,7 @@ am__aclocal_m4_deps = $(top_srcdir)/sntp/libopts/m4/libopts.m4 \
$(top_srcdir)/sntp/m4/ntp_cacheversion.m4 \
$(top_srcdir)/sntp/m4/ntp_compiler.m4 \
$(top_srcdir)/sntp/m4/ntp_crosscompile.m4 \
+ $(top_srcdir)/sntp/m4/ntp_crypto_rand.m4 \
$(top_srcdir)/sntp/m4/ntp_debug.m4 \
$(top_srcdir)/sntp/m4/ntp_dir_sep.m4 \
$(top_srcdir)/sntp/m4/ntp_facilitynames.m4 \
@@ -72,6 +72,8 @@ am__aclocal_m4_deps = $(top_srcdir)/sntp/libopts/m4/libopts.m4 \
$(top_srcdir)/sntp/m4/ntp_sntp.m4 \
$(top_srcdir)/sntp/m4/ntp_ver_suffix.m4 \
$(top_srcdir)/sntp/m4/ntp_vpathhack.m4 \
+ $(top_srcdir)/sntp/m4/openldap-thread-check.m4 \
+ $(top_srcdir)/sntp/m4/openldap.m4 \
$(top_srcdir)/sntp/m4/os_cflags.m4 \
$(top_srcdir)/sntp/m4/snprintf.m4 \
$(top_srcdir)/sntp/m4/version.m4 $(top_srcdir)/configure.ac
@@ -175,6 +177,7 @@ CHUTEST = @CHUTEST@
CONFIG_SHELL = @CONFIG_SHELL@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CPPFLAGS_LIBEVENT = @CPPFLAGS_LIBEVENT@
CPPFLAGS_NTP = @CPPFLAGS_NTP@
CXX = @CXX@
CXXCPP = @CXXCPP@
@@ -209,7 +212,9 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
+LDADD_LIBEVENT = @LDADD_LIBEVENT@
LDADD_LIBNTP = @LDADD_LIBNTP@
+LDADD_LIBUTIL = @LDADD_LIBUTIL@
LDADD_NLIST = @LDADD_NLIST@
LDADD_NTP = @LDADD_NTP@
LDFLAGS = @LDFLAGS@
@@ -348,6 +353,11 @@ TIMETRIM_DL = @TIMETRIM_DL@
TIMETRIM_DS = @TIMETRIM_DS@
TIMETRIM_MS = @TIMETRIM_MS@
TIMETRIM_NI = @TIMETRIM_NI@
+UPDATE_LEAP_DB = @UPDATE_LEAP_DB@
+UPDATE_LEAP_DL = @UPDATE_LEAP_DL@
+UPDATE_LEAP_DS = @UPDATE_LEAP_DS@
+UPDATE_LEAP_MS = @UPDATE_LEAP_MS@
+UPDATE_LEAP_NI = @UPDATE_LEAP_NI@
VERSION = @VERSION@
VER_SUFFIX = @VER_SUFFIX@
YACC = @YACC@
@@ -407,16 +417,27 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
NULL =
-BUILT_SOURCES = check-libntp .deps-ver
+BUILT_SOURCES = $(VPHACK) info_trimble.c $(VPHACK_AFTER) check-libntp \
+ .deps-ver
CLEANFILES = check-libntp .deps-ver
noinst_LIBRARIES = @MAKE_LIBPARSE@ @MAKE_LIBPARSE_KERNEL@
EXTRA_LIBRARIES = libparse.a libparse_kernel.a
noinst_PROGRAMS = @MAKE_PARSEKMODULE@
K_CFLAGS = -DPARSESTREAM -DNTP_NEED_BOPS
+@VPATH_HACK_FALSE@VPHACK =
# info_trimble.c was mistakenly created in the build directory
# previously. It is located in $(srcdir) and any updates must
# end up there.
+
+#
+# VPHACK and VPHACK_AFTER are enabled on non-GNU makes (such as
+# BSD make) to work around build/dependency issues where we want
+# built source files to live in srcdir, as opposed to builddir.
+#
+@VPATH_HACK_TRUE@VPHACK = vphack
+@VPATH_HACK_FALSE@VPHACK_AFTER =
+@VPATH_HACK_TRUE@VPHACK_AFTER = vphack_after
libparse_a_SOURCES = parse.c \
parse_conf.c \
clk_meinberg.c \
@@ -793,11 +814,25 @@ uninstall-am:
tags uninstall uninstall-am
-$(srcdir)/info_trimble.c: $(top_srcdir)/include/trimble.h $(srcdir)/Makefile.am $(srcdir)/mkinfo_scmd.sed $(srcdir)/mkinfo_rcmd.sed
+vphack:
+ test -e info_trimble.c || ln -s $(srcdir)/info_trimble.c .
+
+vphack_after:
+ test -L info_trimble.c || ( \
+ mv info_trimble.c $(srcdir)/info_trimble.c && \
+ ln -s $(srcdir)/info_trimble.c . \
+ )
+
+info_trimble.c: $(top_srcdir)/include/trimble.h $(srcdir)/Makefile.am $(srcdir)/mkinfo_scmd.sed $(srcdir)/mkinfo_rcmd.sed
sed -n -f $(srcdir)/mkinfo_scmd.sed $(top_srcdir)/include/trimble.h > info_trimble.new
sed -n -f $(srcdir)/mkinfo_rcmd.sed $(top_srcdir)/include/trimble.h >> info_trimble.new
mv -f info_trimble.new $@
+#$(srcdir)/info_trimble.c: $(top_srcdir)/include/trimble.h $(srcdir)/Makefile.am $(srcdir)/mkinfo_scmd.sed $(srcdir)/mkinfo_rcmd.sed
+# sed -n -f $(srcdir)/mkinfo_scmd.sed $(top_srcdir)/include/trimble.h > info_trimble.new
+# sed -n -f $(srcdir)/mkinfo_rcmd.sed $(top_srcdir)/include/trimble.h >> info_trimble.new
+# mv -f info_trimble.new $@
+
kieee754io.o: $(srcdir)/ieee754io.c
$(COMPILE) $(K_CFLAGS) -c $(srcdir)/ieee754io.c -o $@
diff --git a/libparse/clk_computime.c b/libparse/clk_computime.c
index 1068576..5026232 100644
--- a/libparse/clk_computime.c
+++ b/libparse/clk_computime.c
@@ -7,15 +7,15 @@
* /src/NTP/ntp4-dev/libparse/clk_computime.c,v 4.10 2005/04/16 17:32:10 kardel RELEASE_20050508_A
*
* clk_computime.c,v 4.10 2005/04/16 17:32:10 kardel RELEASE_20050508_A
- *
+ *
* Supports Diem's Computime Radio Clock
- *
+ *
* Used the Meinberg clock as a template for Diem's Computime Radio Clock
*
* adapted by Alois Camenzind <alois.camenzind@ubs.ch>
- *
+ *
* 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
+ * Copyright (c) 1989-1994 by Frank Kardel, Friedrich-Alexander Universitaet Erlangen-Nuernberg, Germany
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -59,22 +59,22 @@ extern int printf (const char *, ...);
/*
* The Computime receiver sends a datagram in the following format every minute
- *
- * Timestamp T:YY:MM:MD:WD:HH:MM:SSCRLF
+ *
+ * Timestamp T:YY:MM:MD:WD:HH:MM:SSCRLF
* Pos 0123456789012345678901 2 3
* 0000000000111111111122 2 2
* Parse T: : : : : : : rn
- *
- * T Startcharacter "T" specifies start of the timestamp
- * YY Year MM Month 1-12
- * MD Day of the month
- * WD Day of week
- * HH Hour
- * MM Minute
+ *
+ * T Startcharacter "T" specifies start of the timestamp
+ * YY Year MM Month 1-12
+ * MD Day of the month
+ * WD Day of week
+ * HH Hour
+ * MM Minute
* SS Second
- * CR Carriage return
+ * CR Carriage return
* LF Linefeed
- *
+ *
*/
static struct format computime_fmt =
@@ -88,10 +88,10 @@ static struct format computime_fmt =
0
};
-static u_long cvt_computime (unsigned char *, int, struct format *, clocktime_t *, void *);
-static unsigned long inp_computime (parse_t *, unsigned int, timestamp_t *);
+static parse_cvt_fnc_t cvt_computime;
+static parse_inp_fnc_t inp_computime;
-clockformat_t clock_computime =
+clockformat_t clock_computime =
{
inp_computime, /* Computime input handling */
cvt_computime, /* Computime conversion */
@@ -99,15 +99,15 @@ clockformat_t clock_computime =
(void *)&computime_fmt, /* conversion configuration */
"Diem's Computime Radio Clock", /* Computime Radio Clock */
24, /* string buffer */
- 0 /* no private data (complete pakets) */
+ 0 /* no private data (complete packets) */
};
/*
- * cvt_computime
- *
+ * parse_cvt_fnc_t cvt_computime
+ *
* convert simple type format
*/
-static u_long
+static u_long
cvt_computime(
unsigned char *buffer,
int size,
@@ -117,7 +117,7 @@ cvt_computime(
)
{
- if (!Strok(buffer, format->fixed_string)) {
+ if (!Strok(buffer, format->fixed_string)) {
return CVT_NONE;
} else {
if (Stoi(&buffer[format->field_offsets[O_DAY].offset], &clock_time->day,
@@ -131,7 +131,7 @@ cvt_computime(
Stoi(&buffer[format->field_offsets[O_MIN].offset], &clock_time->minute,
format->field_offsets[O_MIN].length) ||
Stoi(&buffer[format->field_offsets[O_SEC].offset], &clock_time->second,
- format->field_offsets[O_SEC].length)) {
+ format->field_offsets[O_SEC].length)) {
return CVT_FAIL | CVT_BADFMT;
} else {
@@ -144,31 +144,31 @@ cvt_computime(
}
/*
- * inp_computime
+ * parse_inp_fnc_t inp_computime
*
- * grep data from input stream
+ * grab data from input stream
*/
static u_long
inp_computime(
parse_t *parseio,
- unsigned int ch,
+ char ch,
timestamp_t *tstamp
)
{
unsigned int rtc;
-
+
parseprintf(DD_PARSE, ("inp_computime(0x%lx, 0x%x, ...)\n", (long)parseio, ch));
-
+
switch (ch)
{
case 'T':
parseprintf(DD_PARSE, ("inp_computime: START seen\n"));
-
+
parseio->parse_index = 1;
parseio->parse_data[0] = ch;
parseio->parse_dtime.parse_stime = *tstamp; /* collect timestamp */
return PARSE_INP_SKIP;
-
+
case '\n':
parseprintf(DD_PARSE, ("inp_computime: END seen\n"));
if ((rtc = parse_addchar(parseio, ch)) == PARSE_INP_SKIP)
diff --git a/libparse/clk_dcf7000.c b/libparse/clk_dcf7000.c
index bfd9a74..f1da9ef 100644
--- a/libparse/clk_dcf7000.c
+++ b/libparse/clk_dcf7000.c
@@ -1,12 +1,12 @@
/*
* /src/NTP/ntp4-dev/libparse/clk_dcf7000.c,v 4.10 2005/04/16 17:32:10 kardel RELEASE_20050508_A
- *
+ *
* clk_dcf7000.c,v 4.10 2005/04/16 17:32:10 kardel RELEASE_20050508_A
*
* ELV DCF7000 module
*
* 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
+ * Copyright (c) 1989-1994 by Frank Kardel, Friedrich-Alexander Universitaet Erlangen-Nuernberg, Germany
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -63,9 +63,10 @@ static struct format dcf7000_fmt =
},
(const unsigned char *)" - - - - - - - \r",
0
-};
-static u_long cvt_dcf7000 (unsigned char *, int, struct format *, clocktime_t *, void *);
-static unsigned long inp_dcf7000 (parse_t *, unsigned int, timestamp_t *);
+};
+
+static parse_cvt_fnc_t cvt_dcf7000;
+static parse_inp_fnc_t inp_dcf7000;
clockformat_t clock_dcf7000 =
{
@@ -75,11 +76,11 @@ clockformat_t clock_dcf7000 =
(void *)&dcf7000_fmt, /* conversion configuration */
"ELV DCF7000", /* ELV clock */
24, /* string buffer */
- 0 /* no private data (complete pakets) */
+ 0 /* no private data (complete packets) */
};
/*
- * cvt_dcf7000
+ * parse_cvt_fnc_t cvt_dcf7000
*
* convert dcf7000 type format
*/
@@ -117,7 +118,7 @@ cvt_dcf7000(
{
unsigned char *f = &buffer[format->field_offsets[O_FLAGS].offset];
long flags;
-
+
clock_time->flags = 0;
clock_time->usecond = 0;
@@ -144,21 +145,21 @@ cvt_dcf7000(
}
/*
- * inp_dcf700
+ * parse_inp_fnc_t inp_dcf700
*
- * grep data from input stream
+ * grab data from input stream
*/
static u_long
inp_dcf7000(
parse_t *parseio,
- unsigned int ch,
+ char ch,
timestamp_t *tstamp
)
{
unsigned int rtc;
-
+
parseprintf(DD_PARSE, ("inp_dcf7000(0x%lx, 0x%x, ...)\n", (long)parseio, ch));
-
+
switch (ch)
{
case '\r':
diff --git a/libparse/clk_hopf6021.c b/libparse/clk_hopf6021.c
index 033d2d2..357ac2e 100644
--- a/libparse/clk_hopf6021.c
+++ b/libparse/clk_hopf6021.c
@@ -37,10 +37,10 @@
extern int printf (const char *, ...);
#endif
-/*
- * hopf Funkuhr 6021
+/*
+ * hopf Funkuhr 6021
* used with 9600,8N1,
- * UTC ueber serielle Schnittstelle
+ * UTC ueber serielle Schnittstelle
* Sekundenvorlauf ON
* ETX zum Sekundenvorlauf ON
* Datenstring 6021
@@ -71,7 +71,7 @@ extern int printf (const char *, ...);
* x x 0 x - Wintertime
* x x 1 x - Summertime
* 0 0 x x - Time/Date invalid
- * 0 1 x x - Internal clock used
+ * 0 1 x x - Internal clock used
* 1 0 x x - Radio clock
* 1 1 x x - Radio clock highprecision
*
@@ -90,10 +90,10 @@ extern int printf (const char *, ...);
#define HOPF_DSTWARN 0x01 /* DST switch warning */
#define HOPF_DST 0x02 /* DST in effect */
-#define HOPF_MODE 0x0C /* operation mode mask */
+#define HOPF_MODE 0x0C /* operation mode mask */
#define HOPF_INVALID 0x00 /* no time code available */
#define HOPF_INTERNAL 0x04 /* internal clock */
-#define HOPF_RADIO 0x08 /* radio clock */
+#define HOPF_RADIO 0x08 /* radio clock */
#define HOPF_RADIOHP 0x0C /* high precision radio clock */
#define HOPF_UTC 0x08 /* time code in UTC */
@@ -102,13 +102,13 @@ extern int printf (const char *, ...);
static struct format hopf6021_fmt =
{
{
- { 9, 2 }, {11, 2}, { 13, 2}, /* Day, Month, Year */
- { 3, 2 }, { 5, 2}, { 7, 2}, /* Hour, Minute, Second */
+ { 9, 2 }, {11, 2}, { 13, 2}, /* Day, Month, Year */
+ { 3, 2 }, { 5, 2}, { 7, 2}, /* Hour, Minute, Second */
{ 2, 1 }, { 1, 1}, { 0, 0}, /* Weekday, Flags, Zone */
/* ... */
},
(const unsigned char *)"\002 \n\r\003",
- 0
+ 0
};
#define OFFS(x) format->field_offsets[(x)].offset
@@ -118,8 +118,8 @@ static struct format hopf6021_fmt =
('A' <= (x) && (x) <= 'F') ? (x) - 'A' + 10 : \
-1)
-static unsigned long cvt_hopf6021 (unsigned char *, int, struct format *, clocktime_t *, void *);
-static unsigned long inp_hopf6021 (parse_t *, unsigned int, timestamp_t *);
+static parse_cvt_fnc_t cvt_hopf6021;
+static parse_inp_fnc_t inp_hopf6021;
clockformat_t clock_hopf6021 =
{
@@ -132,7 +132,8 @@ clockformat_t clock_hopf6021 =
0 /* private data length, no private data */
};
-static unsigned long
+/* parse_cvt_fnc_t cvt_hopf6021 */
+static u_long
cvt_hopf6021(
unsigned char *buffer,
int size,
@@ -162,8 +163,8 @@ cvt_hopf6021(
clock_time->usecond = 0;
clock_time->utcoffset = 0;
- status = hexval(buffer[OFFS(O_FLAGS)]);
- weekday= hexval(buffer[OFFS(O_WDAY)]);
+ status = (u_char) hexval(buffer[OFFS(O_FLAGS)]);
+ weekday= (u_char) hexval(buffer[OFFS(O_WDAY)]);
if ((status == 0xFF) || (weekday == 0xFF))
{
@@ -213,21 +214,21 @@ cvt_hopf6021(
}
/*
- * inp_hopf6021
+ * parse_inp_fnc_t inp_hopf6021
*
- * grep data from input stream
+ * grab data from input stream
*/
static u_long
inp_hopf6021(
parse_t *parseio,
- unsigned int ch,
+ char ch,
timestamp_t *tstamp
)
{
unsigned int rtc;
-
+
parseprintf(DD_PARSE, ("inp_hopf6021(0x%lx, 0x%x, ...)\n", (long)parseio, ch));
-
+
switch (ch)
{
case ETX:
diff --git a/libparse/clk_meinberg.c b/libparse/clk_meinberg.c
index bc0ac0e..4047be5 100644
--- a/libparse/clk_meinberg.c
+++ b/libparse/clk_meinberg.c
@@ -1,12 +1,12 @@
/*
* /src/NTP/REPOSITORY/ntp4-dev/libparse/clk_meinberg.c,v 4.12.2.1 2005/09/25 10:22:35 kardel RELEASE_20050925_A
- *
+ *
* clk_meinberg.c,v 4.12.2.1 2005/09/25 10:22:35 kardel RELEASE_20050925_A
*
* Meinberg clock support
*
* 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
+ * Copyright (c) 1989-1994 by Frank Kardel, Friedrich-Alexander Universitaet Erlangen-Nuernberg, Germany
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -65,7 +65,7 @@
/*
* The Meinberg receiver every second sends a datagram of the following form
* (Standard Format)
- *
+ *
* <STX>D:<dd>.<mm>.<yy>;T:<w>;U:<hh>:<mm>:<ss>;<S><F><D><A><ETX>
* pos: 0 00 00 0 00 0 11 111 1 111 12 2 22 2 22 2 2 2 3 3 3
* 1 23 45 6 78 9 01 234 5 678 90 1 23 4 56 7 8 9 0 1 2
@@ -105,12 +105,14 @@
* <A> = '!' during the hour preceeding an daylight saving time
* start/end change
* <L> = 'A' LEAP second announcement
- * <R> = 'R' alternate antenna
+ * <R> = 'R' "call bit" used to signalize irregularities in the control facilities,
+ * usually ' ', until 2003 indicated transmission via alternate antenna
*
- * Meinberg GPS166 receiver
+ * Meinberg GPS receivers
*
- * You must get the Uni-Erlangen firmware for the GPS receiver support
+ * For very old devices you must get the Uni-Erlangen firmware for the GPS receiver support
* to work to full satisfaction !
+ * With newer GPS receiver types the Uni Erlangen string format can be configured at the device.
*
* <STX><dd>.<mm>.<yy>; <w>; <hh>:<mm>:<ss>; <+/-><00:00>; <U><S><F><D><A><L><R><L>; <position...><ETX>
*
@@ -118,7 +120,7 @@
* 123456789012345678901234567890123456789012345678901234567890123456
* \x0209.07.93; 5; 08:48:26; +00:00; #*S!A L; 49.5736N 11.0280E 373m\x03
*
- *
+ *
* <STX> = '\002' ASCII start of text
* <ETX> = '\003' ASCII end of text
* <dd>,<mm>,<yy> = day, month, year(2 digits!!)
@@ -131,8 +133,10 @@
* <A> = '!' during the hour preceeding an daylight saving time
* start/end change
* <L> = 'A' LEAP second announcement
- * <R> = 'R' alternate antenna (reminiscent of PZF535) usually ' '
- * <L> = 'L' on 23:59:60
+ * <R> = 'R' "call bit" used to signalize irregularities in the control facilities,
+ * usually ' ', until 2003 indicated transmission via alternate antenna
+ * (reminiscent of PZF receivers)
+ * <L> = 'L' on 23:59:60
*
* Binary messages have a lead in for a fixed header of SOH
*/
@@ -150,19 +154,20 @@
/* Ret val: the checksum */
/*+-------------------------------------------------------------*/
-unsigned long
+CSUM
mbg_csum(
unsigned char *p,
unsigned int n
)
{
- unsigned long sum = 0;
- short i;
-
+ unsigned int sum = 0;
+ unsigned int i;
+
for ( i = 0; i < n; i++ )
sum += *p++;
-
- return( sum );
+
+ return (CSUM) sum;
+
} /* csum */
void
@@ -171,10 +176,10 @@ get_mbg_header(
GPS_MSG_HDR *headerp
)
{
- headerp->gps_cmd = get_lsb_short(bufpp);
- headerp->gps_len = get_lsb_short(bufpp);
- headerp->gps_data_csum = get_lsb_short(bufpp);
- headerp->gps_hdr_csum = get_lsb_short(bufpp);
+ headerp->cmd = (GPS_CMD) get_lsb_short(bufpp);
+ headerp->len = get_lsb_uint16(bufpp);
+ headerp->data_csum = (CSUM) get_lsb_short(bufpp);
+ headerp->hdr_csum = (CSUM) get_lsb_short(bufpp);
}
static struct format meinberg_fmt[] =
@@ -209,10 +214,10 @@ static struct format meinberg_fmt[] =
}
};
-static u_long cvt_meinberg (unsigned char *, int, struct format *, clocktime_t *, void *);
-static u_long cvt_mgps (unsigned char *, int, struct format *, clocktime_t *, void *);
-static u_long mbg_input (parse_t *, unsigned int, timestamp_t *);
-static u_long gps_input (parse_t *, unsigned int, timestamp_t *);
+static parse_cvt_fnc_t cvt_meinberg;
+static parse_cvt_fnc_t cvt_mgps;
+static parse_inp_fnc_t mbg_input;
+static parse_inp_fnc_t gps_input;
struct msg_buf
{
@@ -224,7 +229,7 @@ struct msg_buf
#define MBG_HEADER 1 /* receiving header */
#define MBG_DATA 2 /* receiving data */
#define MBG_STRING 3 /* receiving standard data message */
-
+
clockformat_t clock_meinberg[] =
{
{
@@ -234,7 +239,7 @@ clockformat_t clock_meinberg[] =
0, /* conversion configuration */
"Meinberg Standard", /* Meinberg simple format - beware */
32, /* string buffer */
- 0 /* no private data (complete pakets) */
+ 0 /* no private data (complete packets) */
},
{
mbg_input, /* normal input handling */
@@ -243,21 +248,21 @@ clockformat_t clock_meinberg[] =
0, /* conversion configuration */
"Meinberg Extended", /* Meinberg enhanced format */
32, /* string buffer */
- 0 /* no private data (complete pakets) */
+ 0 /* no private data (complete packets) */
},
{
gps_input, /* no input handling */
- cvt_mgps, /* Meinberg GPS166 conversion */
+ cvt_mgps, /* Meinberg GPS receiver conversion */
pps_one, /* easy PPS monitoring */
(void *)&meinberg_fmt[2], /* conversion configuration */
- "Meinberg GPS Extended", /* Meinberg FAU GPS format */
+ "Meinberg GPS Extended", /* Meinberg FAU GPS format */
512, /* string buffer */
- sizeof(struct msg_buf) /* no private data (complete pakets) */
+ sizeof(struct msg_buf) /* no private data (complete packets) */
}
};
/*
- * cvt_meinberg
+ * parse_cvt_fnc_t cvt_meinberg
*
* convert simple type format
*/
@@ -271,7 +276,7 @@ cvt_meinberg(
)
{
struct format *format;
-
+
/*
* select automagically correct data format
*/
@@ -312,7 +317,7 @@ cvt_meinberg(
else
{
unsigned char *f = &buffer[format->field_offsets[O_FLAGS].offset];
-
+
clock_time->usecond = 0;
clock_time->flags = PARSEB_S_LEAP;
@@ -348,7 +353,7 @@ cvt_meinberg(
case ' ':
clock_time->utcoffset = -1*60*60; /* MET */
break;
-
+
case 'S':
clock_time->utcoffset = -2*60*60; /* MED */
break;
@@ -360,27 +365,27 @@ cvt_meinberg(
clock_time->utcoffset = 0; /* UTC */
clock_time->flags |= PARSEB_UTC;
break;
-
+
default:
return CVT_FAIL|CVT_BADFMT;
}
}
-
+
/*
* gather status flags
*/
if (buffer[format->field_offsets[O_ZONE].offset] == 'S')
clock_time->flags |= PARSEB_DST;
-
+
if (f[0] == '#')
clock_time->flags |= PARSEB_POWERUP;
-
+
if (f[1] == '*')
clock_time->flags |= PARSEB_NOSYNC;
-
+
if (f[3] == '!')
clock_time->flags |= PARSEB_ANNOUNCE;
-
+
/*
* oncoming leap second
* 'a' code not confirmed - earth is not
@@ -388,27 +393,27 @@ cvt_meinberg(
*/
if (f[3] == 'A')
clock_time->flags |= PARSEB_LEAPADD;
-
+
if (f[3] == 'a')
clock_time->flags |= PARSEB_LEAPDEL;
-
-
+
+
if (format->flags & MBG_EXTENDED)
{
clock_time->flags |= PARSEB_S_ANTENNA;
-
+
/*
* DCF77 does not encode the direction -
* so we take the current default -
* earth slowing down
*/
clock_time->flags &= ~PARSEB_LEAPDEL;
-
+
if (f[4] == 'A')
clock_time->flags |= PARSEB_LEAPADD;
-
+
if (f[5] == 'R')
- clock_time->flags |= PARSEB_ALTERNATE;
+ clock_time->flags |= PARSEB_CALLBIT;
}
return CVT_OK;
}
@@ -416,31 +421,31 @@ cvt_meinberg(
/*
- * mbg_input
+ * parse_inp_fnc_t mbg_input
*
- * grep data from input stream
+ * grab data from input stream
*/
static u_long
mbg_input(
parse_t *parseio,
- unsigned int ch,
+ char ch,
timestamp_t *tstamp
)
{
unsigned int rtc;
-
+
parseprintf(DD_PARSE, ("mbg_input(0x%lx, 0x%x, ...)\n", (long)parseio, ch));
-
+
switch (ch)
{
case STX:
parseprintf(DD_PARSE, ("mbg_input: STX seen\n"));
-
+
parseio->parse_index = 1;
parseio->parse_data[0] = ch;
parseio->parse_dtime.parse_stime = *tstamp; /* collect timestamp */
return PARSE_INP_SKIP;
-
+
case ETX:
parseprintf(DD_PARSE, ("mbg_input: ETX seen\n"));
if ((rtc = parse_addchar(parseio, ch)) == PARSE_INP_SKIP)
@@ -455,7 +460,7 @@ mbg_input(
/*
- * cvt_mgps
+ * parse_cvt_fnc_t cvt_mgps
*
* convert Meinberg GPS format
*/
@@ -493,9 +498,9 @@ cvt_mgps(
{
long h;
unsigned char *f = &buffer[format->field_offsets[O_FLAGS].offset];
-
+
clock_time->flags = PARSEB_S_LEAP|PARSEB_S_POSITION;
-
+
clock_time->usecond = 0;
/*
@@ -522,22 +527,22 @@ cvt_mgps(
clock_time->utcoffset = -clock_time->utcoffset;
}
}
-
+
/*
* gather status flags
*/
if (buffer[format->field_offsets[O_ZONE].offset] == 'S')
clock_time->flags |= PARSEB_DST;
-
+
if (clock_time->utcoffset == 0)
clock_time->flags |= PARSEB_UTC;
-
+
/*
* no sv's seen - no time & position
*/
if (f[0] == '#')
clock_time->flags |= PARSEB_POWERUP;
-
+
/*
* at least one sv seen - time (for last position)
*/
@@ -546,13 +551,13 @@ cvt_mgps(
else
if (!(clock_time->flags & PARSEB_POWERUP))
clock_time->flags |= PARSEB_POSITION;
-
+
/*
* oncoming zone switch
*/
if (f[3] == '!')
clock_time->flags |= PARSEB_ANNOUNCE;
-
+
/*
* oncoming leap second
* 'a' code not confirmed - earth is not
@@ -560,14 +565,14 @@ cvt_mgps(
*/
if (f[4] == 'A')
clock_time->flags |= PARSEB_LEAPADD;
-
+
if (f[4] == 'a')
clock_time->flags |= PARSEB_LEAPDEL;
/*
* f[5] == ' '
*/
-
+
/*
* this is the leap second
*/
@@ -580,35 +585,35 @@ cvt_mgps(
}
/*
- * gps_input
+ * parse_inp_fnc_t gps_input
*
* grep binary data from input stream
*/
static u_long
gps_input(
parse_t *parseio,
- unsigned int ch,
+ char ch,
timestamp_t *tstamp
)
{
CSUM calc_csum; /* used to compare the incoming csums */
GPS_MSG_HDR header;
struct msg_buf *msg_buf;
-
+
msg_buf = (struct msg_buf *)parseio->parse_pdata;
parseprintf(DD_PARSE, ("gps_input(0x%lx, 0x%x, ...)\n", (long)parseio, ch));
if (!msg_buf)
return PARSE_INP_SKIP;
-
+
if ( msg_buf->phase == MBG_NONE )
{ /* not receiving yet */
switch (ch)
{
case SOH:
parseprintf(DD_PARSE, ("gps_input: SOH seen\n"));
-
+
msg_buf->len = sizeof( header ); /* prepare to receive msg header */
msg_buf->phase = MBG_HEADER; /* receiving header */
break;
@@ -621,7 +626,7 @@ gps_input(
parseio->parse_index = 1;
parseio->parse_data[0] = ch;
break;
-
+
default:
return PARSE_INP_SKIP; /* keep searching */
}
@@ -638,7 +643,7 @@ gps_input(
if ((msg_buf->phase == MBG_STRING) &&
(parseio->parse_index < parseio->parse_dsize))
parseio->parse_data[parseio->parse_index++] = ch;
-
+
parseio->parse_dtime.parse_msg[parseio->parse_dtime.parse_msglen++] = ch;
if (parseio->parse_dtime.parse_msglen > sizeof(parseio->parse_dtime.parse_msg))
@@ -649,7 +654,7 @@ gps_input(
parseio->parse_ldsize = parseio->parse_index;
return PARSE_INP_DATA;
}
-
+
switch (msg_buf->phase)
{
case MBG_HEADER:
@@ -685,41 +690,41 @@ gps_input(
if ( msg_buf->phase == MBG_HEADER )
{ /* header complete now */
unsigned char *datap = parseio->parse_dtime.parse_msg + 1;
-
+
get_mbg_header(&datap, &header);
-
+
parseprintf(DD_PARSE, ("gps_input: header: cmd 0x%x, len %d, dcsum 0x%x, hcsum 0x%x\n",
- (int)header.gps_cmd, (int)header.gps_len, (int)header.gps_data_csum,
- (int)header.gps_hdr_csum));
-
+ (int)header.cmd, (int)header.len, (int)header.data_csum,
+ (int)header.hdr_csum));
+
calc_csum = mbg_csum( (unsigned char *) parseio->parse_dtime.parse_msg + 1, (unsigned short)6 );
- if ( calc_csum != header.gps_hdr_csum )
+ if ( calc_csum != header.hdr_csum )
{
parseprintf(DD_PARSE, ("gps_input: header checksum mismatch expected 0x%x, got 0x%x\n",
(int)calc_csum, (int)mbg_csum( (unsigned char *) parseio->parse_dtime.parse_msg, (unsigned short)6 )));
-
+
msg_buf->phase = MBG_NONE; /* back to hunting mode */
return PARSE_INP_DATA; /* invalid header checksum received - pass up for detection */
}
- if ((header.gps_len == 0) || /* no data to wait for */
- (header.gps_len >= (sizeof (parseio->parse_dtime.parse_msg) - sizeof(header) - 1))) /* blows anything we have space for */
+ if ((header.len == 0) || /* no data to wait for */
+ (header.len >= (sizeof (parseio->parse_dtime.parse_msg) - sizeof(header) - 1))) /* blows anything we have space for */
{
msg_buf->phase = MBG_NONE; /* back to hunting mode */
- return (header.gps_len == 0) ? PARSE_INP_DATA : PARSE_INP_SKIP; /* message complete/throwaway */
+ return (header.len == 0) ? PARSE_INP_DATA : PARSE_INP_SKIP; /* message complete/throwaway */
}
-
- parseprintf(DD_PARSE, ("gps_input: expecting %d bytes of data message\n", (int)header.gps_len));
-
- msg_buf->len = header.gps_len;/* save number of bytes to wait for */
+
+ parseprintf(DD_PARSE, ("gps_input: expecting %d bytes of data message\n", (int)header.len));
+
+ msg_buf->len = header.len;/* save number of bytes to wait for */
msg_buf->phase = MBG_DATA; /* flag header already complete */
return PARSE_INP_SKIP;
}
parseprintf(DD_PARSE, ("gps_input: message data complete\n"));
-
+
/* Header and data have been received. The header checksum has been */
/* checked */
diff --git a/libparse/clk_rawdcf.c b/libparse/clk_rawdcf.c
index 98848be..132fbc3 100644
--- a/libparse/clk_rawdcf.c
+++ b/libparse/clk_rawdcf.c
@@ -1,12 +1,12 @@
/*
* /src/NTP/REPOSITORY/ntp4-dev/libparse/clk_rawdcf.c,v 4.18 2006/06/22 18:40:01 kardel RELEASE_20060622_A
- *
+ *
* clk_rawdcf.c,v 4.18 2006/06/22 18:40:01 kardel RELEASE_20060622_A
*
* Raw DCF77 pulse clock support
*
* Copyright (c) 1995-2006 by Frank Kardel <kardel <AT> ntp.org>
- * Copyright (c) 1989-1994 by Frank Kardel, Friedrich-Alexander Universität Erlangen-Nürnberg, Germany
+ * Copyright (c) 1989-1994 by Frank Kardel, Friedrich-Alexander Universitaet Erlangen-Nuernberg, Germany
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -75,7 +75,8 @@
* Second Contents
* 0 - 10 AM: free, FM: 0
* 11 - 14 free
- * 15 R - alternate antenna
+ * 15 R - "call bit" used to signalize irregularities in the control facilities
+ * (until 2003 indicated transmission via alternate antenna)
* 16 A1 - expect zone change (1 hour before)
* 17 - 18 Z1,Z2 - time zone
* 0 0 illegal
@@ -101,9 +102,9 @@
* 59 - usually missing (minute indication), except for leap insertion
*/
-static u_long pps_rawdcf (parse_t *, int, timestamp_t *);
-static u_long cvt_rawdcf (unsigned char *, int, struct format *, clocktime_t *, void *);
-static u_long inp_rawdcf (parse_t *, unsigned int, timestamp_t *);
+static parse_pps_fnc_t pps_rawdcf;
+static parse_cvt_fnc_t cvt_rawdcf;
+static parse_inp_fnc_t inp_rawdcf;
typedef struct last_tcode {
time_t tcode; /* last converted time code */
@@ -125,15 +126,15 @@ clockformat_t clock_rawdcf =
static struct dcfparam
{
- unsigned char *onebits;
- unsigned char *zerobits;
-} dcfparameter =
+ const unsigned char *onebits;
+ const unsigned char *zerobits;
+} dcfparameter =
{
- (unsigned char *)"###############RADMLS1248124P124812P1248121241248112481248P??", /* 'ONE' representation */
- (unsigned char *)"--------------------s-------p------p----------------------p__" /* 'ZERO' representation */
+ (const unsigned char *)"###############RADMLS1248124P124812P1248121241248112481248P??", /* 'ONE' representation */
+ (const unsigned char *)"--------------------s-------p------p----------------------p__" /* 'ZERO' representation */
};
-static struct rawdcfcode
+static struct rawdcfcode
{
char offset; /* start bit */
} rawdcfcode[] =
@@ -182,14 +183,14 @@ static u_long
ext_bf(
unsigned char *buf,
int idx,
- unsigned char *zero
+ const unsigned char *zero
)
{
u_long sum = 0;
int i, first;
first = rawdcfcode[idx].offset;
-
+
for (i = rawdcfcode[idx+1].offset - 1; i >= first; i--)
{
sum <<= 1;
@@ -202,7 +203,7 @@ static unsigned
pcheck(
unsigned char *buf,
int idx,
- unsigned char *zero
+ const unsigned char *zero
)
{
int i,last;
@@ -225,8 +226,8 @@ convert_rawdcf(
)
{
unsigned char *s = buffer;
- unsigned char *b = dcfprm->onebits;
- unsigned char *c = dcfprm->zerobits;
+ const unsigned char *b = dcfprm->onebits;
+ const unsigned char *c = dcfprm->zerobits;
int i;
parseprintf(DD_RAWDCF,("parse: convert_rawdcf: \"%s\"\n", buffer));
@@ -238,7 +239,7 @@ convert_rawdcf(
#endif
return CVT_NONE;
}
-
+
for (i = 0; i < size; i++)
{
if ((*s != *b) && (*s != *c))
@@ -307,7 +308,7 @@ convert_rawdcf(
clock_time->flags |= PARSEB_LEAPADD; /* default: DCF77 data format deficiency */
if (ext_bf(buffer, DCF_R, dcfprm->zerobits))
- clock_time->flags |= PARSEB_ALTERNATE;
+ clock_time->flags |= PARSEB_CALLBIT;
parseprintf(DD_RAWDCF,("parse: convert_rawdcf: TIME CODE OK: %d:%d, %d.%d.%d, flags 0x%lx\n",
(int)clock_time->hour, (int)clock_time->minute, (int)clock_time->day, (int)clock_time->month,(int) clock_time->year,
@@ -327,6 +328,7 @@ convert_rawdcf(
}
/*
+ * parse_cvt_fnc_t cvt_rawdcf
* raw dcf input routine - needs to fix up 50 baud
* characters for 1/0 decision
*/
@@ -342,8 +344,8 @@ cvt_rawdcf(
last_tcode_t *t = (last_tcode_t *)local;
unsigned char *s = (unsigned char *)buffer;
unsigned char *e = s + size;
- unsigned char *b = dcfparameter.onebits;
- unsigned char *c = dcfparameter.zerobits;
+ const unsigned char *b = dcfparameter.onebits;
+ const unsigned char *c = dcfparameter.zerobits;
u_long rtc = CVT_NONE;
unsigned int i, lowmax, highmax, cutoff, span;
#define BITS 9
@@ -379,7 +381,7 @@ cvt_rawdcf(
ch >>= 1;
}
- *s = i;
+ *s = (unsigned char) i;
histbuf[i]++;
cutoff += i;
lowmax++;
@@ -504,12 +506,12 @@ cvt_rawdcf(
}
}
}
-
+
return rtc;
}
/*
- * pps_rawdcf
+ * parse_pps_fnc_t pps_rawdcf
*
* currently a very stupid version - should be extended to decode
* also ones and zeros (which is easy)
@@ -546,30 +548,30 @@ snt_rawdcf(
#else
parseio->parse_dtime.parse_time.fp.l_ui++;
#endif
-
+
parseprintf(DD_RAWDCF,("parse: snt_rawdcf: time stamp synthesized offset %d seconds\n", parseio->parse_index - 1));
-
+
return updatetimeinfo(parseio, parseio->parse_lstate);
}
return CVT_NONE;
}
/*
- * inp_rawdcf
+ * parse_inp_fnc_t inp_rawdcf
*
* grab DCF77 data from input stream
*/
static u_long
inp_rawdcf(
parse_t *parseio,
- unsigned int ch,
+ char ch,
timestamp_t *tstamp
)
{
static struct timeval timeout = { 1, 500000 }; /* 1.5 secongs denote second #60 */
-
+
parseprintf(DD_PARSE, ("inp_rawdcf(0x%lx, 0x%x, ...)\n", (long)parseio, ch));
-
+
parseio->parse_dtime.parse_stime = *tstamp; /* collect timestamp */
if (parse_timedout(parseio, tstamp, &timeout))
@@ -583,7 +585,7 @@ inp_rawdcf(
else
{
unsigned int rtc;
-
+
rtc = parse_addchar(parseio, ch);
if (rtc == PARSE_INP_SKIP)
{
diff --git a/libparse/clk_rcc8000.c b/libparse/clk_rcc8000.c
index 6dca166..a690e58 100644
--- a/libparse/clk_rcc8000.c
+++ b/libparse/clk_rcc8000.c
@@ -1,6 +1,6 @@
/*
* /src/NTP/ntp4-dev/libparse/clk_rcc8000.c,v 4.9 2004/11/14 15:29:41 kardel RELEASE_20050508_A
- *
+ *
* clk_rcc8000.c,v 4.9 2004/11/14 15:29:41 kardel RELEASE_20050508_A
*
* Radiocode Clocks Ltd RCC 8000 Intelligent Off-Air Master Clock support
@@ -49,16 +49,16 @@ extern int printf (const char *, ...);
#define O_USEC O_WDAY
static struct format rcc8000_fmt =
-{ { { 13, 2 }, {16, 2}, { 19, 2}, /* Day, Month, Year */
- { 0, 2 }, { 3, 2}, { 6, 2}, /* Hour, Minute, Second */
+{ { { 13, 2 }, {16, 2}, { 19, 2}, /* Day, Month, Year */
+ { 0, 2 }, { 3, 2}, { 6, 2}, /* Hour, Minute, Second */
{ 9, 3 }, {28, 1}, { 0, 0}, /* uSec, Status (Valid,Reject,BST,Leapyear) */ },
- (const unsigned char *)" : : . / / \r\n",
+ (const unsigned char *)" : : . / / \r\n",
/*"15:50:36.534 30/09/94 273 5 A\x0d\x0a" */
- 0
+ 0
};
-static unsigned long cvt_rcc8000 (unsigned char *, int, struct format *, clocktime_t *, void *);
-static unsigned long inp_rcc8000 (parse_t *, unsigned int, timestamp_t *);
+static parse_cvt_fnc_t cvt_rcc8000;
+static parse_inp_fnc_t inp_rcc8000;
clockformat_t clock_rcc8000 =
{
@@ -71,7 +71,8 @@ clockformat_t clock_rcc8000 =
0 /* no private data */
};
-static unsigned long
+/* parse_cvt_fnc_t cvt_rcc8000 */
+static u_long
cvt_rcc8000(
unsigned char *buffer,
int size,
@@ -121,27 +122,27 @@ cvt_rcc8000(
clock_time->flags |= PARSEB_POWERUP;
clock_time->flags |= PARSEB_UTC; /* British special - guess why 8-) */
-
+
/* other flags not used */
}
return CVT_OK;
}
/*
- * inp_rcc8000
+ * parse_inp_fnc_t inp_rcc8000
*
- * grep data from input stream
+ * grab data from input stream
*/
static u_long
inp_rcc8000(
parse_t *parseio,
- unsigned int ch,
+ char ch,
timestamp_t *tstamp
)
{
unsigned int rtc;
-
+
parseprintf(DD_PARSE, ("inp_rcc8000(0x%lx, 0x%x, ...)\n", (long)parseio, ch));
-
+
switch (ch)
{
case '\n':
@@ -150,7 +151,7 @@ inp_rcc8000(
return parse_end(parseio);
else
return rtc;
-
+
default:
if (parseio->parse_index == 0) /* take sample at start of message */
diff --git a/libparse/clk_schmid.c b/libparse/clk_schmid.c
index 045f0fc..5e303b9 100644
--- a/libparse/clk_schmid.c
+++ b/libparse/clk_schmid.c
@@ -1,13 +1,13 @@
/*
* /src/NTP/ntp4-dev/libparse/clk_schmid.c,v 4.9 2005/04/16 17:32:10 kardel RELEASE_20050508_A
- *
+ *
* clk_schmid.c,v 4.9 2005/04/16 17:32:10 kardel RELEASE_20050508_A
*
* Schmid clock support
* based on information and testing from Adam W. Feigin et. al (Swisstime iis.ethz.ch)
*
* 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
+ * Copyright (c) 1989-1994 by Frank Kardel, Friedrich-Alexander Universitaet Erlangen-Nuernberg, Germany
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -61,7 +61,7 @@ extern int printf (const char *, ...);
* The command to Schmid's DCF77 clock is a single byte; each bit
* allows the user to select some part of the time string, as follows (the
* output for the lsb is sent first).
- *
+ *
* Bit 0: time in MEZ, 4 bytes *binary, not BCD*; hh.mm.ss.tenths
* Bit 1: date 3 bytes *binary, not BCD: dd.mm.yy
* Bit 2: week day, 1 byte (unused here)
@@ -82,15 +82,15 @@ extern int printf (const char *, ...);
#define WS_TIME 0x01
#define WS_SIGNAL 0x02
-#define WS_ALTERNATE 0x01
+#define WS_CALLBIT 0x01 /* "call bit" used to signalize irregularities in the control facilities */
#define WS_ANNOUNCE 0x02
#define WS_TZ 0x0c
#define WS_MET 0x08
#define WS_MEST 0x04
#define WS_LEAP 0x10
-static u_long cvt_schmid (unsigned char *, int, struct format *, clocktime_t *, void *);
-static unsigned long inp_schmid (parse_t *, unsigned int, timestamp_t *);
+static parse_cvt_fnc_t cvt_schmid;
+static parse_inp_fnc_t inp_schmid;
clockformat_t clock_schmid =
{
@@ -103,7 +103,7 @@ clockformat_t clock_schmid =
0, /* no private data (complete messages) */
};
-
+/* parse_cvt_fnc_t */
static u_long
cvt_schmid(
unsigned char *buffer,
@@ -155,7 +155,7 @@ cvt_schmid(
default:
return CVT_FAIL|CVT_BADFMT;
}
-
+
if (!(buffer[7] & WS_TIME))
{
clock_time->flags |= PARSEB_POWERUP;
@@ -168,9 +168,9 @@ cvt_schmid(
if (buffer[7] & WS_SIGNAL)
{
- if (buffer[8] & WS_ALTERNATE)
+ if (buffer[8] & WS_CALLBIT)
{
- clock_time->flags |= PARSEB_ALTERNATE;
+ clock_time->flags |= PARSEB_CALLBIT;
}
if (buffer[8] & WS_ANNOUNCE)
@@ -185,32 +185,32 @@ cvt_schmid(
}
clock_time->flags |= PARSEB_S_LEAP|PARSEB_S_ANTENNA;
-
+
return CVT_OK;
}
}
}
/*
- * inp_schmid
+ * parse_inp_fnc_t inp_schmid
*
- * grep data from input stream
+ * grab data from input stream
*/
static u_long
inp_schmid(
parse_t *parseio,
- unsigned int ch,
+ char ch,
timestamp_t *tstamp
)
{
unsigned int rtc;
-
+
parseprintf(DD_PARSE, ("inp_schmid(0x%lx, 0x%x, ...)\n", (long)parseio, ch));
-
- switch (ch)
+
+ switch ((uint8_t)ch)
{
case 0xFD: /* */
- parseprintf(DD_PARSE, ("mbg_input: ETX seen\n"));
+ parseprintf(DD_PARSE, ("inp_schmid: 0xFD seen\n"));
if ((rtc = parse_addchar(parseio, ch)) == PARSE_INP_SKIP)
return parse_end(parseio);
else
diff --git a/libparse/clk_sel240x.c b/libparse/clk_sel240x.c
index a09d347..b1390b4 100644
--- a/libparse/clk_sel240x.c
+++ b/libparse/clk_sel240x.c
@@ -3,7 +3,7 @@
// Schweitzer Engineering Laboratories, Inc. <opensource@selinc.com>
//////////////////////////////////////////////////////////////////////////////
-// Need to have _XOPEN_SOURCE defined for time.h to give the
+// Need to have _XOPEN_SOURCE defined for time.h to give the
// correct strptime signature. As per feature_test_macros(7),
// define this before including any header files.
@@ -51,14 +51,8 @@
// a '?'. But we are only going to call it synced when we receive a ' '
//////////////////////////////////////////////////////////////////////////////
-static unsigned long inp_sel240x( parse_t *parseio,
- unsigned int ch,
- timestamp_t *tstamp);
-static unsigned long cvt_sel240x( unsigned char *buffer,
- int size,
- struct format *format,
- clocktime_t *clock_time,
- void *local );
+static parse_inp_fnc_t inp_sel240x;
+static parse_cvt_fnc_t cvt_sel240x;
// Parse clock format structure describing the message above
static struct format sel240x_fmt =
@@ -94,7 +88,7 @@ clockformat_t clock_sel240x =
//////////////////////////////////////////////////////////////////////////////
static unsigned long
inp_sel240x( parse_t *parseio,
- unsigned int ch,
+ char ch,
timestamp_t *tstamp
)
{
@@ -139,7 +133,7 @@ cvt_sel240x( unsigned char *buffer,
{
struct tm ptime;
buffer++;
- buffer = (unsigned char *) strptime(
+ buffer = (unsigned char *) strptime(
(const char *)buffer, "%Y:%j:%H:%M:%S", &ptime );
if( *(buffer+1) != '\x0d' )
{
diff --git a/libparse/clk_trimtaip.c b/libparse/clk_trimtaip.c
index 322d0fa..426e897 100644
--- a/libparse/clk_trimtaip.c
+++ b/libparse/clk_trimtaip.c
@@ -6,7 +6,7 @@
* Trimble SV6 clock support - several collected codepieces
*
* 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
+ * Copyright (c) 1989-1994 by Frank Kardel, Friedrich-Alexander Universitaet Erlangen-Nuernberg, Germany
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -78,8 +78,8 @@ extern int printf (const char *, ...);
0
};
-static unsigned long cvt_trimtaip (unsigned char *, int, struct format *, clocktime_t *, void *);
-static unsigned long inp_trimtaip (parse_t *, unsigned int, timestamp_t *);
+static parse_cvt_fnc_t cvt_trimtaip;
+static parse_inp_fnc_t inp_trimtaip;
clockformat_t clock_trimtaip =
{
@@ -92,7 +92,8 @@ clockformat_t clock_trimtaip =
0 /* no private data */
};
-static unsigned long
+/* parse_cvt_fnc_t cvt_trimtaip */
+static u_long
cvt_trimtaip(
unsigned char *buffer,
int size,
@@ -141,31 +142,31 @@ cvt_trimtaip(
}
/*
- * inp_trimtaip
+ * parse_inp_fnc_t inp_trimtaip
*
- * grep data from input stream
+ * grab data from input stream
*/
static u_long
inp_trimtaip(
parse_t *parseio,
- unsigned int ch,
+ char ch,
timestamp_t *tstamp
)
{
unsigned int rtc;
-
+
parseprintf(DD_PARSE, ("inp_trimtaip(0x%lx, 0x%x, ...)\n", (long)parseio, ch));
-
+
switch (ch)
{
case '>':
parseprintf(DD_PARSE, ("inp_trimptaip: START seen\n"));
-
+
parseio->parse_index = 1;
parseio->parse_data[0] = ch;
parseio->parse_dtime.parse_stime = *tstamp; /* collect timestamp */
return PARSE_INP_SKIP;
-
+
case '<':
parseprintf(DD_PARSE, ("inp_trimtaip: END seen\n"));
if ((rtc = parse_addchar(parseio, ch)) == PARSE_INP_SKIP)
diff --git a/libparse/clk_trimtsip.c b/libparse/clk_trimtsip.c
index 743e39c..6c71d75 100644
--- a/libparse/clk_trimtsip.c
+++ b/libparse/clk_trimtsip.c
@@ -7,7 +7,7 @@
* Thanks to Sven Dietrich for providing test hardware
*
* Copyright (c) 1995-2009 by Frank Kardel <kardel <AT> ntp.org>
- * Copyright (c) 1989-1994 by Frank Kardel, Friedrich-Alexander Universität Erlangen-Nürnberg, Germany
+ * Copyright (c) 1989-1994 by Frank Kardel, Friedrich-Alexander Universitaet Erlangen-Nuernberg, Germany
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -116,7 +116,7 @@ struct trimble
#define STATUS_UNSAFE 1 /* not enough receivers for full precision */
#define STATUS_SYNC 2 /* enough information for good operation */
-static unsigned long inp_tsip (parse_t *, unsigned int, timestamp_t *);
+static unsigned long inp_tsip (parse_t *, char, timestamp_t *);
static unsigned long cvt_trimtsip (unsigned char *, int, struct format *, clocktime_t *, void *);
struct clockformat clock_trimtsip =
@@ -136,7 +136,7 @@ struct clockformat clock_trimtsip =
static unsigned long
inp_tsip(
parse_t *parseio,
- unsigned int ch,
+ char ch,
timestamp_t *tstamp
)
{
@@ -183,7 +183,7 @@ inp_tsip(
/* DLE,ETX -> end of packet */
parseio->parse_data[parseio->parse_index++] = DLE;
parseio->parse_data[parseio->parse_index] = ch;
- parseio->parse_ldsize = parseio->parse_index+1;
+ parseio->parse_ldsize = (u_short) (parseio->parse_index + 1);
memcpy(parseio->parse_ldata, parseio->parse_data, parseio->parse_ldsize);
parseio->parse_dtime.parse_msg[parseio->parse_dtime.parse_msglen++] = DLE;
parseio->parse_dtime.parse_msg[parseio->parse_dtime.parse_msglen++] = ch;
@@ -200,13 +200,13 @@ inp_tsip(
return PARSE_INP_SKIP;
}
-
-static int
+
+static short
getshort(
unsigned char *p
)
{
- return get_msb_short(&p);
+ return (short) get_msb_short(&p);
}
/*
@@ -245,7 +245,7 @@ cvt_trimtsip(
{
unsigned char *bp;
cmd = buffer[1];
-
+
switch(cmd)
{
case CMD_RCURTIME:
@@ -258,15 +258,15 @@ cvt_trimtsip(
bp = &mb(0);
if (fetch_ieee754(&bp, IEEE_SINGLE, &secs, trim_offsets) != IEEE_OK)
return CVT_FAIL|CVT_BADFMT;
-
+
if ((secs.l_i <= 0) ||
(t->t_utcknown == 0))
{
clock_time->flags = PARSEB_POWERUP;
return CVT_OK;
}
- if (week < 990) {
- week += 1024;
+ if (week < GPSWRAP) {
+ week += GPSWEEKS;
}
/* time OK */
@@ -275,7 +275,7 @@ cvt_trimtsip(
bp = &mb(6);
if (fetch_ieee754(&bp, IEEE_SINGLE, &utcoffset, trim_offsets) != IEEE_OK)
return CVT_FAIL|CVT_BADFMT;
-
+
L_SUB(&secs, &utcoffset); /* adjust GPS time to UTC time */
gpstolfp((unsigned short)week, (unsigned short)0,
@@ -289,10 +289,10 @@ cvt_trimtsip(
if (t->t_leap == ADDSECOND)
clock_time->flags |= PARSEB_LEAPADD;
-
+
if (t->t_leap == DELSECOND)
clock_time->flags |= PARSEB_LEAPDEL;
-
+
switch (t->t_operable)
{
case STATUS_SYNC:
@@ -307,12 +307,12 @@ cvt_trimtsip(
clock_time->flags |= PARSEB_NOSYNC|PARSEB_POWERUP;
break;
}
-
+
if (t->t_mode == 0)
clock_time->flags |= PARSEB_POSITION;
-
+
clock_time->flags |= PARSEB_S_LEAP|PARSEB_S_POSITION;
-
+
return CVT_OK;
} /* case 0x41 */
@@ -346,26 +346,26 @@ cvt_trimtsip(
{
l_fp t0t;
unsigned char *lbp;
-
+
/* UTC correction data - derive a leap warning */
- int tls = t->t_gpsutc = getshort((unsigned char *)&mb(12)); /* current leap correction (GPS-UTC) */
- int tlsf = t->t_gpsutcleap = getshort((unsigned char *)&mb(24)); /* new leap correction */
-
- t->t_weekleap = getshort((unsigned char *)&mb(20)); /* week no of leap correction */
- if (t->t_weekleap < 990)
- t->t_weekleap += 1024;
-
- t->t_dayleap = getshort((unsigned char *)&mb(22)); /* day in week of leap correction */
- t->t_week = getshort((unsigned char *)&mb(18)); /* current week no */
- if (t->t_week < 990)
- t->t_week += 1024;
-
+ int tls = t->t_gpsutc = (u_short) getshort((unsigned char *)&mb(12)); /* current leap correction (GPS-UTC) */
+ int tlsf = t->t_gpsutcleap = (u_short) getshort((unsigned char *)&mb(24)); /* new leap correction */
+
+ t->t_weekleap = (u_short) getshort((unsigned char *)&mb(20)); /* week no of leap correction */
+ if (t->t_weekleap < GPSWRAP)
+ t->t_weekleap = (u_short)(t->t_weekleap + GPSWEEKS);
+
+ t->t_dayleap = (u_short) getshort((unsigned char *)&mb(22)); /* day in week of leap correction */
+ t->t_week = (u_short) getshort((unsigned char *)&mb(18)); /* current week no */
+ if (t->t_week < GPSWRAP)
+ t->t_week = (u_short)(t->t_weekleap + GPSWEEKS);
+
lbp = (unsigned char *)&mb(14); /* last update time */
if (fetch_ieee754(&lbp, IEEE_SINGLE, &t0t, trim_offsets) != IEEE_OK)
return CVT_FAIL|CVT_BADFMT;
t->t_utcknown = t0t.l_ui != 0;
-
+
if ((t->t_utcknown) && /* got UTC information */
(tlsf != tls) && /* something will change */
((t->t_weekleap - t->t_week) < 5)) /* and close in the future */
diff --git a/libparse/clk_varitext.c b/libparse/clk_varitext.c
index 295ce0a..022549e 100644
--- a/libparse/clk_varitext.c
+++ b/libparse/clk_varitext.c
@@ -9,14 +9,14 @@
* clk_varitext.c,v 1.5 2005/04/16 17:32:10 kardel RELEASE_20050508_A
*
* Varitext code variant by A.McConnell 1997/01/19
- *
+ *
* Supports Varitext's Radio Clock
- *
+ *
* Used the Meinberg/Computime clock as a template for Varitext Radio Clock
*
* Codebase:
* 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
+ * Copyright (c) 1989-1994 by Frank Kardel, Friedrich-Alexander Universitaet Erlangen-Nuernberg, Germany
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -67,31 +67,31 @@ static const u_char VT_LAST_TELEGRAM_OK = 0x20;
/*
* The Varitext receiver sends a datagram in the following format every minute
- *
- * Timestamp T:YY:MM:MD:WD:HH:MM:SSCRLFSTXXX
+ *
+ * Timestamp T:YY:MM:MD:WD:HH:MM:SSCRLFSTXXX
* Pos 0123456789012345678901 2 3 4567
* 0000000000111111111122 2 2 2222
- * Parse T: : : : : : : \r\n
- *
- * T Startcharacter "T" specifies start of the timestamp
- * YY Year MM Month 1-12
- * MD Day of the month
- * WD Day of week
- * HH Hour
- * MM Minute
- * SS Second
- * CR Carriage return
- * LF Linefeed
+ * Parse T: : : : : : : \r\n
+ *
+ * T Startcharacter "T" specifies start of the timestamp
+ * YY Year MM Month 1-12
+ * MD Day of the month
+ * WD Day of week
+ * HH Hour
+ * MM Minute
+ * SS Second
+ * CR Carriage return
+ * LF Linefeed
* ST Status character
* Bit 0 - Set= Initialised; Reset=Time Invalid (DO NOT USE)
- * Bit 1 - Set= Synchronised; Reset= Unsynchronised
- * Bit 2 - Set= Alarm state; Reset= No alarm
- * Bit 3 - Set= BST; Reset= GMT
- * Bit 4 - Set= Seasonal change in approx hour; Reset= No seasonal change expected
+ * Bit 1 - Set= Synchronised; Reset= Unsynchronised
+ * Bit 2 - Set= Alarm state; Reset= No alarm
+ * Bit 3 - Set= BST; Reset= GMT
+ * Bit 4 - Set= Seasonal change in approx hour; Reset= No seasonal change expected
* Bit 5 - Set= Last MSF telegram was OK; Reset= Last telegram was in error;
- * Bit 6 - Always set
+ * Bit 6 - Always set
* Bit 7 - Unused
- * XXX Checksum calculated using Fletcher's method (ignored for now).
+ * XXX Checksum calculated using Fletcher's method (ignored for now).
*/
static struct format varitext_fmt =
@@ -105,8 +105,8 @@ static struct format varitext_fmt =
0
};
-static u_long cvt_varitext (unsigned char *, int, struct format *, clocktime_t *, void *);
-static u_long inp_varitext (parse_t *, unsigned int, timestamp_t *);
+static parse_cvt_fnc_t cvt_varitext;
+static parse_inp_fnc_t inp_varitext;
struct varitext {
unsigned char start_found;
@@ -128,11 +128,11 @@ clockformat_t clock_varitext =
};
/*
- * cvt_varitext
- *
+ * parse_cvt_fnc_t cvt_varitext
+ *
* convert simple type format
*/
-static u_long
+static u_long
cvt_varitext(
unsigned char *buffer,
int size,
@@ -142,7 +142,7 @@ cvt_varitext(
)
{
- if (!Strok(buffer, format->fixed_string)) {
+ if (!Strok(buffer, format->fixed_string)) {
return CVT_NONE;
} else {
if (Stoi(&buffer[format->field_offsets[O_DAY].offset], &clock_time->day,
@@ -156,7 +156,7 @@ cvt_varitext(
Stoi(&buffer[format->field_offsets[O_MIN].offset], &clock_time->minute,
format->field_offsets[O_MIN].length) ||
Stoi(&buffer[format->field_offsets[O_SEC].offset], &clock_time->second,
- format->field_offsets[O_SEC].length)) {
+ format->field_offsets[O_SEC].length)) {
return CVT_FAIL | CVT_BADFMT;
} else {
u_char *f = (u_char*) &buffer[format->field_offsets[O_FLAGS].offset];
@@ -170,24 +170,25 @@ cvt_varitext(
clock_time->flags |= PARSEB_DST;
}
/*
- if (!((*f) & VT_INITIALISED)) Clock not initialised
+ if (!((*f) & VT_INITIALISED)) Clock not initialised
clock_time->flags |= PARSEB_POWERUP;
-
- if (!((*f) & VT_SYNCHRONISED)) Clock not synchronised
+
+ if (!((*f) & VT_SYNCHRONISED)) Clock not synchronised
clock_time->flags |= PARSEB_NOSYNC;
-
- if (((*f) & VT_SEASON_CHANGE)) Seasonal change expected in the next hour
+
+ if (((*f) & VT_SEASON_CHANGE)) Seasonal change expected in the next hour
clock_time->flags |= PARSEB_ANNOUNCE;
*/
- return CVT_OK;
+ return CVT_OK;
}
}
}
-static u_long
+/* parse_inp_fnc_t inp_varitext */
+static u_long
inp_varitext(
parse_t *parseio,
- unsigned int ch,
+ char ch,
timestamp_t *tstamp
)
{
@@ -196,10 +197,10 @@ inp_varitext(
parseprintf(DD_PARSE, ("inp_varitext(0x%lx, 0x%x, ...)\n", (long)parseio, ch));
- if (!t)
+ if (!t)
return PARSE_INP_SKIP; /* local data not allocated - sigh! */
- if (ch == 'T')
+ if (ch == 'T')
t->tstamp = *tstamp;
if ((t->previous_ch == 'T') && (ch == ':'))
@@ -224,7 +225,7 @@ inp_varitext(
return rtc;
}
- if (t->end_found)
+ if (t->end_found)
{
if (++(t->end_count) == 4) /* Finally found the end of the message */
{
@@ -235,16 +236,16 @@ inp_varitext(
return parse_end(parseio);
else
return rtc;
- }
+ }
}
- if ((t->previous_ch == '\r') && (ch == '\n'))
+ if ((t->previous_ch == '\r') && (ch == '\n'))
{
t->end_found = 1;
}
}
-
+
t->previous_ch = ch;
return PARSE_INP_SKIP;
diff --git a/libparse/clk_wharton.c b/libparse/clk_wharton.c
index 55ab43a..a65bc53 100644
--- a/libparse/clk_wharton.c
+++ b/libparse/clk_wharton.c
@@ -74,8 +74,11 @@ extern void printf (const char *, ...);
*
*/
+static parse_cvt_fnc_t cvt_wharton_400a;
+static parse_inp_fnc_t inp_wharton_400a;
+
/*
- * cvt_wharton_400a
+ * parse_cvt_fnc_t cvt_wharton_400a
*
* convert simple type format
*/
@@ -121,14 +124,14 @@ cvt_wharton_400a(
}
/*
- * inp_wharton_400a
+ * parse_inp_fnc_t inp_wharton_400a
*
- * grep data from input stream
+ * grab data from input stream
*/
static u_long
inp_wharton_400a(
parse_t *parseio,
- unsigned int ch,
+ char ch,
timestamp_t *tstamp
)
{
@@ -166,7 +169,7 @@ clockformat_t clock_wharton_400a =
0, /* conversion configuration */
"WHARTON 400A Series clock Output Format 1", /* String format name */
15, /* string buffer */
- 0 /* no private data (complete pakets) */
+ 0 /* no private data (complete packets) */
};
#else /* not (REFCLOCK && CLOCK_PARSE && CLOCK_WHARTON_400A) */
diff --git a/libparse/data_mbg.c b/libparse/data_mbg.c
index 97bef35..0b3808c 100644
--- a/libparse/data_mbg.c
+++ b/libparse/data_mbg.c
@@ -43,6 +43,7 @@
#include "ntp_types.h"
#include "ntp_stdlib.h"
#include "ntp_fp.h"
+#include "ntp_calendar.h"
#include "mbg_gps166.h"
#include "binio.h"
#include "ieee754io.h"
@@ -63,10 +64,10 @@ put_mbg_header(
GPS_MSG_HDR *headerp
)
{
- put_lsb_short(bufpp, headerp->gps_cmd);
- put_lsb_short(bufpp, headerp->gps_len);
- put_lsb_short(bufpp, headerp->gps_data_csum);
- put_lsb_short(bufpp, headerp->gps_hdr_csum);
+ put_lsb_short(bufpp, headerp->cmd);
+ put_lsb_short(bufpp, headerp->len);
+ put_lsb_short(bufpp, headerp->data_csum);
+ put_lsb_short(bufpp, headerp->hdr_csum);
}
void
@@ -75,7 +76,7 @@ get_mbg_sw_rev(
SW_REV *sw_revp
)
{
- sw_revp->code = get_lsb_short(bufpp);
+ sw_revp->code = get_lsb_uint16(bufpp);
memcpy(sw_revp->name, *bufpp, sizeof(sw_revp->name));
*bufpp += sizeof(sw_revp->name);
}
@@ -86,8 +87,8 @@ get_mbg_ascii_msg(
ASCII_MSG *ascii_msgp
)
{
- ascii_msgp->csum = get_lsb_short(bufpp);
- ascii_msgp->valid = get_lsb_short(bufpp);
+ ascii_msgp->csum = (CSUM) get_lsb_short(bufpp);
+ ascii_msgp->valid = get_lsb_int16(bufpp);
memcpy(ascii_msgp->s, *bufpp, sizeof(ascii_msgp->s));
*bufpp += sizeof(ascii_msgp->s);
}
@@ -98,7 +99,7 @@ get_mbg_svno(
SVNO *svnop
)
{
- *svnop = get_lsb_short(bufpp);
+ *svnop = (SVNO) get_lsb_short(bufpp);
}
void
@@ -107,7 +108,7 @@ get_mbg_health(
HEALTH *healthp
)
{
- *healthp = get_lsb_short(bufpp);
+ *healthp = (HEALTH) get_lsb_short(bufpp);
}
void
@@ -116,7 +117,7 @@ get_mbg_cfg(
CFG *cfgp
)
{
- *cfgp = get_lsb_short(bufpp);
+ *cfgp = (CFG) get_lsb_short(bufpp);
}
void
@@ -125,7 +126,7 @@ get_mbg_tgps(
T_GPS *tgpsp
)
{
- tgpsp->wn = get_lsb_short(bufpp);
+ tgpsp->wn = get_lsb_uint16(bufpp);
tgpsp->sec = get_lsb_long(bufpp);
tgpsp->tick = get_lsb_long(bufpp);
}
@@ -133,20 +134,20 @@ get_mbg_tgps(
void
get_mbg_tm(
unsigned char **buffpp,
- TM *tmp
+ TM_GPS *tmp
)
{
- tmp->year = get_lsb_short(buffpp);
+ tmp->year = get_lsb_int16(buffpp);
tmp->month = *(*buffpp)++;
- tmp->mday = *(*buffpp)++;
- tmp->yday = get_lsb_short(buffpp);
- tmp->wday = *(*buffpp)++;
- tmp->hour = *(*buffpp)++;
- tmp->minute = *(*buffpp)++;
- tmp->second = *(*buffpp)++;
- tmp->frac = get_lsb_long(buffpp);
+ tmp->mday = *(*buffpp)++;
+ tmp->yday = get_lsb_int16(buffpp);
+ tmp->wday = *(*buffpp)++;
+ tmp->hour = *(*buffpp)++;
+ tmp->min = *(*buffpp)++;
+ tmp->sec = *(*buffpp)++;
+ tmp->frac = get_lsb_long(buffpp);
tmp->offs_from_utc = get_lsb_long(buffpp);
- tmp->status= get_lsb_short(buffpp);
+ tmp->status = get_lsb_uint16(buffpp);
}
void
@@ -155,7 +156,7 @@ get_mbg_ttm(
TTM *ttmp
)
{
- ttmp->channel = get_lsb_short(buffpp);
+ ttmp->channel = get_lsb_int16(buffpp);
get_mbg_tgps(buffpp, &ttmp->t);
get_mbg_tm(buffpp, &ttmp->tm);
}
@@ -166,9 +167,9 @@ get_mbg_synth(
SYNTH *synthp
)
{
- synthp->freq = get_lsb_short(buffpp);
- synthp->range = get_lsb_short(buffpp);
- synthp->phase = get_lsb_short(buffpp);
+ synthp->freq = get_lsb_int16(buffpp);
+ synthp->range = get_lsb_int16(buffpp);
+ synthp->phase = get_lsb_int16(buffpp);
}
static void
@@ -201,7 +202,7 @@ get_mbg_antinfo(
ANT_INFO *antinfop
)
{
- antinfop->status = get_lsb_short(buffpp);
+ antinfop->status = get_lsb_int16(buffpp);
get_mbg_tm(buffpp, &antinfop->tm_disconn);
get_mbg_tm(buffpp, &antinfop->tm_reconn);
antinfop->delta_t = get_lsb_long(buffpp);
@@ -216,8 +217,8 @@ mbg_time_status_str(
{
static struct state
{
- int flag; /* bit flag */
- const char *string; /* bit name */
+ int flag; /* bit flag */
+ const char *string; /* bit name */
} states[] =
{
{ TM_UTC, "UTC CORR" },
@@ -233,7 +234,7 @@ mbg_time_status_str(
{
char *start, *p;
struct state *s;
-
+
start = p = *buffpp;
for (s = states; s->flag; s++)
@@ -252,25 +253,27 @@ mbg_time_status_str(
*buffpp = p;
}
}
-
+
void
mbg_tm_str(
char **buffpp,
- TM *tmp,
- int size
+ TM_GPS *tmp,
+ int size,
+ int print_status
)
{
char *s = *buffpp;
snprintf(*buffpp, size, "%04d-%02d-%02d %02d:%02d:%02d.%07ld (%c%02d%02d) ",
tmp->year, tmp->month, tmp->mday,
- tmp->hour, tmp->minute, tmp->second, tmp->frac,
+ tmp->hour, tmp->min, tmp->sec, (long) tmp->frac,
(tmp->offs_from_utc < 0) ? '-' : '+',
- abs(tmp->offs_from_utc) / 3600,
- (abs(tmp->offs_from_utc) / 60) % 60);
+ abs((int)tmp->offs_from_utc) / 3600,
+ (abs((int)tmp->offs_from_utc) / 60) % 60);
*buffpp += strlen(*buffpp);
- mbg_time_status_str(buffpp, tmp->status, size - (*buffpp - s));
+ if (print_status)
+ mbg_time_status_str(buffpp, tmp->status, size - (*buffpp - s));
}
void
@@ -281,8 +284,8 @@ mbg_tgps_str(
)
{
snprintf(*buffpp, size, "week %d + %ld days + %ld.%07ld sec",
- tgpsp->wn, tgpsp->sec / 86400,
- tgpsp->sec % 86400, tgpsp->tick);
+ tgpsp->wn, (long) tgpsp->sec / SECSPERDAY,
+ (long) tgpsp->sec % SECSPERDAY, (long) tgpsp->tick);
*buffpp += strlen(*buffpp);
}
@@ -293,19 +296,19 @@ get_mbg_cfgh(
)
{
int i;
-
- cfghp->csum = get_lsb_short(buffpp);
- cfghp->valid = get_lsb_short(buffpp);
+
+ cfghp->csum = (CSUM) get_lsb_short(buffpp);
+ cfghp->valid = get_lsb_int16(buffpp);
get_mbg_tgps(buffpp, &cfghp->tot_51);
get_mbg_tgps(buffpp, &cfghp->tot_63);
get_mbg_tgps(buffpp, &cfghp->t0a);
- for (i = MIN_SVNO; i <= MAX_SVNO; i++)
+ for (i = 0; i < N_SVNO_GPS; i++)
{
get_mbg_cfg(buffpp, &cfghp->cfg[i]);
}
-
- for (i = MIN_SVNO; i <= MAX_SVNO; i++)
+
+ for (i = 0; i < N_SVNO_GPS; i++)
{
get_mbg_health(buffpp, &cfghp->health[i]);
}
@@ -317,23 +320,23 @@ get_mbg_utc(
UTC *utcp
)
{
- utcp->csum = get_lsb_short(buffpp);
- utcp->valid = get_lsb_short(buffpp);
+ utcp->csum = (CSUM) get_lsb_short(buffpp);
+ utcp->valid = get_lsb_int16(buffpp);
get_mbg_tgps(buffpp, &utcp->t0t);
-
+
if (fetch_ieee754(buffpp, IEEE_DOUBLE, &utcp->A0, mbg_double) != IEEE_OK)
{
L_CLR(&utcp->A0);
}
-
+
if (fetch_ieee754(buffpp, IEEE_DOUBLE, &utcp->A1, mbg_double) != IEEE_OK)
{
L_CLR(&utcp->A1);
}
- utcp->WNlsf = get_lsb_short(buffpp);
- utcp->DNt = get_lsb_short(buffpp);
+ utcp->WNlsf = get_lsb_uint16(buffpp);
+ utcp->DNt = get_lsb_int16(buffpp);
utcp->delta_tls = *(*buffpp)++;
utcp->delta_tlsf = *(*buffpp)++;
}
@@ -345,7 +348,7 @@ get_mbg_lla(
)
{
int i;
-
+
for (i = LAT; i <= ALT; i++)
{
if (fetch_ieee754(buffpp, IEEE_DOUBLE, &lla[i], mbg_double) != IEEE_OK)
@@ -367,7 +370,7 @@ get_mbg_xyz(
)
{
int i;
-
+
for (i = XP; i <= ZP; i++)
{
if (fetch_ieee754(buffpp, IEEE_DOUBLE, &xyz[i], mbg_double) != IEEE_OK)
@@ -383,14 +386,14 @@ get_mbg_comparam(
COM_PARM *comparamp
)
{
- int i;
-
+ size_t i;
+
comparamp->baud_rate = get_lsb_long(buffpp);
for (i = 0; i < sizeof(comparamp->framing); i++)
{
comparamp->framing[i] = *(*buffpp)++;
}
- comparamp->handshake = get_lsb_short(buffpp);
+ comparamp->handshake = get_lsb_int16(buffpp);
}
void
@@ -400,12 +403,12 @@ get_mbg_portparam(
)
{
int i;
-
- for (i = 0; i < N_COM; i++)
+
+ for (i = 0; i < DEFAULT_N_COM; i++)
{
get_mbg_comparam(buffpp, &portparamp->com[i]);
}
- for (i = 0; i < N_COM; i++)
+ for (i = 0; i < DEFAULT_N_COM; i++)
{
portparamp->mode[i] = *(*buffpp)++;
}
@@ -416,20 +419,20 @@ get_mbg_portparam(
{ \
L_CLR(addr); \
}
-
+
void
get_mbg_eph(
unsigned char ** buffpp,
EPH *ephp
)
{
- ephp->csum = get_lsb_short(buffpp);
- ephp->valid = get_lsb_short(buffpp);
-
- ephp->health = get_lsb_short(buffpp);
- ephp->IODC = get_lsb_short(buffpp);
- ephp->IODE2 = get_lsb_short(buffpp);
- ephp->IODE3 = get_lsb_short(buffpp);
+ ephp->csum = (CSUM) get_lsb_short(buffpp);
+ ephp->valid = get_lsb_int16(buffpp);
+
+ ephp->health = (HEALTH) get_lsb_short(buffpp);
+ ephp->IODC = (IOD) get_lsb_short(buffpp);
+ ephp->IODE2 = (IOD) get_lsb_short(buffpp);
+ ephp->IODE3 = (IOD) get_lsb_short(buffpp);
get_mbg_tgps(buffpp, &ephp->tt);
get_mbg_tgps(buffpp, &ephp->t0c);
@@ -456,7 +459,7 @@ get_mbg_eph(
FETCH_DOUBLE(buffpp, &ephp->af2);
FETCH_DOUBLE(buffpp, &ephp->tgd);
- ephp->URA = get_lsb_short(buffpp);
+ ephp->URA = get_lsb_uint16(buffpp);
ephp->L2code = *(*buffpp)++;
ephp->L2flag = *(*buffpp)++;
@@ -468,10 +471,10 @@ get_mbg_alm(
ALM *almp
)
{
- almp->csum = get_lsb_short(buffpp);
- almp->valid = get_lsb_short(buffpp);
-
- almp->health = get_lsb_short(buffpp);
+ almp->csum = (CSUM) get_lsb_short(buffpp);
+ almp->valid = get_lsb_int16(buffpp);
+
+ almp->health = (HEALTH) get_lsb_short(buffpp);
get_mbg_tgps(buffpp, &almp->t0a);
@@ -493,8 +496,8 @@ get_mbg_iono(
IONO *ionop
)
{
- ionop->csum = get_lsb_short(buffpp);
- ionop->valid = get_lsb_short(buffpp);
+ ionop->csum = (CSUM) get_lsb_short(buffpp);
+ ionop->valid = get_lsb_int16(buffpp);
FETCH_DOUBLE(buffpp, &ionop->alpha_0);
FETCH_DOUBLE(buffpp, &ionop->alpha_1);
diff --git a/libparse/gpstolfp.c b/libparse/gpstolfp.c
index 5354dd3..c162429 100644
--- a/libparse/gpstolfp.c
+++ b/libparse/gpstolfp.c
@@ -34,10 +34,8 @@
*/
#include <config.h>
#include "ntp_fp.h"
-
-#define GPSORIGIN 2524953600UL /* NTP origin - GPS origin in seconds */
-#define SECSPERWEEK (unsigned)(604800) /* seconds per week - GPS tells us about weeks */
-#define GPSWRAP 990 /* assume week count less than this in the previous epoch */
+#include "ntp_calendar.h"
+#include "parse.h"
void
gpstolfp(
@@ -49,10 +47,10 @@ gpstolfp(
{
if (weeks < GPSWRAP)
{
- weeks += 1024;
+ weeks += GPSWEEKS;
}
- lfp->l_ui = weeks * SECSPERWEEK + days * 86400 + seconds + GPSORIGIN; /* convert to NTP time */
+ lfp->l_ui = (uint32_t)(weeks * SECSPERWEEK + days * SECSPERDAY + seconds + GPSORIGIN); /* convert to NTP time */
lfp->l_uf = 0;
}
diff --git a/libparse/info_trimble.c b/libparse/info_trimble.c
index 6456e0f..53b2e32 100644
--- a/libparse/info_trimble.c
+++ b/libparse/info_trimble.c
@@ -48,7 +48,7 @@ cmd_info_t trimble_scmds[] = {
{ CMD_CHIGH8CNT, "CMD_CHIGH8CNT", "high-8 (best 4) / high-6 (overdetermined) control (0x75)", "", 0 },
{ CMD_CMAXDGPSCOR, "CMD_CMAXDGPSCOR", "maximum rate of DGPS corrections (0x77)", "", 0 },
{ CMD_CSUPER, "CMD_CSUPER", "super paket (0x8E)", "", 0 },
- { 0xFF, "", "" }
+ { 0xFF, "", "", "", 0 }
};
@@ -90,5 +90,5 @@ cmd_info_t trimble_rcmds[] = {
{ CMD_RDOUBLELLA, "CMD_RDOUBLELLA", "double precision LLA (0x84)", "gps_position_ext(LLA)", RO|DEF },
{ CMD_RDGPSSTAT, "CMD_RDGPSSTAT", "differential correction status (0x85)", "trimble_dgpsstatus", RO },
{ CMD_RSUPER, "CMD_RSUPER", "super paket (0x8F)", "", 0 },
- { 0xFF, "", "" }
+ { 0xFF, "", "", "", 0 }
};
diff --git a/libparse/mkinfo_rcmd.sed b/libparse/mkinfo_rcmd.sed
index 5238d5c..b8ed623 100644
--- a/libparse/mkinfo_rcmd.sed
+++ b/libparse/mkinfo_rcmd.sed
@@ -4,5 +4,5 @@
cmd_info_t trimble_rcmds[] = {
s!^#define[ \ ][ \ ]*\(CMD_R[^ \ ]*\)[ \ ][ \ ]*\([^ \ ]*\)[ \ ][ \ ]*/\*[ \ ][ \ ]*\(.*\)[ \ ]*:\([^:]*\):\([^:]*\)[ \ ][ \ ]*\*/!\ { \1, "\1", "\3 (\2)", "\4", \5 },!p
$a\
-\ { 0xFF, "", "" }\
+\ { 0xFF, "", "", "", 0 }\
};
diff --git a/libparse/mkinfo_scmd.sed b/libparse/mkinfo_scmd.sed
index 9c17f39..fb58d32 100644
--- a/libparse/mkinfo_scmd.sed
+++ b/libparse/mkinfo_scmd.sed
@@ -11,5 +11,5 @@
cmd_info_t trimble_scmds[] = {
s!^#define[ ][ ]*\(CMD_C[^ ]*\)[ ][ ]*\([^ ]*\)[ ][ ]*/\*[ ][ ]*\(.*\)[ ][ ]*\*/! { \1, "\1", "\3 (\2)", "", 0 },!p
$a\
-\ { 0xFF, "", "" }\
+\ { 0xFF, "", "", "", 0 }\
};
diff --git a/libparse/parse.c b/libparse/parse.c
index 85e5299..9e663f9 100644
--- a/libparse/parse.c
+++ b/libparse/parse.c
@@ -1,6 +1,6 @@
/*
* /src/NTP/ntp4-dev/libparse/parse.c,v 4.20 2005/08/06 17:39:40 kardel RELEASE_20050806_A
- *
+ *
* parse.c,v 4.20 2005/08/06 17:39:40 kardel RELEASE_20050806_A
*
* Parser module for reference clock
@@ -12,7 +12,7 @@
* when PARSEKERNEL is not defined NTP time stamps will be used.
*
* 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
+ * Copyright (c) 1989-1994 by Frank Kardel, Friedrich-Alexander Universitaet Erlangen-Nuernberg, Germany
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -106,7 +106,7 @@ Strcmp(
while (!(c = *s++ - *t++) && *s && *t)
/* empty loop */;
-
+
return c;
}
@@ -154,10 +154,10 @@ parse_ioinit(
)
{
parseprintf(DD_PARSE, ("parse_iostart\n"));
-
+
parseio->parse_plen = 0;
parseio->parse_pdata = (void *)0;
-
+
parseio->parse_data = 0;
parseio->parse_ldata = 0;
parseio->parse_dsize = 0;
@@ -166,7 +166,7 @@ parse_ioinit(
parseio->parse_ioflags = PARSE_IO_CS7; /* usual unix default */
parseio->parse_index = 0;
parseio->parse_ldsize = 0;
-
+
return 1;
}
@@ -188,15 +188,15 @@ parse_ioend(
unsigned int
parse_restart(
parse_t *parseio,
- unsigned int ch
+ char ch
)
{
unsigned int updated = PARSE_INP_SKIP;
-
+
/*
* re-start packet - timeout - overflow - start symbol
*/
-
+
if (parseio->parse_index)
{
/*
@@ -208,17 +208,17 @@ parse_restart(
parseio->parse_ldsize = parseio->parse_index;
updated = PARSE_INP_TIME;
}
-
+
parseio->parse_index = 1;
parseio->parse_data[0] = ch;
parseprintf(DD_PARSE, ("parse: parse_restart: buffer start (updated = %x)\n", updated));
return updated;
}
-
+
unsigned int
parse_addchar(
parse_t *parseio,
- unsigned int ch
+ char ch
)
{
/*
@@ -239,7 +239,7 @@ parse_addchar(
*/
return parse_restart(parseio, ch);
}
-
+
unsigned int
parse_end(
parse_t *parseio
@@ -260,11 +260,11 @@ parse_end(
int
parse_ioread(
register parse_t *parseio,
- register unsigned int ch,
+ register char ch,
register timestamp_t *tstamp
)
{
- register unsigned updated = CVT_NONE;
+ register u_int updated = CVT_NONE;
/*
* within STREAMS CSx (x < 8) chars still have the upper bits set
* so we normalize the characters by masking unecessary bits off.
@@ -282,9 +282,9 @@ parse_ioread(
case PARSE_IO_CS7:
ch &= 0x7F;
break;
-
+
case PARSE_IO_CS8:
- ch &= 0xFF;
+ ch &= (char) 0xFFU;
break;
}
@@ -306,18 +306,18 @@ parse_ioread(
{
updated = CVT_OK;
}
-
+
if (input_status & PARSE_INP_TIME) /* time sample is available */
{
- updated = timepacket(parseio);
+ updated = (u_int) timepacket(parseio);
}
-
+
if (input_status & PARSE_INP_DATA) /* got additional data */
{
updated |= CVT_ADDITIONAL;
}
}
-
+
/*
* remember last character time
@@ -353,7 +353,7 @@ parse_iopps(
register timestamp_t *ptime
)
{
- register unsigned updated = CVT_NONE;
+ register u_int updated = CVT_NONE;
/*
* PPS pulse information will only be delivered to ONE clock format
@@ -364,7 +364,7 @@ parse_iopps(
if (clockformats[parseio->parse_lformat]->syncpps)
{
- updated = clockformats[parseio->parse_lformat]->syncpps(parseio, status == SYNC_ONE, ptime);
+ updated = (u_int) clockformats[parseio->parse_lformat]->syncpps(parseio, status == SYNC_ONE, ptime);
parseprintf(DD_PARSE, ("parse_iopps: updated = 0x%x\n", updated));
}
@@ -403,13 +403,13 @@ parse_to_unixtime(
)
{
#define SETRTC(_X_) { if (cvtrtc) *cvtrtc = (_X_); }
- static int days_of_month[] =
+ static int days_of_month[] =
{
0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
};
register int i;
time_t t;
-
+
if (clock_time->utctime)
return clock_time->utctime; /* if the conversion routine gets it right away - why not */
@@ -423,12 +423,12 @@ parse_to_unixtime(
SETRTC(CVT_FAIL|CVT_BADDATE);
return -1;
}
-
+
/*
* sorry, slow section here - but it's not time critical anyway
*/
t = julian0(clock_time->year) - julian0(1970); /* Y2kFixes */
- /* month */
+ /* month */
if (clock_time->month <= 0 || clock_time->month > 12)
{
SETRTC(CVT_FAIL|CVT_BADDATE);
@@ -466,7 +466,7 @@ parse_to_unixtime(
t = TIMES24(t) + clock_time->hour;
- /* min */
+ /* min */
if (clock_time->minute < 0 || clock_time->minute > 59)
{
SETRTC(CVT_FAIL|CVT_BADTIME);
@@ -475,7 +475,7 @@ parse_to_unixtime(
t = TIMES60(t) + clock_time->minute;
/* sec */
-
+
if (clock_time->second < 0 || clock_time->second > 60) /* allow for LEAPs */
{
SETRTC(CVT_FAIL|CVT_BADTIME);
@@ -510,7 +510,7 @@ Stoi(
while(*s == ' ')
s++;
-
+
if (*s == '-')
{
s++;
@@ -519,7 +519,7 @@ Stoi(
else
if (*s == '+')
s++;
-
+
for(;;)
{
c = *s++;
@@ -573,16 +573,16 @@ updatetimeinfo(
{
int s = splhigh();
#endif
-
+
parseio->parse_lstate = parseio->parse_dtime.parse_state | flags | PARSEB_TIMECODE;
-
+
parseio->parse_dtime.parse_state = parseio->parse_lstate;
#ifdef PARSEKERNEL
(void)splx((unsigned int)s);
}
#endif
-
+
#ifdef PARSEKERNEL
parseprintf(DD_PARSE, ("updatetimeinfo status=0x%x, time=%x\n", parseio->parse_dtime.parse_state,
@@ -591,7 +591,7 @@ updatetimeinfo(
parseprintf(DD_PARSE, ("updatetimeinfo status=0x%lx, time=%x\n", (long)parseio->parse_dtime.parse_state,
parseio->parse_dtime.parse_time.fp.l_ui));
#endif
-
+
return CVT_OK; /* everything fine and dandy... */
}
@@ -614,7 +614,7 @@ syn_simple(
}
/*
- * pps_simple
+ * parse_pps_fnc_t pps_simple
*
* handle a pps time stamp
*/
@@ -628,12 +628,12 @@ pps_simple(
{
parseio->parse_dtime.parse_ptime = *ptime;
parseio->parse_dtime.parse_state |= PARSEB_PPS|PARSEB_S_PPS;
-
+
return CVT_NONE;
}
/*
- * pps_one
+ * parse_pps_fnc_t pps_one
*
* handle a pps time stamp in ONE edge
*/
@@ -647,12 +647,12 @@ pps_one(
{
if (status)
return pps_simple(parseio, status, ptime);
-
+
return CVT_NONE;
}
/*
- * pps_zero
+ * parse_pps_fnc_t pps_zero
*
* handle a pps time stamp in ZERO edge
*/
@@ -666,7 +666,7 @@ pps_zero(
{
if (!status)
return pps_simple(parseio, status, ptime);
-
+
return CVT_NONE;
}
@@ -684,13 +684,13 @@ timepacket(
register time_t t;
u_long cvtrtc; /* current conversion result */
clocktime_t clock_time;
-
+
memset((char *)&clock_time, 0, sizeof clock_time);
format = parseio->parse_lformat;
if (format == (unsigned short)~0)
return CVT_NONE;
-
+
switch ((cvtrtc = clockformats[format]->convert ?
clockformats[format]->convert((unsigned char *)parseio->parse_ldata, parseio->parse_ldsize, (struct format *)(clockformats[format]->data), &clock_time, parseio->parse_pdata) :
CVT_NONE) & CVT_MASK)
@@ -698,17 +698,17 @@ timepacket(
case CVT_FAIL:
parseio->parse_badformat++;
break;
-
+
case CVT_NONE:
/*
* too bad - pretend bad format
*/
parseio->parse_badformat++;
break;
-
+
case CVT_OK:
break;
-
+
case CVT_SKIP:
return CVT_NONE;
@@ -716,7 +716,7 @@ timepacket(
/* shouldn't happen */
#ifndef PARSEKERNEL
msyslog(LOG_WARNING, "parse: INTERNAL error: bad return code of convert routine \"%s\"", clockformats[format]->name);
-#endif
+#endif
return CVT_FAIL|cvtrtc;
}
@@ -724,7 +724,7 @@ timepacket(
{
return CVT_FAIL|cvtrtc;
}
-
+
/*
* time stamp
*/
@@ -732,7 +732,7 @@ timepacket(
parseio->parse_dtime.parse_time.tv.tv_sec = t;
parseio->parse_dtime.parse_time.tv.tv_usec = clock_time.usecond;
#else
- parseio->parse_dtime.parse_time.fp.l_ui = t + JAN_1970;
+ parseio->parse_dtime.parse_time.fp.l_ui = (uint32_t) (t + JAN_1970);
TVUTOTSF(clock_time.usecond, parseio->parse_dtime.parse_time.fp.l_uf);
#endif
@@ -758,7 +758,7 @@ parse_timecode(
*/
dct->parsegettc.parse_badformat = parse->parse_badformat;
parse->parse_badformat = 0;
-
+
if (parse->parse_ldsize <= PARSE_TCMAX)
{
dct->parsegettc.parse_count = parse->parse_ldsize;
@@ -771,7 +771,7 @@ parse_timecode(
}
}
-
+
/*ARGSUSED*/
int
parse_setfmt(
@@ -792,7 +792,7 @@ parse_setfmt(
if (parse->parse_pdata)
FREE(parse->parse_pdata, parse->parse_plen);
parse->parse_pdata = 0;
-
+
parse->parse_plen = clockformats[i]->plen;
if (parse->parse_plen)
@@ -809,9 +809,9 @@ parse_setfmt(
if (parse->parse_data)
FREE(parse->parse_data, (unsigned)(parse->parse_dsize * 2 + 2));
parse->parse_ldata = parse->parse_data = 0;
-
+
parse->parse_dsize = clockformats[i]->length;
-
+
if (parse->parse_dsize)
{
parse->parse_data = (char*)MALLOC((unsigned)(parse->parse_dsize * 2 + 2));
@@ -820,20 +820,20 @@ parse_setfmt(
if (parse->parse_pdata)
FREE(parse->parse_pdata, parse->parse_plen);
parse->parse_pdata = 0;
-
+
parseprintf(DD_PARSE, ("init failed: malloc for data area failed\n"));
return 0;
}
}
-
+
/*
* leave room for '\0'
*/
parse->parse_ldata = parse->parse_data + parse->parse_dsize + 1;
-
+
parse->parse_lformat = i;
-
+
return 1;
}
}
@@ -852,7 +852,7 @@ parse_getfmt(
if (dct->parseformat.parse_format < nformats &&
Strlen(clockformats[dct->parseformat.parse_format]->name) <= PARSE_TCMAX)
{
- dct->parseformat.parse_count = Strlen(clockformats[dct->parseformat.parse_format]->name)+1;
+ dct->parseformat.parse_count = (unsigned short) (Strlen(clockformats[dct->parseformat.parse_format]->name) + 1);
memcpy(dct->parseformat.parse_buffer, clockformats[dct->parseformat.parse_format]->name, dct->parseformat.parse_count);
return 1;
}
@@ -870,7 +870,7 @@ parse_setcs(
)
{
parse->parse_ioflags &= ~PARSE_IO_CSIZE;
- parse->parse_ioflags |= dct->parsesetcs.parse_cs & PARSE_IO_CSIZE;
+ parse->parse_ioflags |= (int) (dct->parsesetcs.parse_cs & PARSE_IO_CSIZE);
return 1;
}
diff --git a/libparse/parse_conf.c b/libparse/parse_conf.c
index b7234dd..37871c9 100644
--- a/libparse/parse_conf.c
+++ b/libparse/parse_conf.c
@@ -1,6 +1,6 @@
/*
* /src/NTP/ntp4-dev/libparse/parse_conf.c,v 4.9 2005/04/16 17:32:10 kardel RELEASE_20050508_A
- *
+ *
* parse_conf.c,v 4.9 2005/04/16 17:32:10 kardel RELEASE_20050508_A
*
* Parser configuration module for reference clocks
@@ -12,7 +12,7 @@
* when STREAM is not defined NTP time stamps will be used.
*
* 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
+ * Copyright (c) 1989-1994 by Frank Kardel, Friedrich-Alexander Universitaet Erlangen-Nuernberg, Germany
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/libparse/parsesolaris.c b/libparse/parsesolaris.c
index d3756af..8c91257 100644
--- a/libparse/parsesolaris.c
+++ b/libparse/parsesolaris.c
@@ -1,12 +1,12 @@
/*
* /src/NTP/ntp4-dev/libparse/parsesolaris.c,v 4.11 2005/04/16 17:32:10 kardel RELEASE_20050508_A
- *
+ *
* parsesolaris.c,v 4.11 2005/04/16 17:32:10 kardel RELEASE_20050508_A
*
* STREAMS module for reference clocks
*
* 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
+ * Copyright (c) 1989-1994 by Frank Kardel, Friedrich-Alexander Universitaet Erlangen-Nuernberg, Germany
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -74,7 +74,7 @@ static struct fmodsw fmod_templ =
extern struct mod_ops mod_strmodops;
-static struct modlstrmod modlstrmod =
+static struct modlstrmod modlstrmod =
{
&mod_strmodops, /* a STREAMS module */
"PARSE - NTP reference", /* name this baby - keep room for revision number */
@@ -100,13 +100,13 @@ _init(
)
{
static char revision[] = "4.6";
- char *s, *S;
+ char *s, *S;
char *t;
-
+
#ifndef lint
t = rcsid;
#endif
-
+
/*
* copy RCS revision into Drv_name
*
@@ -125,20 +125,20 @@ _init(
}
if (*s == ' ') s++;
}
-
- t = modlstrmod.strmod_linkinfo;
+
+ t = modlstrmod.strmod_linkinfo;
while (*t && (*t != ' '))
{
t++;
}
if (*t == ' ') t++;
-
+
S = s;
while (*S && (((*S >= '0') && (*S <= '9')) || (*S == '.')))
{
S++;
}
-
+
if (*s && *t && (S > s))
{
if (strlen(t) >= (S - s))
@@ -308,7 +308,7 @@ setup_stream(
}
else
{
- pprintf(DD_OPEN, "parse: setup_stream - FAILED - no MEMORY for allocb\n");
+ pprintf(DD_OPEN, "parse: setup_stream - FAILED - no MEMORY for allocb\n");
return 0;
}
}
@@ -325,18 +325,18 @@ parseopen(
{
register parsestream_t *parse;
static int notice = 0;
-
- pprintf(DD_OPEN, "parse: OPEN - q=%x\n", q);
-
+
+ pprintf(DD_OPEN, "parse: OPEN - q=%x\n", q);
+
if (sflag != MODOPEN)
{ /* open only for modules */
- pprintf(DD_OPEN, "parse: OPEN - FAILED - not MODOPEN\n");
+ pprintf(DD_OPEN, "parse: OPEN - FAILED - not MODOPEN\n");
return EIO;
}
if (q->q_ptr != (caddr_t)NULL)
{
- pprintf(DD_OPEN, "parse: OPEN - FAILED - EXCLUSIVE ONLY\n");
+ pprintf(DD_OPEN, "parse: OPEN - FAILED - EXCLUSIVE ONLY\n");
return EBUSY;
}
@@ -346,10 +346,10 @@ parseopen(
return ENOMEM;
}
- pprintf(DD_OPEN, "parse: OPEN - parse area q=%x, q->q_ptr=%x\n", q, q->q_ptr);
+ pprintf(DD_OPEN, "parse: OPEN - parse area q=%x, q->q_ptr=%x\n", q, q->q_ptr);
WR(q)->q_ptr = q->q_ptr;
- pprintf(DD_OPEN, "parse: OPEN - WQ parse area q=%x, q->q_ptr=%x\n", WR(q), WR(q)->q_ptr);
-
+ pprintf(DD_OPEN, "parse: OPEN - WQ parse area q=%x, q->q_ptr=%x\n", WR(q), WR(q)->q_ptr);
+
parse = (parsestream_t *) q->q_ptr;
bzero((caddr_t)parse, sizeof(*parse));
parse->parse_queue = q;
@@ -360,7 +360,7 @@ parseopen(
qprocson(q);
- pprintf(DD_OPEN, "parse: OPEN - initializing io subsystem q=%x\n", q);
+ pprintf(DD_OPEN, "parse: OPEN - initializing io subsystem q=%x\n", q);
if (!parse_ioinit(&parse->parse_io))
{
@@ -374,12 +374,12 @@ parseopen(
return EIO;
}
- pprintf(DD_OPEN, "parse: OPEN - initializing stream q=%x\n", q);
+ pprintf(DD_OPEN, "parse: OPEN - initializing stream q=%x\n", q);
if (setup_stream(q, M_PARSE))
{
(void) init_linemon(q); /* hook up PPS ISR routines if possible */
- pprintf(DD_OPEN, "parse: OPEN - SUCCEEDED\n");
+ pprintf(DD_OPEN, "parse: OPEN - SUCCEEDED\n");
/*
* I know that you know the delete key, but you didn't write this
@@ -412,19 +412,19 @@ parseclose(
{
register parsestream_t *parse = (parsestream_t *)q->q_ptr;
register unsigned long s;
-
+
pprintf(DD_CLOSE, "parse: CLOSE\n");
-
+
qprocsoff(q);
s = splhigh();
-
+
if (parse->parse_dqueue)
close_linemon(parse->parse_dqueue, q);
parse->parse_dqueue = (queue_t *)0;
(void) splx(s);
-
+
parse_ioend(&parse->parse_io);
kmem_free((caddr_t)parse, sizeof(parsestream_t));
@@ -444,7 +444,7 @@ parsersvc(
)
{
mblk_t *mp;
-
+
while ((mp = getq(q)))
{
if (canputnext(q) || (mp->b_datap->db_type > QPCTL))
@@ -477,15 +477,15 @@ parsewput(
register mblk_t *datap;
register struct iocblk *iocp;
parsestream_t *parse = (parsestream_t *)q->q_ptr;
-
+
pprintf(DD_WPUT, "parse: parsewput\n");
-
+
switch (mp->b_datap->db_type)
{
default:
putnext(q, mp);
break;
-
+
case M_IOCTL:
iocp = (void *)mp->b_rptr;
switch (iocp->ioc_cmd)
@@ -519,7 +519,7 @@ parsewput(
iocp->ioc_count = sizeof(struct ppsclockev);
qreply(q, mp);
break;
-
+
case PARSEIOC_ENABLE:
case PARSEIOC_DISABLE:
{
@@ -537,7 +537,7 @@ parsewput(
}
qreply(q, mp);
break;
- }
+ }
case PARSEIOC_TIMECODE:
case PARSEIOC_SETFMT:
@@ -553,7 +553,7 @@ parsewput(
pprintf(DD_WPUT, "parse: parsewput - PARSEIOC_TIMECODE\n");
ok = parse_timecode(dct, &parse->parse_io);
break;
-
+
case PARSEIOC_SETFMT:
pprintf(DD_WPUT, "parse: parsewput - PARSEIOC_SETFMT\n");
ok = parse_setfmt(dct, &parse->parse_io);
@@ -600,7 +600,7 @@ rdchar(
else
{
register mblk_t *mmp = *mp;
-
+
*mp = (*mp)->b_cont;
freeb(mmp);
}
@@ -619,7 +619,7 @@ parserput(
{
register unsigned char type;
mblk_t *mp = imp;
-
+
switch (type = mp->b_datap->db_type)
{
default:
@@ -636,7 +636,7 @@ parserput(
else
putq(q, mp);
break;
-
+
case M_BREAK:
case M_DATA:
{
@@ -691,7 +691,7 @@ parserput(
if (nmp) freemsg(nmp);
parse_iodone(&parse->parse_io);
}
- }
+ }
}
else
{
@@ -733,7 +733,7 @@ parserput(
gethrestime(&hres_time);
c_time.tv.tv_sec = hres_time.tv_sec;
c_time.tv.tv_usec = hres_time.tv_nsec / 1000;
-
+
pprintf(DD_RPUT, "parse: parserput - M_%sHANGUP\n", (type == M_HANGUP) ? "" : "UN");
if ((parse->parse_status & PARSE_ENABLE) &&
@@ -758,7 +758,7 @@ parserput(
}
else
putq(q, mp);
-
+
if (status)
{
parse->parse_ppsclockev.tv = c_time.tv;
@@ -780,7 +780,7 @@ init_linemon(
)
{
register queue_t *dq;
-
+
dq = WR(q);
/*
* we ARE doing very bad things down here (basically stealing ISR
@@ -916,14 +916,14 @@ init_zs_linemon(
szs->zsops.zsop_xsint = (void (*) (struct zscom *))zs_xsisr; /* place our bastard */
szs->oldzsops = zs->zs_ops;
emergencyzs = zs->zs_ops;
-
+
zs->zs_ops = &szs->zsops; /* hook it up */
/*
- * XXX: this is usually done via zsopinit()
+ * XXX: this is usually done via zsopinit()
* - have yet to find a way to call that routine
*/
zs->zs_xsint = (void (*) (struct zscom *))zs_xsisr;
-
+
mutex_exit(zs->zs_excl);
pprintf(DD_INSTALL, "init_zs_linemon: CD monitor installed\n");
@@ -934,7 +934,7 @@ init_zs_linemon(
}
/*
- * unregister our ISR routine - must call under splhigh() (or
+ * unregister our ISR routine - must call under splhigh() (or
* whatever block ZS status interrupts)
*/
static void
@@ -970,7 +970,7 @@ close_zs_linemon(
mutex_exit(zs->zs_excl);
kmem_free((caddr_t)szs, sizeof (struct savedzsops));
-
+
pprintf(DD_INSTALL, "close_zs_linemon: CD monitor deleted\n");
return;
}
@@ -1005,7 +1005,7 @@ zs_xsisr(
{
timestamp_t cdevent;
register int status;
-
+
/*
* time stamp
*/
@@ -1024,7 +1024,7 @@ zs_xsisr(
* ok - now the hard part - find ourself
*/
loopcheck = MAXDEPTH;
-
+
while (q)
{
if (q->q_qinfo && q->q_qinfo->qi_minfo)
@@ -1052,7 +1052,7 @@ zs_xsisr(
*/
parse_iodone(&((parsestream_t *)q->q_ptr)->parse_io);
}
-
+
if (status)
{
((parsestream_t *)q->q_ptr)->parse_ppsclockev.tv = cdevent.tv;
@@ -1091,9 +1091,9 @@ zs_xsisr(
SCC_WRITE0(ZSWR0_RESET_STATUS); /* might kill other conditions here */
return;
}
- }
+ }
- pprintf(DD_ISR, "zs_xsisr: non CD event 0x%x for \"%s\"\n",
+ pprintf(DD_ISR, "zs_xsisr: non CD event 0x%x for \"%s\"\n",
(za->za_rr0 ^ zsstatus) & ~ZSRR0_CD,dname);
/*
* we are now gathered here to process some unusual external status
@@ -1108,7 +1108,7 @@ zs_xsisr(
q = za->za_ttycommon.t_readq;
loopcheck = MAXDEPTH;
-
+
/*
* the real thing for everything else ...
*/
@@ -1120,7 +1120,7 @@ zs_xsisr(
if (!strcmp(dname, parseinfo.st_rdinit->qi_minfo->mi_idname))
{
register void (*zsisr) (struct zscom *);
-
+
/*
* back home - phew (hopping along stream queues might
* prove dangerous to your health)
@@ -1129,7 +1129,7 @@ zs_xsisr(
zsisr(zs);
else
panic("zs_xsisr: unable to locate original ISR");
-
+
pprintf(DD_ISR, "zs_xsisr: non CD event was processed for \"%s\"\n", dname);
/*
* now back to our program ...
@@ -1151,7 +1151,7 @@ zs_xsisr(
* corrupted TTY structures
*/
printf("zs_zsisr: looking for \"%s\" - found \"%s\" - taking EMERGENCY path\n", parseinfo.st_rdinit->qi_minfo->mi_idname, dname ? dname : "-NIL-");
-
+
if (emergencyzs && emergencyzs->zsop_xsint)
emergencyzs->zsop_xsint(zs);
else
diff --git a/libparse/parsestreams.c b/libparse/parsestreams.c
index 3fb4cc3..6cd9d8f 100644
--- a/libparse/parsestreams.c
+++ b/libparse/parsestreams.c
@@ -1,13 +1,13 @@
/*
* /src/NTP/ntp4-dev/libparse/parsestreams.c,v 4.11 2005/04/16 17:32:10 kardel RELEASE_20050508_A
- *
+ *
* parsestreams.c,v 4.11 2005/04/16 17:32:10 kardel RELEASE_20050508_A
*
* STREAMS module for reference clocks
* (SunOS4.x)
*
* 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
+ * Copyright (c) 1989-1994 by Frank Kardel, Friedrich-Alexander Universitaet Erlangen-Nuernberg, Germany
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -110,7 +110,7 @@ static char mnam[] = "PARSEPPS "; /* name this baby - keep room for revision
#else
static char mnam[] = "PARSE "; /* name this baby - keep room for revision number */
#endif
-struct vdldrv parsesync_vd =
+struct vdldrv parsesync_vd =
{
VDMAGIC_PSEUDO, /* nothing like a real driver - a STREAMS module */
mnam,
@@ -166,7 +166,7 @@ Strcmp(
while (!(c = *s++ - *t++) && *s && *t)
/* empty loop */;
-
+
return c;
}
@@ -186,10 +186,10 @@ Strncmp(
while (n-- && !(c = *s++ - *t++) && *s && *t)
/* empty loop */;
-
+
return c;
}
-
+
void
ntp_memset(
char *a,
@@ -217,12 +217,12 @@ xxxinit(
{
extern struct fmodsw fmodsw[];
extern int fmodcnt;
-
+
struct fmodsw *fm = fmodsw;
struct fmodsw *fmend = &fmodsw[fmodcnt];
struct fmodsw *ifm = (struct fmodsw *)0;
char *mname = parseinfo.st_rdinit->qi_minfo->mi_idname;
-
+
switch (fc)
{
case VDLOAD:
@@ -233,13 +233,13 @@ xxxinit(
*/
while (fm <= fmend)
{
- if (!Strncmp(fm->f_name, mname, FMNAMESZ))
+ if (!Strncmp(fm->f_name, mname, FMNAMESZ))
{
printf("vddrinit[%s]: STREAMS module already loaded.\n", mname);
return(EBUSY);
}
else
- if ((ifm == (struct fmodsw *)0) &&
+ if ((ifm == (struct fmodsw *)0) &&
(fm->f_name[0] == '\0') &&
(fm->f_str == (struct streamtab *)0))
{
@@ -261,7 +261,7 @@ xxxinit(
{
static char revision[] = "4.7";
char *s, *S, *t;
-
+
s = rcsid; /* NOOP - keep compilers happy */
Strncpy(ifm->f_name, mname, FMNAMESZ);
@@ -285,20 +285,20 @@ xxxinit(
}
if (*s == ' ') s++;
}
-
- t = parsesync_vd.Drv_name;
+
+ t = parsesync_vd.Drv_name;
while (*t && (*t != ' '))
{
t++;
}
if (*t == ' ') t++;
-
+
S = s;
while (*S && (((*S >= '0') && (*S <= '9')) || (*S == '.')))
{
S++;
}
-
+
if (*s && *t && (S > s))
{
if (Strlen(t) >= (S - s))
@@ -307,9 +307,9 @@ xxxinit(
}
}
return (0);
- }
+ }
break;
-
+
case VDUNLOAD:
if (parsebusy > 0)
{
@@ -328,7 +328,7 @@ xxxinit(
fm->f_name[0] = '\0';
fm->f_str = (struct streamtab *)0;
fm++;
-
+
break;
}
fm++;
@@ -341,14 +341,14 @@ xxxinit(
else
return (0);
}
-
+
case VDSTAT:
return (0);
default:
return (EIO);
-
+
}
return EIO;
}
@@ -460,7 +460,7 @@ setup_stream(
}
else
{
- parseprintf(DD_OPEN,("parse: setup_stream - FAILED - no MEMORY for allocb\n"));
+ parseprintf(DD_OPEN,("parse: setup_stream - FAILED - no MEMORY for allocb\n"));
return 0;
}
}
@@ -476,37 +476,37 @@ parseopen(
{
register parsestream_t *parse;
static int notice = 0;
-
- parseprintf(DD_OPEN,("parse: OPEN\n"));
-
+
+ parseprintf(DD_OPEN,("parse: OPEN\n"));
+
if (sflag != MODOPEN)
{ /* open only for modules */
- parseprintf(DD_OPEN,("parse: OPEN - FAILED - not MODOPEN\n"));
+ parseprintf(DD_OPEN,("parse: OPEN - FAILED - not MODOPEN\n"));
return OPENFAIL;
}
if (q->q_ptr != (caddr_t)NULL)
{
u.u_error = EBUSY;
- parseprintf(DD_OPEN,("parse: OPEN - FAILED - EXCLUSIVE ONLY\n"));
+ parseprintf(DD_OPEN,("parse: OPEN - FAILED - EXCLUSIVE ONLY\n"));
return OPENFAIL;
}
#ifdef VDDRV
parsebusy++;
#endif
-
+
q->q_ptr = (caddr_t)kmem_alloc(sizeof(parsestream_t));
if (q->q_ptr == (caddr_t)0)
{
- parseprintf(DD_OPEN,("parse: OPEN - FAILED - no memory\n"));
+ parseprintf(DD_OPEN,("parse: OPEN - FAILED - no memory\n"));
#ifdef VDDRV
parsebusy--;
#endif
return OPENFAIL;
}
WR(q)->q_ptr = q->q_ptr;
-
+
parse = (parsestream_t *)(void *)q->q_ptr;
bzero((caddr_t)parse, sizeof(*parse));
parse->parse_queue = q;
@@ -531,7 +531,7 @@ parseopen(
{
(void) init_linemon(q); /* hook up PPS ISR routines if possible */
- parseprintf(DD_OPEN,("parse: OPEN - SUCCEEDED\n"));
+ parseprintf(DD_OPEN,("parse: OPEN - SUCCEEDED\n"));
/*
* I know that you know the delete key, but you didn't write this
@@ -569,17 +569,17 @@ parseclose(
{
register parsestream_t *parse = (parsestream_t *)(void *)q->q_ptr;
register unsigned long s;
-
+
parseprintf(DD_CLOSE,("parse: CLOSE\n"));
-
+
s = splhigh();
-
+
if (parse->parse_dqueue)
close_linemon(parse->parse_dqueue, q);
parse->parse_dqueue = (queue_t *)0;
(void) splx(s);
-
+
parse_ioend(&parse->parse_io);
kmem_free((caddr_t)parse, sizeof(parsestream_t));
@@ -602,7 +602,7 @@ parsersvc(
)
{
mblk_t *mp;
-
+
while ((mp = getq(q)))
{
if (canput(q->q_next) || (mp->b_datap->db_type > QPCTL))
@@ -635,15 +635,15 @@ parsewput(
register mblk_t *datap;
register struct iocblk *iocp;
parsestream_t *parse = (parsestream_t *)(void *)q->q_ptr;
-
+
parseprintf(DD_WPUT,("parse: parsewput\n"));
-
+
switch (mp->b_datap->db_type)
{
default:
putnext(q, mp);
break;
-
+
case M_IOCTL:
iocp = (struct iocblk *)(void *)mp->b_rptr;
switch (iocp->ioc_cmd)
@@ -676,7 +676,7 @@ parsewput(
iocp->ioc_count = sizeof(struct ppsclockev);
qreply(q, mp);
break;
-
+
case PARSEIOC_ENABLE:
case PARSEIOC_DISABLE:
{
@@ -694,7 +694,7 @@ parsewput(
}
qreply(q, mp);
break;
- }
+ }
case PARSEIOC_TIMECODE:
case PARSEIOC_SETFMT:
@@ -710,7 +710,7 @@ parsewput(
parseprintf(DD_WPUT,("parse: parsewput - PARSEIOC_TIMECODE\n"));
ok = parse_timecode(dct, &parse->parse_io);
break;
-
+
case PARSEIOC_SETFMT:
parseprintf(DD_WPUT,("parse: parsewput - PARSEIOC_SETFMT\n"));
ok = parse_setfmt(dct, &parse->parse_io);
@@ -757,7 +757,7 @@ rdchar(
else
{
register mblk_t *mmp = *mp;
-
+
*mp = (*mp)->b_cont;
freeb(mmp);
}
@@ -775,7 +775,7 @@ parserput(
)
{
unsigned char type;
-
+
switch (type = mp->b_datap->db_type)
{
default:
@@ -791,7 +791,7 @@ parserput(
else
putq(q, mp);
break;
-
+
case M_BREAK:
case M_DATA:
{
@@ -844,7 +844,7 @@ parserput(
if (nmp) freemsg(nmp);
parse_iodone(&parse->parse_io);
}
- }
+ }
}
else
{
@@ -883,7 +883,7 @@ parserput(
register int status = cd_invert ^ (type == M_UNHANGUP);
uniqtime(&ctime.tv);
-
+
parseprintf(DD_RPUT,("parse: parserput - M_%sHANGUP\n", (type == M_HANGUP) ? "" : "UN"));
if ((parse->parse_status & PARSE_ENABLE) &&
@@ -908,7 +908,7 @@ parserput(
}
else
putq(q, mp);
-
+
if (status)
{
parse->parse_ppsclockev.tv = ctime.tv;
@@ -930,7 +930,7 @@ init_linemon(
)
{
register queue_t *dq;
-
+
dq = WR(q);
/*
* we ARE doing very bad things down here (basically stealing ISR
@@ -1038,7 +1038,7 @@ init_zs_linemon(
else
{
unsigned long s;
-
+
/*
* we do a direct replacement, in case others fiddle also
* if somebody else grabs our hook and we disconnect
@@ -1064,9 +1064,9 @@ init_zs_linemon(
szs->zsops.zsop_xsint = zs_xsisr; /* place our bastard */
szs->oldzsops = zs->zs_ops;
emergencyzs = zs->zs_ops;
-
+
zsopinit(zs, &szs->zsops); /* hook it up */
-
+
(void) splx(s);
parseprintf(DD_INSTALL, ("init_zs_linemon: CD monitor installed\n"));
@@ -1099,11 +1099,11 @@ close_zs_linemon(
else
{
register struct savedzsops *szs = (struct savedzsops *)parsestream->parse_data;
-
+
zsopinit(zs, szs->oldzsops); /* reset to previous handler functions */
kmem_free((caddr_t)szs, sizeof (struct savedzsops));
-
+
parseprintf(DD_INSTALL, ("close_zs_linemon: CD monitor deleted\n"));
return;
}
@@ -1148,7 +1148,7 @@ zs_xsisr(
{
timestamp_t cdevent;
register int status;
-
+
za->za_rr0 = (za->za_rr0 & ~(cdmask)) | (zsstatus & (cdmask));
#ifdef PPS_SYNC
@@ -1163,7 +1163,7 @@ zs_xsisr(
* time stamp
*/
uniqtime(&cdevent.tv);
-
+
#ifdef PPS_SYNC
(void)splx(s);
#endif
@@ -1190,7 +1190,7 @@ zs_xsisr(
* ok - now the hard part - find ourself
*/
loopcheck = MAXDEPTH;
-
+
while (q)
{
if (q->q_qinfo && q->q_qinfo->qi_minfo)
@@ -1218,7 +1218,7 @@ zs_xsisr(
*/
parse_iodone(&((parsestream_t *)(void *)q->q_ptr)->parse_io);
}
-
+
if (status)
{
((parsestream_t *)(void *)q->q_ptr)->parse_ppsclockev.tv = cdevent.tv;
@@ -1251,13 +1251,13 @@ zs_xsisr(
zsaddr->zscc_control = ZSWR0_RESET_STATUS; /* might kill other conditions here */
return 0;
}
- }
+ }
if (zsstatus & cdmask) /* fake CARRIER status */
za->za_flags |= ZAS_CARR_ON;
else
za->za_flags &= ~ZAS_CARR_ON;
-
+
/*
* we are now gathered here to process some unusual external status
* interrupts.
@@ -1271,7 +1271,7 @@ zs_xsisr(
q = za->za_ttycommon.t_readq;
loopcheck = MAXDEPTH;
-
+
/*
* the real thing for everything else ...
*/
@@ -1283,7 +1283,7 @@ zs_xsisr(
if (!Strcmp(dname, parseinfo.st_rdinit->qi_minfo->mi_idname))
{
register int (*zsisr) (struct zscom *);
-
+
/*
* back home - phew (hopping along stream queues might
* prove dangerous to your health)
@@ -1292,7 +1292,7 @@ zs_xsisr(
return zsisr(zs);
else
panic("zs_xsisr: unable to locate original ISR");
-
+
parseprintf(DD_ISR, ("zs_xsisr: non CD event was processed for \"%s\"\n", dname));
/*
* now back to our program ...
@@ -1314,7 +1314,7 @@ zs_xsisr(
* corrupted TTY structures
*/
printf("zs_zsisr: looking for \"%s\" - found \"%s\" - taking EMERGENCY path\n", parseinfo.st_rdinit->qi_minfo->mi_idname, dname ? dname : "-NIL-");
-
+
if (emergencyzs && emergencyzs->zsop_xsint)
emergencyzs->zsop_xsint(zs);
else
diff --git a/libparse/trim_info.c b/libparse/trim_info.c
index 619e238..4178209 100644
--- a/libparse/trim_info.c
+++ b/libparse/trim_info.c
@@ -6,7 +6,7 @@
* $Created: Sun Aug 2 20:20:34 1998 $
*
* 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
+ * Copyright (c) 1989-1994 by Frank Kardel, Friedrich-Alexander Universitaet Erlangen-Nuernberg, Germany
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions