summaryrefslogtreecommitdiffstats
path: root/usr.sbin/xntpd/lib
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>1994-09-29 23:04:24 +0000
committerwollman <wollman@FreeBSD.org>1994-09-29 23:04:24 +0000
commit1cba639cb2d728cbbb3866d923f8826a01269414 (patch)
tree18dfbc130c063c415f026919cb34f9b7d2c18322 /usr.sbin/xntpd/lib
parent2bf66335a61004f895541f2c64c7fb1508224e34 (diff)
parent96f7e86b724c797f2b44beaaf956cf14550e57df (diff)
downloadFreeBSD-src-1cba639cb2d728cbbb3866d923f8826a01269414.zip
FreeBSD-src-1cba639cb2d728cbbb3866d923f8826a01269414.tar.gz
This commit was generated by cvs2svn to compensate for changes in r3215,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'usr.sbin/xntpd/lib')
-rw-r--r--usr.sbin/xntpd/lib/Makefile.tmpl2
-rw-r--r--usr.sbin/xntpd/lib/a_md512crypt.c9
-rw-r--r--usr.sbin/xntpd/lib/a_md5decrypt.c7
-rw-r--r--usr.sbin/xntpd/lib/a_md5encrypt.c7
-rw-r--r--usr.sbin/xntpd/lib/atoint.c10
-rw-r--r--usr.sbin/xntpd/lib/atolfp.c14
-rw-r--r--usr.sbin/xntpd/lib/atouint.c6
-rw-r--r--usr.sbin/xntpd/lib/auth12crypt.c8
-rw-r--r--usr.sbin/xntpd/lib/authdecrypt.c11
-rw-r--r--usr.sbin/xntpd/lib/authdes.c2
-rw-r--r--usr.sbin/xntpd/lib/authencrypt.c6
-rw-r--r--usr.sbin/xntpd/lib/authkeys.c31
-rw-r--r--usr.sbin/xntpd/lib/authparity.c2
-rw-r--r--usr.sbin/xntpd/lib/authreadkeys.c16
-rw-r--r--usr.sbin/xntpd/lib/authusekey.c4
-rw-r--r--usr.sbin/xntpd/lib/buftvtots.c40
-rw-r--r--usr.sbin/xntpd/lib/caljulian.c6
-rw-r--r--usr.sbin/xntpd/lib/calleapwhen.c18
-rw-r--r--usr.sbin/xntpd/lib/caltontp.c16
-rw-r--r--usr.sbin/xntpd/lib/calyearstart.c12
-rw-r--r--usr.sbin/xntpd/lib/clocktime.c26
-rw-r--r--usr.sbin/xntpd/lib/clocktypes.c80
-rw-r--r--usr.sbin/xntpd/lib/decodenetnum.c4
-rw-r--r--usr.sbin/xntpd/lib/dofptoa.c4
-rw-r--r--usr.sbin/xntpd/lib/dolfptoa.c55
-rw-r--r--usr.sbin/xntpd/lib/emalloc.c4
-rw-r--r--usr.sbin/xntpd/lib/fptoa.c2
-rw-r--r--usr.sbin/xntpd/lib/fptoms.c2
-rw-r--r--usr.sbin/xntpd/lib/getopt.c2
-rw-r--r--usr.sbin/xntpd/lib/gettstamp.c2
-rw-r--r--usr.sbin/xntpd/lib/hextoint.c6
-rw-r--r--usr.sbin/xntpd/lib/hextolfp.c6
-rw-r--r--usr.sbin/xntpd/lib/humandate.c8
-rw-r--r--usr.sbin/xntpd/lib/inttoa.c6
-rw-r--r--usr.sbin/xntpd/lib/lib_strbuf.c2
-rw-r--r--usr.sbin/xntpd/lib/lib_strbuf.h2
-rw-r--r--usr.sbin/xntpd/lib/machines.c18
-rw-r--r--usr.sbin/xntpd/lib/md5.c2
-rw-r--r--usr.sbin/xntpd/lib/mfptoa.c8
-rw-r--r--usr.sbin/xntpd/lib/mfptoms.c8
-rw-r--r--usr.sbin/xntpd/lib/modetoa.c2
-rw-r--r--usr.sbin/xntpd/lib/mstolfp.c2
-rw-r--r--usr.sbin/xntpd/lib/msutotsf.c6
-rw-r--r--usr.sbin/xntpd/lib/netof.c9
-rw-r--r--usr.sbin/xntpd/lib/numtoa.c12
-rw-r--r--usr.sbin/xntpd/lib/numtohost.c2
-rw-r--r--usr.sbin/xntpd/lib/octtoint.c6
-rw-r--r--usr.sbin/xntpd/lib/prettydate.c18
-rw-r--r--usr.sbin/xntpd/lib/ranny.c40
-rw-r--r--usr.sbin/xntpd/lib/refnumtoa.c18
-rw-r--r--usr.sbin/xntpd/lib/systime.c36
-rw-r--r--usr.sbin/xntpd/lib/tsftomsu.c8
-rw-r--r--usr.sbin/xntpd/lib/tstotv.c8
-rw-r--r--usr.sbin/xntpd/lib/tvtoa.c6
-rw-r--r--usr.sbin/xntpd/lib/tvtots.c8
-rw-r--r--usr.sbin/xntpd/lib/uglydate.c14
-rw-r--r--usr.sbin/xntpd/lib/uinttoa.c6
-rw-r--r--usr.sbin/xntpd/lib/utvtoa.c6
58 files changed, 345 insertions, 336 deletions
diff --git a/usr.sbin/xntpd/lib/Makefile.tmpl b/usr.sbin/xntpd/lib/Makefile.tmpl
index 997aa8c..1a8d020 100644
--- a/usr.sbin/xntpd/lib/Makefile.tmpl
+++ b/usr.sbin/xntpd/lib/Makefile.tmpl
@@ -1,5 +1,5 @@
#
-# Makefile.tmpl,v 3.1 1993/07/06 01:07:38 jbj Exp
+# Makefile.tmpl
#
LIBNAME= libntp
#
diff --git a/usr.sbin/xntpd/lib/a_md512crypt.c b/usr.sbin/xntpd/lib/a_md512crypt.c
index 6033ded..e3705c0 100644
--- a/usr.sbin/xntpd/lib/a_md512crypt.c
+++ b/usr.sbin/xntpd/lib/a_md512crypt.c
@@ -1,4 +1,4 @@
-/* authmd512crypt.c,v 3.1 1993/07/06 01:07:52 jbj Exp
+/*
* md5crypt - MD5 based authentication routines
*/
@@ -7,7 +7,7 @@
#include "md5.h"
#include "ntp_stdlib.h"
-extern U_LONG cache_keyid;
+extern u_long cache_keyid;
extern char *cache_key;
extern int cache_keylen;
@@ -17,7 +17,6 @@ extern int cache_keylen;
extern U_LONG authencryptions;
extern U_LONG authdecryptions;
extern U_LONG authkeyuncached;
-extern U_LONG authdecryptok;
extern U_LONG authnokey;
/*
@@ -41,7 +40,7 @@ static MD5_CTX ctx;
void
MD5auth1crypt(keyno, pkt, length)
- U_LONG keyno;
+ u_long keyno;
U_LONG *pkt;
int length; /* length of all encrypted data */
{
@@ -67,7 +66,7 @@ MD5auth1crypt(keyno, pkt, length)
*/
int
MD5auth2crypt(keyno, pkt, length)
- U_LONG keyno;
+ u_long keyno;
U_LONG *pkt;
int length; /* total length of encrypted area */
{
diff --git a/usr.sbin/xntpd/lib/a_md5decrypt.c b/usr.sbin/xntpd/lib/a_md5decrypt.c
index dc7acf6..bde17c0 100644
--- a/usr.sbin/xntpd/lib/a_md5decrypt.c
+++ b/usr.sbin/xntpd/lib/a_md5decrypt.c
@@ -1,4 +1,4 @@
-/* authmd5decrypt.c,v 3.1 1993/07/06 01:07:53 jbj Exp
+/*
* md5crypt - MD5 based authentication routines
*/
@@ -7,7 +7,7 @@
#include "md5.h"
#include "ntp_stdlib.h"
-extern U_LONG cache_keyid;
+extern u_long cache_keyid;
extern char *cache_key;
extern int cache_keylen;
@@ -17,7 +17,6 @@ extern int cache_keylen;
extern U_LONG authencryptions;
extern U_LONG authdecryptions;
extern U_LONG authkeyuncached;
-extern U_LONG authdecryptok;
extern U_LONG authnokey;
/*
@@ -35,7 +34,7 @@ extern U_LONG authnokey;
int
MD5authdecrypt(keyno, pkt, length)
- U_LONG keyno;
+ u_long keyno;
const U_LONG *pkt;
int length; /* length of variable data in octets */
{
diff --git a/usr.sbin/xntpd/lib/a_md5encrypt.c b/usr.sbin/xntpd/lib/a_md5encrypt.c
index 2ae6258..0d816dc 100644
--- a/usr.sbin/xntpd/lib/a_md5encrypt.c
+++ b/usr.sbin/xntpd/lib/a_md5encrypt.c
@@ -1,4 +1,4 @@
-/* authmd5encrypt.c,v 3.1 1993/07/06 01:07:54 jbj Exp
+/*
* md5crypt - MD5 based authentication routines
*/
@@ -7,7 +7,7 @@
#include "md5.h"
#include "ntp_stdlib.h"
-extern U_LONG cache_keyid;
+extern u_long cache_keyid;
extern char *cache_key;
extern int cache_keylen;
@@ -17,7 +17,6 @@ extern int cache_keylen;
extern U_LONG authencryptions;
extern U_LONG authdecryptions;
extern U_LONG authkeyuncached;
-extern U_LONG authdecryptok;
extern U_LONG authnokey;
/*
@@ -36,7 +35,7 @@ extern U_LONG authnokey;
int
MD5authencrypt(keyno, pkt, length)
- U_LONG keyno;
+ u_long keyno;
U_LONG *pkt;
int length; /* length of encrypted portion of packet */
{
diff --git a/usr.sbin/xntpd/lib/atoint.c b/usr.sbin/xntpd/lib/atoint.c
index 0e8ea8f..33b5c5d 100644
--- a/usr.sbin/xntpd/lib/atoint.c
+++ b/usr.sbin/xntpd/lib/atoint.c
@@ -1,4 +1,4 @@
-/* atoint.c,v 3.1 1993/07/06 01:07:39 jbj Exp
+/*
* atoint - convert an ascii string to a signed long, with error checking
*/
#include <sys/types.h>
@@ -9,9 +9,9 @@
int
atoint(str, ival)
const char *str;
- LONG *ival;
+ long *ival;
{
- register U_LONG u;
+ register long u;
register const char *cp;
register int isneg;
register int oflow_digit;
@@ -41,8 +41,8 @@ atoint(str, ival)
}
if (isneg)
- *ival = -((LONG)u);
+ *ival = -u;
else
- *ival = (LONG)u;
+ *ival = u;
return 1;
}
diff --git a/usr.sbin/xntpd/lib/atolfp.c b/usr.sbin/xntpd/lib/atolfp.c
index 9e2d883..649303e 100644
--- a/usr.sbin/xntpd/lib/atolfp.c
+++ b/usr.sbin/xntpd/lib/atolfp.c
@@ -1,4 +1,4 @@
-/* atolfp.c,v 3.1 1993/07/06 01:07:40 jbj Exp
+/*
* atolfp - convert an ascii string to an l_fp number
*/
#include <stdio.h>
@@ -10,7 +10,7 @@
/*
* Powers of 10
*/
-static U_LONG ten_to_the_n[10] = {
+static u_long ten_to_the_n[10] = {
0,
10,
100,
@@ -30,8 +30,8 @@ atolfp(str, lfp)
l_fp *lfp;
{
register const char *cp;
- register U_LONG dec_i;
- register U_LONG dec_f;
+ register u_long dec_i;
+ register u_long dec_f;
char *ind;
int ndec;
int isneg;
@@ -87,9 +87,9 @@ atolfp(str, lfp)
}
if (ndec > 0) {
- register U_LONG tmp;
- register U_LONG bit;
- register U_LONG ten_fact;
+ register u_long tmp;
+ register u_long bit;
+ register u_long ten_fact;
ten_fact = ten_to_the_n[ndec];
diff --git a/usr.sbin/xntpd/lib/atouint.c b/usr.sbin/xntpd/lib/atouint.c
index b27653f..d826bb4 100644
--- a/usr.sbin/xntpd/lib/atouint.c
+++ b/usr.sbin/xntpd/lib/atouint.c
@@ -1,4 +1,4 @@
-/* atouint.c,v 3.1 1993/07/06 01:07:42 jbj Exp
+/*
* atouint - convert an ascii string to an unsigned long, with error checking
*/
#include <sys/types.h>
@@ -9,9 +9,9 @@
int
atouint(str, uval)
const char *str;
- U_LONG *uval;
+ u_long *uval;
{
- register U_LONG u;
+ register u_long u;
register const char *cp;
cp = str;
diff --git a/usr.sbin/xntpd/lib/auth12crypt.c b/usr.sbin/xntpd/lib/auth12crypt.c
index a5d9889..0e69dbe 100644
--- a/usr.sbin/xntpd/lib/auth12crypt.c
+++ b/usr.sbin/xntpd/lib/auth12crypt.c
@@ -1,4 +1,4 @@
-/* auth12crypt.c,v 3.1 1993/07/06 01:07:43 jbj Exp
+/*
* auth12crypt.c - routines to support two stage NTP encryption
*/
#include "ntp_stdlib.h"
@@ -21,7 +21,7 @@
/*
* Imported from the key data base module
*/
-extern U_LONG cache_keyid; /* cached key ID */
+extern u_long cache_keyid; /* cached key ID */
extern u_char DEScache_ekeys[]; /* cached decryption keys */
extern u_char DESzeroekeys[]; /* zero key decryption keys */
@@ -38,7 +38,7 @@ extern U_LONG authnokey;
*/
void
DESauth1crypt(keyno, pkt, length)
- U_LONG keyno;
+ u_long keyno;
U_LONG *pkt;
int length; /* length of all encrypted data */
{
@@ -91,7 +91,7 @@ DESauth1crypt(keyno, pkt, length)
*/
int
DESauth2crypt(keyno, pkt, length)
- U_LONG keyno;
+ u_long keyno;
U_LONG *pkt;
int length; /* total length of encrypted area */
{
diff --git a/usr.sbin/xntpd/lib/authdecrypt.c b/usr.sbin/xntpd/lib/authdecrypt.c
index 7ff1129..7462941 100644
--- a/usr.sbin/xntpd/lib/authdecrypt.c
+++ b/usr.sbin/xntpd/lib/authdecrypt.c
@@ -1,4 +1,4 @@
-/* authdecrypt.c,v 3.1 1993/07/06 01:07:44 jbj Exp
+/*
* authdecrypt - routine to decrypt a packet to see if this guy knows our key.
*/
#include "ntp_stdlib.h"
@@ -19,7 +19,7 @@
/*
* Imported from the key data base module
*/
-extern U_LONG cache_keyid; /* cached key ID */
+extern u_long cache_keyid; /* cached key ID */
extern u_char DEScache_dkeys[]; /* cached decryption keys */
extern u_char DESzerodkeys[]; /* zero key decryption keys */
@@ -28,11 +28,10 @@ extern u_char DESzerodkeys[]; /* zero key decryption keys */
*/
extern U_LONG authdecryptions;
extern U_LONG authkeyuncached;
-extern U_LONG authdecryptok;
int
DESauthdecrypt(keyno, pkt, length)
- U_LONG keyno;
+ u_long keyno;
const U_LONG *pkt;
int length; /* length of variable data in octets */
{
@@ -77,9 +76,7 @@ DESauthdecrypt(keyno, pkt, length)
/*
* Success if the encryption data is zero
*/
- if ((work[0] == 0) && (work[1] == 0)) {
- authdecryptok++;
+ if ((work[0] == 0) && (work[1] == 0))
return 1;
- }
return 0;
}
diff --git a/usr.sbin/xntpd/lib/authdes.c b/usr.sbin/xntpd/lib/authdes.c
index 9f64c40..dd122de 100644
--- a/usr.sbin/xntpd/lib/authdes.c
+++ b/usr.sbin/xntpd/lib/authdes.c
@@ -1,4 +1,4 @@
-/* authdes.c,v 3.1 1993/07/06 01:07:45 jbj Exp
+/*
* authdes.c - an implementation of the DES cipher algorithm for NTP
*/
#include "ntp_stdlib.h"
diff --git a/usr.sbin/xntpd/lib/authencrypt.c b/usr.sbin/xntpd/lib/authencrypt.c
index 66b5281..eb203e4 100644
--- a/usr.sbin/xntpd/lib/authencrypt.c
+++ b/usr.sbin/xntpd/lib/authencrypt.c
@@ -1,4 +1,4 @@
-/* authencrypt.c,v 3.1 1993/07/06 01:07:50 jbj Exp
+/*
* authencrypt - compute and encrypt the mac field in an NTP packet
*/
#include "ntp_stdlib.h"
@@ -19,7 +19,7 @@
/*
* Imported from the key data base module
*/
-extern U_LONG cache_keyid; /* cached key ID */
+extern u_long cache_keyid; /* cached key ID */
extern u_char DEScache_ekeys[]; /* cached decryption keys */
extern u_char DESzeroekeys[]; /* zero key decryption keys */
@@ -32,7 +32,7 @@ extern U_LONG authnokey;
int
DESauthencrypt(keyno, pkt, length)
- U_LONG keyno;
+ u_long keyno;
U_LONG *pkt;
int length; /* length of encrypted portion of packet */
{
diff --git a/usr.sbin/xntpd/lib/authkeys.c b/usr.sbin/xntpd/lib/authkeys.c
index 743af83..8e590ce 100644
--- a/usr.sbin/xntpd/lib/authkeys.c
+++ b/usr.sbin/xntpd/lib/authkeys.c
@@ -1,4 +1,4 @@
-/* authkeys.c,v 3.1 1993/07/06 01:07:51 jbj Exp
+/*
* authkeys.c - routines to manage the storage of authentication keys
*/
#include <stdio.h>
@@ -21,7 +21,7 @@ struct savekey {
char MD5_key[32];
#endif
} k;
- U_LONG keyid;
+ u_long keyid;
u_short flags;
#ifdef MD5
int keylen;
@@ -57,7 +57,6 @@ U_LONG authkeyuncached;
U_LONG authnokey; /* calls to encrypt with no key */
U_LONG authencryptions;
U_LONG authdecryptions;
-U_LONG authdecryptok;
/*
* Storage for free key structures. We malloc() such things but
@@ -90,7 +89,7 @@ u_char DEScache_dkeys[KEY_SCHED_SIZE];
/*
* The key cache. We cache the last key we looked at here.
*/
-U_LONG cache_keyid;
+u_long cache_keyid;
u_short cache_flags;
#ifdef MD5
@@ -114,7 +113,7 @@ init_auth()
authnumfreekeys = authkeynotfound = authkeylookups = 0;
authnumkeys = authuncached = authkeyuncached = authnokey = 0;
- authencryptions = authdecryptions = authdecryptok = 0;
+ authencryptions = authdecryptions = 0;
#ifdef DES
/*
@@ -133,7 +132,7 @@ init_auth()
*/
struct savekey *
auth_findkey(keyno)
- U_LONG keyno;
+ u_long keyno;
{
register struct savekey *sk;
@@ -152,7 +151,7 @@ auth_findkey(keyno)
*/
int
auth_havekey(keyno)
- U_LONG keyno;
+ u_long keyno;
{
register struct savekey *sk;
@@ -182,7 +181,7 @@ auth_havekey(keyno)
*/
int
authhavekey(keyno)
- U_LONG keyno;
+ u_long keyno;
{
register struct savekey *sk;
@@ -249,7 +248,7 @@ auth_moremem()
*/
void
authtrust(keyno, trust)
- U_LONG keyno;
+ u_long keyno;
int trust;
{
register struct savekey *sk;
@@ -316,7 +315,7 @@ authtrust(keyno, trust)
*/
int
authistrusted(keyno)
- U_LONG keyno;
+ u_long keyno;
{
register struct savekey *sk;
@@ -345,7 +344,7 @@ authistrusted(keyno)
*/
void
DESauth_setkey(keyno, key)
- U_LONG keyno;
+ u_long keyno;
const U_LONG *key;
{
register struct savekey *sk;
@@ -393,7 +392,7 @@ DESauth_setkey(keyno, key)
#ifdef MD5
void
MD5auth_setkey(keyno, key)
- U_LONG keyno;
+ u_long keyno;
const U_LONG *key;
{
register struct savekey *sk;
@@ -487,7 +486,7 @@ auth_delkeys()
*/
void
auth1crypt(keyno, pkt, length)
- U_LONG keyno;
+ u_long keyno;
U_LONG *pkt;
int length; /* length of all encrypted data */
{
@@ -520,7 +519,7 @@ auth1crypt(keyno, pkt, length)
*/
int
auth2crypt(keyno, pkt, length)
- U_LONG keyno;
+ u_long keyno;
U_LONG *pkt;
int length; /* total length of encrypted area */
{
@@ -547,7 +546,7 @@ auth2crypt(keyno, pkt, length)
int
authencrypt(keyno, pkt, length)
- U_LONG keyno;
+ u_long keyno;
U_LONG *pkt;
int length; /* length of encrypted portion of packet */
{
@@ -576,7 +575,7 @@ authencrypt(keyno, pkt, length)
int
authdecrypt(keyno, pkt, length)
- U_LONG keyno;
+ u_long keyno;
U_LONG *pkt;
int length; /* length of variable data in octets */
{
diff --git a/usr.sbin/xntpd/lib/authparity.c b/usr.sbin/xntpd/lib/authparity.c
index 33562cb..a5b59e3 100644
--- a/usr.sbin/xntpd/lib/authparity.c
+++ b/usr.sbin/xntpd/lib/authparity.c
@@ -1,4 +1,4 @@
-/* authparity.c,v 3.1 1993/07/06 01:07:55 jbj Exp
+/*
* auth_parity - set parity on a key/check for odd parity
*/
#include "ntp_stdlib.h"
diff --git a/usr.sbin/xntpd/lib/authreadkeys.c b/usr.sbin/xntpd/lib/authreadkeys.c
index 5800186..8d2697f 100644
--- a/usr.sbin/xntpd/lib/authreadkeys.c
+++ b/usr.sbin/xntpd/lib/authreadkeys.c
@@ -1,4 +1,4 @@
-/* authreadkeys.c,v 3.1 1993/07/06 01:07:57 jbj Exp
+/*
* authreadkeys.c - routines to support the reading of the key file
*/
#include <stdio.h>
@@ -80,7 +80,7 @@ authreadkeys(file)
FILE *fp;
char *line;
char *token;
- U_LONG keyno;
+ u_long keyno;
int keytype;
char buf[512]; /* lots of room for line? */
extern FILE * fopen P((const char *filename, const char *type));
@@ -111,7 +111,7 @@ extern int fclose P((FILE *stream));
/*
* First is key number. See if it is okay.
*/
- keyno = (U_LONG)atoi(token);
+ keyno = atoi(token);
if (keyno == 0) {
syslog(LOG_ERR,
"cannot change keyid 0, key entry `%s' ignored",
@@ -125,7 +125,7 @@ extern int fclose P((FILE *stream));
token = nexttok(&line);
if (token == 0) {
syslog(LOG_ERR,
- "no key type for key number %d, entry ignored",
+ "no key type for key number %ld, entry ignored",
keyno);
continue;
}
@@ -150,7 +150,7 @@ extern int fclose P((FILE *stream));
#endif
default:
syslog(LOG_ERR,
- "invalid key type for key number %d, entry ignored",
+ "invalid key type for key number %ld, entry ignored",
keyno);
continue;
}
@@ -161,7 +161,7 @@ extern int fclose P((FILE *stream));
token = nexttok(&line);
if (token == 0) {
syslog(LOG_ERR,
- "no key for number %d entry, entry ignored",
+ "no key for number %ld entry, entry ignored",
keyno);
} else {
switch(keytype) {
@@ -171,7 +171,7 @@ extern int fclose P((FILE *stream));
case KEY_TYPE_ASCII:
if (!authusekey(keyno, keytype, token))
syslog(LOG_ERR,
- "format/parity error for DES key %d, not used",
+ "format/parity error for DES key %ld, not used",
keyno);
break;
#endif
@@ -179,7 +179,7 @@ extern int fclose P((FILE *stream));
case KEY_TYPE_MD5:
if (!authusekey(keyno, keytype, token))
syslog(LOG_ERR,
- "format/parity error for MD5 key %d, not used",
+ "format/parity error for MD5 key %ld, not used",
keyno);
break;
#endif
diff --git a/usr.sbin/xntpd/lib/authusekey.c b/usr.sbin/xntpd/lib/authusekey.c
index c268c4d..20d7f3c 100644
--- a/usr.sbin/xntpd/lib/authusekey.c
+++ b/usr.sbin/xntpd/lib/authusekey.c
@@ -1,4 +1,4 @@
-/* authusekey.c,v 3.1 1993/07/06 01:07:58 jbj Exp
+/*
* authusekey - decode a key from ascii and use it
*/
#include <stdio.h>
@@ -30,7 +30,7 @@
int
authusekey(keyno, keytype, str)
- U_LONG keyno;
+ u_long keyno;
int keytype;
const char *str;
{
diff --git a/usr.sbin/xntpd/lib/buftvtots.c b/usr.sbin/xntpd/lib/buftvtots.c
index d9b484d..7e1ec63 100644
--- a/usr.sbin/xntpd/lib/buftvtots.c
+++ b/usr.sbin/xntpd/lib/buftvtots.c
@@ -1,4 +1,4 @@
-/* buftvtots.c,v 3.1 1993/07/06 01:07:59 jbj Exp
+/*
* buftvtots - pull a Unix-format (struct timeval) time stamp out of
* an octet stream and convert it to a l_fp time stamp.
* This is useful when using the clock line discipline.
@@ -12,50 +12,50 @@ buftvtots(bufp, ts)
l_fp *ts;
{
register const u_char *bp;
- register U_LONG sec;
- register U_LONG usec;
+ register u_long sec;
+ register u_long usec;
#ifdef XNTP_BIG_ENDIAN
bp = (u_char *)bufp;
- sec = (U_LONG)*bp++ & 0xff;
+ sec = (u_long)*bp++ & 0xff;
sec <<= 8;
- sec += (U_LONG)*bp++ & 0xff;
+ sec += (u_long)*bp++ & 0xff;
sec <<= 8;
- sec += (U_LONG)*bp++ & 0xff;
+ sec += (u_long)*bp++ & 0xff;
sec <<= 8;
- sec += (U_LONG)*bp++ & 0xff;
+ sec += (u_long)*bp++ & 0xff;
- usec = (U_LONG)*bp++ & 0xff;
+ usec = (u_long)*bp++ & 0xff;
usec <<= 8;
- usec += (U_LONG)*bp++ & 0xff;
+ usec += (u_long)*bp++ & 0xff;
usec <<= 8;
- usec += (U_LONG)*bp++ & 0xff;
+ usec += (u_long)*bp++ & 0xff;
usec <<= 8;
- usec += (U_LONG)*bp & 0xff;
+ usec += (u_long)*bp & 0xff;
#else
bp = (u_char *)bufp + 7;
- usec = (U_LONG)*bp-- & 0xff;
+ usec = (u_long)*bp-- & 0xff;
usec <<= 8;
- usec += (U_LONG)*bp-- & 0xff;
+ usec += (u_long)*bp-- & 0xff;
usec <<= 8;
- usec += (U_LONG)*bp-- & 0xff;
+ usec += (u_long)*bp-- & 0xff;
usec <<= 8;
- usec += (U_LONG)*bp-- & 0xff;
+ usec += (u_long)*bp-- & 0xff;
- sec = (U_LONG)*bp-- & 0xff;
+ sec = (u_long)*bp-- & 0xff;
sec <<= 8;
- sec += (U_LONG)*bp-- & 0xff;
+ sec += (u_long)*bp-- & 0xff;
sec <<= 8;
- sec += (U_LONG)*bp-- & 0xff;
+ sec += (u_long)*bp-- & 0xff;
sec <<= 8;
- sec += (U_LONG)*bp & 0xff;
+ sec += (u_long)*bp & 0xff;
#endif
if (usec > 999999)
return 0;
- ts->l_ui = sec + (U_LONG)JAN_1970;
+ ts->l_ui = sec + (u_long)JAN_1970;
TVUTOTSF(usec, ts->l_uf);
return 1;
}
diff --git a/usr.sbin/xntpd/lib/caljulian.c b/usr.sbin/xntpd/lib/caljulian.c
index 92d6d74..070fa0d 100644
--- a/usr.sbin/xntpd/lib/caljulian.c
+++ b/usr.sbin/xntpd/lib/caljulian.c
@@ -1,4 +1,4 @@
-/* caljulian.c,v 3.1 1993/07/06 01:08:00 jbj Exp
+/*
* caljulian - determine the Julian date from an NTP time.
*/
#include <sys/types.h>
@@ -37,11 +37,11 @@ static u_short caldaytab[YEARSPERCYCLE] = {
void
caljulian(ntptime, jt)
- U_LONG ntptime;
+ u_long ntptime;
register struct calendar *jt;
{
register int i;
- register U_LONG nt;
+ register u_long nt;
register u_short snt;
register int cyear;
diff --git a/usr.sbin/xntpd/lib/calleapwhen.c b/usr.sbin/xntpd/lib/calleapwhen.c
index 379643f..83613ef 100644
--- a/usr.sbin/xntpd/lib/calleapwhen.c
+++ b/usr.sbin/xntpd/lib/calleapwhen.c
@@ -1,4 +1,4 @@
-/* calleapwhen.c,v 3.1 1993/07/06 01:08:02 jbj Exp
+/*
* calleapwhen - determine the number of seconds to the next possible
* leap occurance and the last one.
*/
@@ -11,7 +11,7 @@
/*
* calleaptab - leaps occur at the end of December and June
*/
-LONG calleaptab[10] = {
+long calleaptab[10] = {
-(JAN+FEBLEAP)*SECSPERDAY, /* leap previous to cycle */
(MAR+APR+MAY+JUN)*SECSPERDAY, /* end of June */
(MAR+APR+MAY+JUN+JUL+AUG+SEP+OCT+NOV+DEC)*SECSPERDAY, /* end of Dec */
@@ -27,11 +27,11 @@ LONG calleaptab[10] = {
void
calleapwhen(ntpdate, leaplast, leapnext)
- U_LONG ntpdate;
- U_LONG *leaplast;
- U_LONG *leapnext;
+ u_long ntpdate;
+ u_long *leaplast;
+ u_long *leapnext;
{
- register U_LONG dateincycle;
+ register u_long dateincycle;
register int i;
/*
@@ -50,12 +50,12 @@ calleapwhen(ntpdate, leaplast, leapnext)
* Find where we are with respect to the leap events.
*/
for (i = 1; i < 9; i++)
- if (dateincycle < (U_LONG)calleaptab[i])
+ if (dateincycle < (u_long)calleaptab[i])
break;
/*
* i points at the next leap. Compute the last and the next.
*/
- *leaplast = (U_LONG)((LONG)dateincycle - calleaptab[i-1]);
- *leapnext = (U_LONG)(calleaptab[i] - (LONG)dateincycle);
+ *leaplast = (u_long)((long)dateincycle - calleaptab[i-1]);
+ *leapnext = (u_long)(calleaptab[i] - (long)dateincycle);
}
diff --git a/usr.sbin/xntpd/lib/caltontp.c b/usr.sbin/xntpd/lib/caltontp.c
index f5da0ab..a0c8f61 100644
--- a/usr.sbin/xntpd/lib/caltontp.c
+++ b/usr.sbin/xntpd/lib/caltontp.c
@@ -1,4 +1,4 @@
-/* caltontp.c,v 3.1 1993/07/06 01:08:04 jbj Exp
+/*
* caltontp - convert a julian date to an NTP time
*/
#include <sys/types.h>
@@ -25,13 +25,13 @@ static u_short calmonthtab[12] = {
(MAR+APR+MAY+JUN+JUL+AUG+SEP+OCT+NOV+DEC+JAN), /* February */
};
-U_LONG
+u_long
caltontp(jt)
register const struct calendar *jt;
{
register int cyear;
register int resyear;
- register U_LONG nt;
+ register u_long nt;
register int yearday;
/*
@@ -77,14 +77,14 @@ caltontp(jt)
}
}
- nt = TIMESDPERC((U_LONG)cyear);
+ nt = TIMESDPERC((u_long)cyear);
while (resyear-- > 0)
nt += DAYSPERYEAR;
- nt += (U_LONG) (yearday - 1);
+ nt += (u_long) (yearday - 1);
- nt = TIMES24(nt) + (U_LONG)jt->hour;
- nt = TIMES60(nt) + (U_LONG)jt->minute;
- nt = TIMES60(nt) + (U_LONG)jt->second;
+ nt = TIMES24(nt) + (u_long)jt->hour;
+ nt = TIMES60(nt) + (u_long)jt->minute;
+ nt = TIMES60(nt) + (u_long)jt->second;
return nt + MAR1900;
}
diff --git a/usr.sbin/xntpd/lib/calyearstart.c b/usr.sbin/xntpd/lib/calyearstart.c
index 1bb3321..015ed93 100644
--- a/usr.sbin/xntpd/lib/calyearstart.c
+++ b/usr.sbin/xntpd/lib/calyearstart.c
@@ -1,4 +1,4 @@
-/* calyearstart.c,v 3.1 1993/07/06 01:08:06 jbj Exp
+/*
* calyearstart - determine the NTP time at midnight of January 1 in
* the year of the given date.
*/
@@ -11,19 +11,19 @@
/*
* calyeartab - year start offsets from the beginning of a cycle
*/
-U_LONG calyeartab[YEARSPERCYCLE] = {
+u_long calyeartab[YEARSPERCYCLE] = {
(SECSPERLEAPYEAR-JANFEBLEAP),
(SECSPERLEAPYEAR-JANFEBLEAP) + SECSPERYEAR,
(SECSPERLEAPYEAR-JANFEBLEAP) + 2*SECSPERYEAR,
(SECSPERLEAPYEAR-JANFEBLEAP) + 3*SECSPERYEAR
};
-U_LONG
+u_long
calyearstart(dateinyear)
- register U_LONG dateinyear;
+ register u_long dateinyear;
{
- register U_LONG cyclestart;
- register U_LONG nextyear, lastyear;
+ register u_long cyclestart;
+ register u_long nextyear, lastyear;
register int i;
/*
diff --git a/usr.sbin/xntpd/lib/clocktime.c b/usr.sbin/xntpd/lib/clocktime.c
index 36b967e..0217f2b 100644
--- a/usr.sbin/xntpd/lib/clocktime.c
+++ b/usr.sbin/xntpd/lib/clocktime.c
@@ -1,4 +1,4 @@
-/* clocktime.c,v 3.1 1993/07/06 01:08:07 jbj Exp
+/*
* clocktime - compute the NTP date from a day of year, hour, minute
* and second.
*/
@@ -34,21 +34,21 @@ clocktime(yday, hour, minute, second, tzoff, rec_ui, yearstart, ts_ui)
int minute;
int second;
int tzoff;
- U_LONG rec_ui;
- U_LONG *yearstart;
+ u_long rec_ui;
+ u_long *yearstart;
U_LONG *ts_ui;
{
- register LONG tmp;
- register U_LONG date;
- register U_LONG yst;
+ register long tmp;
+ register u_long date;
+ register u_long yst;
/*
* Compute the offset into the year in seconds. Note that
* this could come out to be a negative number.
*/
- tmp = (LONG)(MULBY24((yday-1)) + hour + tzoff);
- tmp = MULBY60(tmp) + (LONG)minute;
- tmp = MULBY60(tmp) + (LONG)second;
+ tmp = (long)(MULBY24((yday-1)) + hour + tzoff);
+ tmp = MULBY60(tmp) + (long)minute;
+ tmp = MULBY60(tmp) + (long)second;
/*
* Initialize yearstart, if necessary.
@@ -66,7 +66,7 @@ clocktime(yday, hour, minute, second, tzoff, rec_ui, yearstart, ts_ui)
* Use the current year start for the first check, this should
* work most of the time.
*/
- date = (U_LONG)(tmp + (LONG)yst);
+ date = (u_long)(tmp + (long)yst);
if (date < (rec_ui + CLOSETIME) &&
date > (rec_ui - CLOSETIME)) {
*ts_ui = date;
@@ -79,7 +79,7 @@ clocktime(yday, hour, minute, second, tzoff, rec_ui, yearstart, ts_ui)
*/
yst = calyearstart(rec_ui);
if (yst != *yearstart) {
- date = (U_LONG)((LONG)yst + tmp);
+ date = (u_long)((long)yst + tmp);
*ts_ui = date;
if (date < (rec_ui + CLOSETIME) &&
date > (rec_ui - CLOSETIME)) {
@@ -98,7 +98,7 @@ clocktime(yday, hour, minute, second, tzoff, rec_ui, yearstart, ts_ui)
if ((rec_ui - yst) < TWODAYS) {
yst = calyearstart(yst - TWODAYS);
if (yst != *yearstart) {
- date = (U_LONG)(tmp + (LONG)yst);
+ date = (u_long)(tmp + (long)yst);
if (date < (rec_ui + CLOSETIME) &&
date > (rec_ui - CLOSETIME)) {
*yearstart = yst;
@@ -115,7 +115,7 @@ clocktime(yday, hour, minute, second, tzoff, rec_ui, yearstart, ts_ui)
*/
yst = calyearstart(rec_ui + TWODAYS);
if (yst != *yearstart) {
- date = (U_LONG)((LONG)yst + tmp);
+ date = (u_long)((long)yst + tmp);
if (date < (rec_ui + CLOSETIME) &&
date > (rec_ui - CLOSETIME)) {
*yearstart = yst;
diff --git a/usr.sbin/xntpd/lib/clocktypes.c b/usr.sbin/xntpd/lib/clocktypes.c
index 816ef07..38b8cd2 100644
--- a/usr.sbin/xntpd/lib/clocktypes.c
+++ b/usr.sbin/xntpd/lib/clocktypes.c
@@ -1,4 +1,4 @@
-/* clocktypes.c,v 3.1 1993/07/06 01:08:09 jbj Exp
+/*
* Data for pretty printing clock types
*/
#include <stdio.h>
@@ -9,38 +9,64 @@
#include "ntp_refclock.h"
struct clktype clktypes[] = {
- { REFCLK_NONE, "unspecified type (0)", "UNKNOWN" },
- { REFCLK_LOCALCLOCK, "local clock synchronization (1)", "LOCAL" },
- { REFCLK_GPS_TRAK, "TRAK 8810 GPS Receiver (2)", "GPS_TRAK" },
- { REFCLK_WWV_PST, "Precision Standard Time WWV clock (3)", "WWV_PST" },
- { REFCLK_WWVB_SPECTRACOM, "Spectracom WWVB clock (4)", "WWVB_SPEC" },
- { REFCLK_GOES_TRUETIME, "True Time GPS/GOES clock (5)", "GPS_GOES_TRUE" },
- { REFCLK_IRIG_AUDIO, "IRIG audio decoder (6)", "IRIG_AUDIO" },
- { REFCLK_CHU, "Direct synced to CHU (7)", "CHU" },
- { REFCLK_PARSE, "Generic reference clock driver (8)", "GENERIC" },
- { REFCLK_GPS_MX4200, "Magnavox MX4200 GPS clock (9)", "GPS_MX4200" },
- { REFCLK_GPS_AS2201, "Austron 2201A GPS clock (10)", "GPS_AS2201" },
- { REFCLK_OMEGA_TRUETIME, "TrueTime OMEGA clock (11)", "OMEGA_TRUE" },
- { REFCLK_IRIG_TPRO, "Odetics/KSI TPRO IRIG decoder (12)", "IRIG_TPRO" },
- { REFCLK_ATOM_LEITCH, "Leitch CSD 5300 controller (13)", "ATOM_LEITCH" },
- { REFCLK_MSF_EES, "MSF EES M201, UK (14)", "MSF_EES" },
- { REFCLK_GPSTM_TRUETIME, "TrueTime GPS/TM-TMD clock (15)", "GPS_TRUE" },
+ { REFCLK_NONE, "unspecified type (0)",
+ "UNKNOWN" },
+ { REFCLK_LOCALCLOCK, "Undisciplined local clock (1)",
+ "LOCAL" },
+ { REFCLK_GPS_TRAK, "TRAK 8810 GPS Receiver (2)",
+ "GPS_TRAK" },
+ { REFCLK_WWV_PST, "PSTI/Traconex WWV/WWVH Receiver (3)",
+ "WWV_PST" },
+ { REFCLK_WWVB_SPECTRACOM, "Spectracom WWVB Receiver (4)",
+ "WWVB_SPEC" },
+ { REFCLK_GOES_TRUETIME, "TrueTime GPS/GOES Receivers (5)",
+ "GPS_GOES_TRUE" },
+ { REFCLK_IRIG_AUDIO, "IRIG Audio Decoder (6)",
+ "IRIG_AUDIO" },
+ { REFCLK_CHU, "Scratchbuilt CHU Receiver (7)",
+ "CHU" },
+ { REFCLK_PARSE, "Generic reference clock driver (8)",
+ "GENERIC" },
+ { REFCLK_GPS_MX4200, "Magnavox MX4200 GPS Receiver (9)",
+ "GPS_MX4200" },
+ { REFCLK_GPS_AS2201, "Austron 2201A GPS Receiver (10)",
+ "GPS_AS2201" },
+ { REFCLK_OMEGA_TRUETIME, "TrueTime OM-DC OMEGA Receiver (11)",
+ "OMEGA_TRUE" },
+ { REFCLK_IRIG_TPRO, "KSI/Odetics TPRO/S IRIG Interface (12)",
+ "IRIG_TPRO" },
+ { REFCLK_ATOM_LEITCH, "Leitch CSD 5300 Master Clock Controller (13)",
+ "ATOM_LEITCH" },
+ { REFCLK_MSF_EES, "EES M201 MSF Receiver (14)",
+ "MSF_EES" },
+ { REFCLK_GPSTM_TRUETIME, "TrueTime GPS/TM-TMD Receiver (15)",
+ "GPS_TRUE" },
+ { REFCLK_IRIG_BANCOMM, "Bancomm GPS/IRIG Receiver (16)",
+ "GPS_BANC" },
+ { REFCLK_GPS_DATUM, "Datum Precision Time System (17)",
+ "GPS_DATUM" },
+ { REFCLK_NIST_ACTS, "NIST Automated Computer Time Service (18)",
+ "NIST_ACTS" },
+ { REFCLK_WWV_HEATH, "Heath WWV/WWVH Receiver (19)",
+ "WWV_HEATH" },
+ { REFCLK_GPS_NMEA, "Generic NMEA GPS Receiver (20)",
+ "GPS_NMEA" },
+ { REFCLK_GPS_MOTO, "Motorola Six Gun GPS Receiver (21)",
+ "GPS_MOTO" },
+ { REFCLK_ATOM_PPS, "PPS Clock Discipline (22)",
+ "ATOM_PPS" },
{ -1, "", "" }
};
const char *
clockname(num)
- int num;
+ int num;
{
- register struct clktype *clk;
+ register struct clktype *clk;
- for (clk = clktypes; clk->code != -1; clk++)
- {
- if (num == clk->code)
- {
- return clk->abbrev;
+ for (clk = clktypes; clk->code != -1; clk++) {
+ if (num == clk->code)
+ return (clk->abbrev);
}
- }
-
- return NULL;
+ return (NULL);
}
diff --git a/usr.sbin/xntpd/lib/decodenetnum.c b/usr.sbin/xntpd/lib/decodenetnum.c
index 32320a2..65e7761 100644
--- a/usr.sbin/xntpd/lib/decodenetnum.c
+++ b/usr.sbin/xntpd/lib/decodenetnum.c
@@ -1,4 +1,4 @@
-/* decodenetnum.c,v 3.1 1993/07/06 01:08:11 jbj Exp
+/*
* decodenetnum - return a net number (this is crude, but careful)
*/
#include <sys/types.h>
@@ -11,7 +11,7 @@
int
decodenetnum(num, netnum)
const char *num;
- U_LONG *netnum;
+ u_long *netnum;
{
register const char *cp;
register char *bp;
diff --git a/usr.sbin/xntpd/lib/dofptoa.c b/usr.sbin/xntpd/lib/dofptoa.c
index a496df8..31673fb 100644
--- a/usr.sbin/xntpd/lib/dofptoa.c
+++ b/usr.sbin/xntpd/lib/dofptoa.c
@@ -1,4 +1,4 @@
-/* dofptoa.c,v 3.1 1993/07/06 01:08:12 jbj Exp
+/*
* dofptoa - do the grunge work to convert an fp number to ascii
*/
#include <stdio.h>
@@ -16,7 +16,7 @@ dofptoa(fpv, neg, ndec, msec)
int msec;
{
register u_char *cp, *cpend;
- register U_LONG val;
+ register u_long val;
register short dec;
u_char cbuf[12];
u_char *cpdec;
diff --git a/usr.sbin/xntpd/lib/dolfptoa.c b/usr.sbin/xntpd/lib/dolfptoa.c
index ff37c9f..a79d8c6 100644
--- a/usr.sbin/xntpd/lib/dolfptoa.c
+++ b/usr.sbin/xntpd/lib/dolfptoa.c
@@ -1,4 +1,4 @@
-/* dolfptoa.c,v 3.1 1993/07/06 01:08:14 jbj Exp
+/*
* dolfptoa - do the grunge work of converting an l_fp number to decimal
*/
#include <stdio.h>
@@ -10,14 +10,14 @@
char *
dolfptoa(fpi, fpv, neg, ndec, msec)
- U_LONG fpi;
- U_LONG fpv;
+ u_long fpi;
+ u_long fpv;
int neg;
int ndec;
int msec;
{
register u_char *cp, *cpend;
- register U_LONG work_i;
+ register u_long lwork;
register int dec;
u_char cbuf[24];
u_char *cpdec;
@@ -39,22 +39,22 @@ dolfptoa(fpi, fpv, neg, ndec, msec)
* compiles fairly well for a 68000.
*/
cp = cpend = &cbuf[10];
- work_i = fpi;
- if (work_i & 0xffff0000) {
- register U_LONG lten = 10;
- register U_LONG ltmp;
+ lwork = fpi;
+ if (lwork & 0xffff0000) {
+ register u_long lten = 10;
+ register u_long ltmp;
do {
- ltmp = work_i;
- work_i /= lten;
- ltmp -= (work_i<<3) + (work_i<<1);
+ ltmp = lwork;
+ lwork /= lten;
+ ltmp -= (lwork << 3) + (lwork << 1);
*--cp = (u_char)ltmp;
- } while (work_i & 0xffff0000);
+ } while (lwork & 0xffff0000);
}
- if (work_i != 0) {
+ if (lwork != 0) {
register u_short sten = 10;
register u_short stmp;
- register u_short swork = (u_short)work_i;
+ register u_short swork = (u_short)lwork;
do {
stmp = swork;
@@ -86,12 +86,12 @@ dolfptoa(fpi, fpv, neg, ndec, msec)
* If there's a fraction to deal with, do so.
*/
if (fpv != 0) {
- register U_LONG work_f;
+ l_fp work;
- work_f = fpv;
+ work.l_ui = 0;
+ work.l_uf = fpv;
while (dec > 0) {
- register U_LONG tmp_i;
- register U_LONG tmp_f;
+ l_fp ftmp;
dec--;
/*
@@ -100,22 +100,21 @@ dolfptoa(fpi, fpv, neg, ndec, msec)
* a junk of BCD into the units part.
* record that and iterate.
*/
- work_i = 0;
- M_LSHIFT(work_i, work_f);
- tmp_i = work_i;
- tmp_f = work_f;
- M_LSHIFT(work_i, work_f);
- M_LSHIFT(work_i, work_f);
- M_ADD(work_i, work_f, tmp_i, tmp_f);
- *cpend++ = (u_char)work_i;
- if (work_f == 0)
+ work.l_ui = 0;
+ L_LSHIFT(&work);
+ ftmp = work;
+ L_LSHIFT(&work);
+ L_LSHIFT(&work);
+ L_ADD(&work, &ftmp);
+ *cpend++ = (u_char)work.l_ui;
+ if (work.l_uf == 0)
break;
}
/*
* Rounding is rotten
*/
- if (work_f & 0x80000000) {
+ if (work.l_uf & 0x80000000) {
register u_char *tp = cpend;
*(--tp) += 1;
diff --git a/usr.sbin/xntpd/lib/emalloc.c b/usr.sbin/xntpd/lib/emalloc.c
index d2a8e78..61d4cb6 100644
--- a/usr.sbin/xntpd/lib/emalloc.c
+++ b/usr.sbin/xntpd/lib/emalloc.c
@@ -1,4 +1,4 @@
-/* emalloc.c,v 3.1 1993/07/06 01:08:15 jbj Exp
+/*
* emalloc - return new memory obtained from the system. Belch if none.
*/
#include "ntp_types.h"
@@ -8,7 +8,7 @@
char *
emalloc(size)
- unsigned int size;
+ u_int size;
{
char *mem;
diff --git a/usr.sbin/xntpd/lib/fptoa.c b/usr.sbin/xntpd/lib/fptoa.c
index d245e9f..b0d7a14 100644
--- a/usr.sbin/xntpd/lib/fptoa.c
+++ b/usr.sbin/xntpd/lib/fptoa.c
@@ -1,4 +1,4 @@
-/* fptoa.c,v 3.1 1993/07/06 01:08:16 jbj Exp
+/*
* fptoa - return an asciized representation of an s_fp number
*/
#include "ntp_fp.h"
diff --git a/usr.sbin/xntpd/lib/fptoms.c b/usr.sbin/xntpd/lib/fptoms.c
index fb850c5..f8ae6ba 100644
--- a/usr.sbin/xntpd/lib/fptoms.c
+++ b/usr.sbin/xntpd/lib/fptoms.c
@@ -1,4 +1,4 @@
-/* fptoms.c,v 3.1 1993/07/06 01:08:17 jbj Exp
+/*
* fptoms - return an asciized s_fp number in milliseconds
*/
#include "ntp_fp.h"
diff --git a/usr.sbin/xntpd/lib/getopt.c b/usr.sbin/xntpd/lib/getopt.c
index 5519235..8505d80 100644
--- a/usr.sbin/xntpd/lib/getopt.c
+++ b/usr.sbin/xntpd/lib/getopt.c
@@ -1,4 +1,4 @@
-/* getopt.c,v 3.1 1993/07/06 01:08:18 jbj Exp
+/*
* getopt - get option letter from argv
*
* This is a version of the public domain getopt() implementation by
diff --git a/usr.sbin/xntpd/lib/gettstamp.c b/usr.sbin/xntpd/lib/gettstamp.c
index 19bcb0c..53b124a 100644
--- a/usr.sbin/xntpd/lib/gettstamp.c
+++ b/usr.sbin/xntpd/lib/gettstamp.c
@@ -1,4 +1,4 @@
-/* gettstamp.c,v 3.1 1993/07/06 01:08:20 jbj Exp
+/*
* gettstamp - return the system time in timestamp format
*/
#include <stdio.h>
diff --git a/usr.sbin/xntpd/lib/hextoint.c b/usr.sbin/xntpd/lib/hextoint.c
index 90329c4..23f8c08 100644
--- a/usr.sbin/xntpd/lib/hextoint.c
+++ b/usr.sbin/xntpd/lib/hextoint.c
@@ -1,4 +1,4 @@
-/* hextoint.c,v 3.1 1993/07/06 01:08:21 jbj Exp
+/*
* hextoint - convert an ascii string in hex to an unsigned
* long, with error checking
*/
@@ -9,9 +9,9 @@
int
hextoint(str, ival)
const char *str;
- U_LONG *ival;
+ u_long *ival;
{
- register U_LONG u;
+ register u_long u;
register const char *cp;
cp = str;
diff --git a/usr.sbin/xntpd/lib/hextolfp.c b/usr.sbin/xntpd/lib/hextolfp.c
index 6473c7c..d9291cc 100644
--- a/usr.sbin/xntpd/lib/hextolfp.c
+++ b/usr.sbin/xntpd/lib/hextolfp.c
@@ -1,4 +1,4 @@
-/* hextolfp.c,v 3.1 1993/07/06 01:08:22 jbj Exp
+/*
* hextolfp - convert an ascii hex string to an l_fp number
*/
#include <stdio.h>
@@ -15,8 +15,8 @@ hextolfp(str, lfp)
{
register const char *cp;
register const char *cpstart;
- register U_LONG dec_i;
- register U_LONG dec_f;
+ register u_long dec_i;
+ register u_long dec_f;
char *ind = NULL;
static char *digits = "0123456789abcdefABCDEF";
diff --git a/usr.sbin/xntpd/lib/humandate.c b/usr.sbin/xntpd/lib/humandate.c
index 464ed6b..8ea936f 100644
--- a/usr.sbin/xntpd/lib/humandate.c
+++ b/usr.sbin/xntpd/lib/humandate.c
@@ -1,4 +1,4 @@
-/* humandate.c,v 3.1 1993/07/06 01:08:24 jbj Exp
+/*
* humandate - convert an NTP (or the current) time to something readable
*/
#include <stdio.h>
@@ -22,16 +22,16 @@ static char *days[] = {
char *
humandate(ntptime)
- U_LONG ntptime;
+ u_long ntptime;
{
char *bp;
struct tm *tm;
- U_LONG sec;
+ time_t sec;
LIB_GETBUF(bp);
sec = ntptime - JAN_1970;
- tm = localtime((LONG *)&sec);
+ tm = localtime(&sec);
(void) sprintf(bp, "%s, %s %2d %4d %2d:%02d:%02d",
days[tm->tm_wday], months[tm->tm_mon], tm->tm_mday,
diff --git a/usr.sbin/xntpd/lib/inttoa.c b/usr.sbin/xntpd/lib/inttoa.c
index 25ce26c..ff886f5 100644
--- a/usr.sbin/xntpd/lib/inttoa.c
+++ b/usr.sbin/xntpd/lib/inttoa.c
@@ -1,4 +1,4 @@
-/* inttoa.c,v 3.1 1993/07/06 01:08:25 jbj Exp
+/*
* inttoa - return an asciized signed integer
*/
#include <stdio.h>
@@ -8,12 +8,12 @@
char *
inttoa(ival)
- LONG ival;
+ long ival;
{
register char *buf;
LIB_GETBUF(buf);
- (void) sprintf(buf, "%ld", ival);
+ (void) sprintf(buf, "%ld", (long)ival);
return buf;
}
diff --git a/usr.sbin/xntpd/lib/lib_strbuf.c b/usr.sbin/xntpd/lib/lib_strbuf.c
index 15661ab..47df66d 100644
--- a/usr.sbin/xntpd/lib/lib_strbuf.c
+++ b/usr.sbin/xntpd/lib/lib_strbuf.c
@@ -1,4 +1,4 @@
-/* lib_strbuf.c,v 3.1 1993/07/06 01:08:27 jbj Exp
+/*
* lib_strbuf - library string storage
*/
diff --git a/usr.sbin/xntpd/lib/lib_strbuf.h b/usr.sbin/xntpd/lib/lib_strbuf.h
index 20720fd..699b978 100644
--- a/usr.sbin/xntpd/lib/lib_strbuf.h
+++ b/usr.sbin/xntpd/lib/lib_strbuf.h
@@ -1,4 +1,4 @@
-/* lib_strbuf.h,v 3.1 1993/07/06 01:08:28 jbj Exp
+/*
* lib_strbuf.h - definitions for routines which use the common string buffers
*/
diff --git a/usr.sbin/xntpd/lib/machines.c b/usr.sbin/xntpd/lib/machines.c
index 5e01694..1d1cbc9 100644
--- a/usr.sbin/xntpd/lib/machines.c
+++ b/usr.sbin/xntpd/lib/machines.c
@@ -41,3 +41,21 @@ ntp_memset(a, x, c)
*a++ = x;
}
#endif /*POSIX*/
+
+#if defined(USE_CLOCK_SETTIME)
+
+#include <time.h>
+
+int
+settimeofday(tvp)
+ struct timeval *tvp;
+{
+ struct timespec ts;
+
+ /* Convert timeval to timespec */
+ ts.tv_sec = tvp->tv_sec;
+ ts.tv_nsec = 1000 * tvp->tv_usec;
+
+ return clock_settime(CLOCK_REALTIME, &ts);
+}
+#endif /* USE_CLOCK_SETTIME */
diff --git a/usr.sbin/xntpd/lib/md5.c b/usr.sbin/xntpd/lib/md5.c
index 77644cb..2c373cf 100644
--- a/usr.sbin/xntpd/lib/md5.c
+++ b/usr.sbin/xntpd/lib/md5.c
@@ -1,4 +1,4 @@
-/* md5.c,v 3.1 1993/07/06 01:08:29 jbj Exp
+/*
***********************************************************************
** md5.c -- the source code for MD5 routines **
** RSA Data Security, Inc. MD5 Message-Digest Algorithm **
diff --git a/usr.sbin/xntpd/lib/mfptoa.c b/usr.sbin/xntpd/lib/mfptoa.c
index 4e513d2..7de3b6e 100644
--- a/usr.sbin/xntpd/lib/mfptoa.c
+++ b/usr.sbin/xntpd/lib/mfptoa.c
@@ -1,13 +1,13 @@
-/* mfptoa.c,v 3.1 1993/07/06 01:08:30 jbj Exp
- * mfptoa - Return an asciized representation of a signed LONG fp number
+/*
+ * mfptoa - Return an asciized representation of a signed long fp number
*/
#include "ntp_fp.h"
#include "ntp_stdlib.h"
char *
mfptoa(fpi, fpf, ndec)
- U_LONG fpi;
- U_LONG fpf;
+ u_long fpi;
+ u_long fpf;
int ndec;
{
int isneg;
diff --git a/usr.sbin/xntpd/lib/mfptoms.c b/usr.sbin/xntpd/lib/mfptoms.c
index f686d41..01a6f09 100644
--- a/usr.sbin/xntpd/lib/mfptoms.c
+++ b/usr.sbin/xntpd/lib/mfptoms.c
@@ -1,13 +1,13 @@
-/* mfptoms.c,v 3.1 1993/07/06 01:08:31 jbj Exp
- * mfptoms - Return an asciized signed LONG fp number in milliseconds
+/*
+ * mfptoms - Return an asciized signed long fp number in milliseconds
*/
#include "ntp_fp.h"
#include "ntp_stdlib.h"
char *
mfptoms(fpi, fpf, ndec)
- U_LONG fpi;
- U_LONG fpf;
+ u_long fpi;
+ u_long fpf;
int ndec;
{
int isneg;
diff --git a/usr.sbin/xntpd/lib/modetoa.c b/usr.sbin/xntpd/lib/modetoa.c
index 4833271..e8292b3 100644
--- a/usr.sbin/xntpd/lib/modetoa.c
+++ b/usr.sbin/xntpd/lib/modetoa.c
@@ -1,4 +1,4 @@
-/* modetoa.c,v 3.1 1993/07/06 01:08:33 jbj Exp
+/*
* modetoa - return an asciized mode
*/
#include <stdio.h>
diff --git a/usr.sbin/xntpd/lib/mstolfp.c b/usr.sbin/xntpd/lib/mstolfp.c
index 8a642cf..f9c21b7 100644
--- a/usr.sbin/xntpd/lib/mstolfp.c
+++ b/usr.sbin/xntpd/lib/mstolfp.c
@@ -1,4 +1,4 @@
-/* mstolfp.c,v 3.1 1993/07/06 01:08:34 jbj Exp
+/*
* mstolfp - convert an ascii string in milliseconds to an l_fp number
*/
#include <stdio.h>
diff --git a/usr.sbin/xntpd/lib/msutotsf.c b/usr.sbin/xntpd/lib/msutotsf.c
index 412cfbd..eb3babe 100644
--- a/usr.sbin/xntpd/lib/msutotsf.c
+++ b/usr.sbin/xntpd/lib/msutotsf.c
@@ -1,4 +1,4 @@
-/* msutotsf.c,v 3.1 1993/07/06 01:08:35 jbj Exp
+/*
* msutotsf - tables for converting from a subsecond millisecond value
* to a time stamp fraction.
*/
@@ -12,7 +12,7 @@
* truncated). The error in the result will thus be +-1 low order
* bit in the time stamp fraction.
*/
-U_LONG msutotsflo[32] = {
+u_long msutotsflo[32] = {
0x00000000, 0x00418937, 0x0083126f, 0x00c49ba6,
0x010624dd, 0x0147ae14, 0x0189374c, 0x01cac083,
0x020c49ba, 0x024dd2f2, 0x028f5c29, 0x02d0e560,
@@ -23,7 +23,7 @@ U_LONG msutotsflo[32] = {
0x072b020c, 0x076c8b44, 0x07ae147b, 0x07ef9db2
};
-U_LONG msutotsfhi[32] = {
+u_long msutotsfhi[32] = {
0x00000000, 0x083126e9, 0x10624dd3, 0x189374bc,
0x20c49ba6, 0x28f5c28f, 0x3126e979, 0x39581062,
0x4189374c, 0x49ba5e35, 0x51eb851f, 0x5a1cac08,
diff --git a/usr.sbin/xntpd/lib/netof.c b/usr.sbin/xntpd/lib/netof.c
index 286a584..def3013 100644
--- a/usr.sbin/xntpd/lib/netof.c
+++ b/usr.sbin/xntpd/lib/netof.c
@@ -7,19 +7,18 @@
#include "ntp_fp.h"
#include "ntp_stdlib.h"
-U_LONG
+u_long
netof(num)
- U_LONG num;
+ u_long num;
{
- register U_LONG netnum;
+ register u_long netnum;
netnum = num;
-
if(IN_CLASSC(netnum))
netnum &= IN_CLASSC_NET;
else if (IN_CLASSB(netnum))
netnum &= IN_CLASSB_NET;
- else /* treat als other like class A */
+ else /* treat all other like class A */
netnum &= IN_CLASSA_NET;
return netnum;
}
diff --git a/usr.sbin/xntpd/lib/numtoa.c b/usr.sbin/xntpd/lib/numtoa.c
index c36885d..ef291c8 100644
--- a/usr.sbin/xntpd/lib/numtoa.c
+++ b/usr.sbin/xntpd/lib/numtoa.c
@@ -1,4 +1,4 @@
-/* numtoa.c,v 3.1 1993/07/06 01:08:38 jbj Exp
+/*
* numtoa - return asciized network numbers store in local array space
*/
#include <stdio.h>
@@ -9,16 +9,14 @@
char *
numtoa(num)
- U_LONG num;
+ u_long num;
{
- register U_LONG netnum;
+ register u_long netnum;
register char *buf;
netnum = ntohl(num);
LIB_GETBUF(buf);
-
- (void) sprintf(buf, "%d.%d.%d.%d", (netnum>>24)&0xff,
- (netnum>>16)&0xff, (netnum>>8)&0xff, netnum&0xff);
-
+ (void) sprintf(buf, "%lu.%lu.%lu.%lu", (netnum >> 24) & 0xff,
+ (netnum >> 16) & 0xff, (netnum >> 8) & 0xff, netnum & 0xff);
return buf;
}
diff --git a/usr.sbin/xntpd/lib/numtohost.c b/usr.sbin/xntpd/lib/numtohost.c
index 2f07c2c..844bbce 100644
--- a/usr.sbin/xntpd/lib/numtohost.c
+++ b/usr.sbin/xntpd/lib/numtohost.c
@@ -13,7 +13,7 @@
char *
numtohost(netnum)
- U_LONG netnum;
+ u_long netnum;
{
char *bp;
struct hostent *hp;
diff --git a/usr.sbin/xntpd/lib/octtoint.c b/usr.sbin/xntpd/lib/octtoint.c
index 1f25b1d..7598d72 100644
--- a/usr.sbin/xntpd/lib/octtoint.c
+++ b/usr.sbin/xntpd/lib/octtoint.c
@@ -1,4 +1,4 @@
-/* octtoint.c,v 3.1 1993/07/06 01:08:41 jbj Exp
+/*
* octtoint - convert an ascii string in octal to an unsigned
* long, with error checking
*/
@@ -10,9 +10,9 @@
int
octtoint(str, ival)
const char *str;
- U_LONG *ival;
+ u_long *ival;
{
- register U_LONG u;
+ register u_long u;
register const char *cp;
cp = str;
diff --git a/usr.sbin/xntpd/lib/prettydate.c b/usr.sbin/xntpd/lib/prettydate.c
index ad679bd..747e310 100644
--- a/usr.sbin/xntpd/lib/prettydate.c
+++ b/usr.sbin/xntpd/lib/prettydate.c
@@ -1,4 +1,4 @@
-/* prettydate.c,v 3.1 1993/07/06 01:08:42 jbj Exp
+/*
* prettydate - convert a time stamp to something readable
*/
#include <stdio.h>
@@ -18,8 +18,8 @@ prettydate(ts)
{
char *bp;
struct tm *tm;
- U_LONG sec;
- U_LONG msec;
+ time_t sec;
+ u_long msec;
static char *months[] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
@@ -31,14 +31,14 @@ prettydate(ts)
LIB_GETBUF(bp);
sec = ts->l_ui - JAN_1970;
- msec = ts->l_uf / 4294967; /* fract / (2**32/1000) */
+ msec = ts->l_uf / 4294967; /* fract / (2 ** 32 / 1000) */
- tm = localtime((LONG *)&sec);
+ tm = localtime(&sec);
- (void) sprintf(bp, "%08x.%08x %s, %s %2d %4d %2d:%02d:%02d.%03d",
- ts->l_ui, ts->l_uf, days[tm->tm_wday], months[tm->tm_mon],
- tm->tm_mday, 1900+tm->tm_year, tm->tm_hour, tm->tm_min,
- tm->tm_sec, msec);
+ (void) sprintf(bp, "%08lx.%08lx %s, %s %2d %4d %2d:%02d:%02d.%03lu",
+ (u_long)ts->l_ui, (u_long)ts->l_uf, days[tm->tm_wday],
+ months[tm->tm_mon], tm->tm_mday, 1900 + tm->tm_year,
+ tm->tm_hour,tm->tm_min, tm->tm_sec, msec);
return bp;
}
diff --git a/usr.sbin/xntpd/lib/ranny.c b/usr.sbin/xntpd/lib/ranny.c
index 2a47e03..3fe7b22 100644
--- a/usr.sbin/xntpd/lib/ranny.c
+++ b/usr.sbin/xntpd/lib/ranny.c
@@ -1,4 +1,4 @@
-/* ranny.c,v 3.1 1993/07/06 01:08:43 jbj Exp
+/*
* Random number generator is:
*
* Copyright 1988 by Rayan S. Zachariassen, all rights reserved.
@@ -20,9 +20,9 @@ extern time_t time P((time_t *loc));
* 55 random numbers, not all even. Note we don't initialize ran_y
* directly since I have had thoughts of putting this in an EPROM
*/
-static U_LONG ran_y[55];
+static time_t ran_y[55];
-static U_LONG init_ran_y[55] = {
+static time_t init_ran_y[55] = {
1860909544, 231033423, 437666411, 1349655137, 2014584962,
504613712, 656256107, 1246027206, 573713775, 643466871,
540235388, 1630565153, 443649364, 729302839, 1933991552,
@@ -41,38 +41,22 @@ static int ran_k;
/*
- * ranp2 - return a random integer in the range 0 .. (1<<m)-1
+ * ranp2 - return a random integer in the range 0 .. (1 << m) - 1
*/
-U_LONG
+u_long
ranp2(m)
int m;
{
- U_LONG r;
-
- ran_y[ran_k] += ran_y[ran_j]; /* overflow does a mod */
- r = ran_y[ran_k];
- if (ran_k-- == 0) ran_k = 54;
- if (ran_j-- == 0) ran_j = 54;
- return (r & ((1<<m)-1));
-}
-
-#ifdef notdef
-/*
- * ranny - return a random integer in the range 0 .. m-1
- */
-U_LONG
-ranny(m)
- u_int m;
-{
- unsigned LONG r;
+ time_t r;
ran_y[ran_k] += ran_y[ran_j]; /* overflow does a mod */
r = ran_y[ran_k];
- if (ran_k-- == 0) ran_k = 54;
- if (ran_j-- == 0) ran_j = 54;
- return (r % m);
+ if (ran_k-- == 0)
+ ran_k = 54;
+ if (ran_j-- == 0)
+ ran_j = 54;
+ return (u_long)(r & ((1 << m ) - 1));
}
-#endif /* notdef */
/*
* init_random - do initialization of random number routine
@@ -90,7 +74,7 @@ init_random()
* Randomize the seed array some more. The time of day
* should be initialized by now.
*/
- now = (time_t)(time((time_t *)0))|01;
+ now = time((time_t *)0) | 01;
for (i = 0; i < 55; ++i)
ran_y[i] = now * init_ran_y[i]; /* overflow does a mod */
diff --git a/usr.sbin/xntpd/lib/refnumtoa.c b/usr.sbin/xntpd/lib/refnumtoa.c
index 31175d9..b46fdd8 100644
--- a/usr.sbin/xntpd/lib/refnumtoa.c
+++ b/usr.sbin/xntpd/lib/refnumtoa.c
@@ -1,4 +1,4 @@
-/* refnumtoa.c,v 3.1 1993/07/06 01:08:44 jbj Exp
+/*
* refnumtoa - return asciized refclock addresses stored in local array space
*/
#include <stdio.h>
@@ -9,9 +9,9 @@
char *
refnumtoa(num)
- U_LONG num;
+ u_long num;
{
- register U_LONG netnum;
+ register u_long netnum;
register char *buf;
register const char *rclock;
@@ -19,16 +19,12 @@ refnumtoa(num)
LIB_GETBUF(buf);
- rclock = clockname((int)((netnum>>8)&0xff));
+ rclock = clockname((int)((netnum >> 8) & 0xff));
if (rclock != NULL)
- {
- (void) sprintf(buf, "%s(%d)", clockname((int)((netnum>>8)&0xff)), netnum&0xff);
- }
+ (void)sprintf(buf, "%s(%lu)", rclock, netnum & 0xff);
else
- {
- (void) sprintf(buf, "REFCLK(%d,%d)", (netnum>>8)&0xff, netnum&0xff);
- }
-
+ (void)sprintf(buf, "REFCLK(%lu,%lu)",
+ (netnum >> 8) & 0xff, netnum&0xff);
return buf;
}
diff --git a/usr.sbin/xntpd/lib/systime.c b/usr.sbin/xntpd/lib/systime.c
index 1d6c59a..4464e8d 100644
--- a/usr.sbin/xntpd/lib/systime.c
+++ b/usr.sbin/xntpd/lib/systime.c
@@ -1,15 +1,16 @@
-/* systime.c,v 3.1 1993/07/06 01:08:46 jbj Exp
+/*
* systime -- routines to fiddle a UNIX clock.
*/
+#include <stdio.h>
#include <sys/types.h>
#include <sys/time.h>
-#if defined(SYS_HPUX) || defined(sgi) || defined(SYS_BSDI)
+#if defined(SYS_HPUX) || defined(sgi) || defined(SYS_BSDI) || defined(SYS_44BSD)
#include <sys/param.h>
#include <utmp.h>
#endif
#ifdef SYS_LINUX
-#include <sys/timex.h>
+#include "sys/timex.h"
#endif
#include "ntp_fp.h"
@@ -47,12 +48,12 @@ extern int debug;
* We also remember the clock precision we computed from the kernel in
* case someone asks us.
*/
- LONG sys_clock;
+ long sys_clock;
- LONG adj_precision; /* adj precision in usec (tickadj) */
- LONG tvu_maxslew; /* maximum adjust doable in 1<<CLOCK_ADJ sec (usec) */
+ long adj_precision; /* adj precision in usec (tickadj) */
+ long tvu_maxslew; /* maximum adjust doable in 1<<CLOCK_ADJ sec (usec) */
- U_LONG tsf_maxslew; /* same as above, as LONG format */
+ u_long tsf_maxslew; /* same as above, as long format */
l_fp sys_clock_offset; /* correction for current system time */
@@ -83,7 +84,7 @@ get_systime(ts)
TVTOTS(&tv, ts);
L_ADD(ts, &sys_clock_offset);
if (ts->l_uf & TS_ROUNDBIT)
- L_ADDUF(ts, (unsigned LONG) TS_ROUNDBIT);
+ L_ADDUF(ts, TS_ROUNDBIT);
#endif /* !defined(SLEWALWAYS) */
ts->l_ui += JAN_1970;
ts->l_uf &= TS_MASK;
@@ -101,8 +102,8 @@ step_systime(ts)
{
#ifdef SLEWALWAYS
#ifdef STEP_SLEW
- register U_LONG tmp_ui;
- register U_LONG tmp_uf;
+ register u_long tmp_ui;
+ register u_long tmp_uf;
int isneg;
int n;
@@ -148,13 +149,13 @@ int
adj_systime(ts)
l_fp *ts;
{
- register unsigned LONG offset_i, offset_f;
- register LONG temp;
- register unsigned LONG residual;
+ register u_long offset_i, offset_f;
+ register long temp;
+ register u_long residual;
register int isneg = 0;
struct timeval adjtv, oadjtv;
l_fp oadjts;
- LONG adj = ts->l_f;
+ long adj = ts->l_f;
int rval;
adjtv.tv_sec = adjtv.tv_usec = 0;
@@ -199,8 +200,7 @@ adj_systime(ts)
#ifdef DEBUG
if (debug > 4)
- syslog(LOG_DEBUG,
- "maximum slew: %s%s, remainder = %s\n",
+ printf("systime: maximum slew: %s%s, remainder = %s\n",
isneg?"-":"", umfptoa(0, tsf_maxslew, 9),
mfptoa(offset_i, offset_f, 9));
#endif
@@ -232,8 +232,8 @@ adj_systime(ts)
}
#ifdef DEBUG
if (debug > 4)
- syslog(LOG_DEBUG,
- "slew adjtv = %s, adjts = %s, sys_clock_offset = %s\n",
+ printf(
+ "systime: adjtv = %s, adjts = %s, sys_clock_offset = %s\n",
tvtoa(&adjtv), umfptoa(0, residual, 9),
mfptoa(offset_i, offset_f, 9));
#endif
diff --git a/usr.sbin/xntpd/lib/tsftomsu.c b/usr.sbin/xntpd/lib/tsftomsu.c
index b916114..9904b4f 100644
--- a/usr.sbin/xntpd/lib/tsftomsu.c
+++ b/usr.sbin/xntpd/lib/tsftomsu.c
@@ -1,4 +1,4 @@
-/* tsftomsu.c,v 3.1 1993/07/06 01:08:47 jbj Exp
+/*
* tsftomsu - convert from a time stamp fraction to milliseconds
*/
#include "ntp_fp.h"
@@ -6,11 +6,11 @@
int
tsftomsu(tsf, round)
- U_LONG tsf;
+ u_long tsf;
int round;
{
- register U_LONG val_ui, val_uf;
- register U_LONG tmp_ui, tmp_uf;
+ register long val_ui, val_uf;
+ register long tmp_ui, tmp_uf;
register int i;
/*
diff --git a/usr.sbin/xntpd/lib/tstotv.c b/usr.sbin/xntpd/lib/tstotv.c
index c9b0d1c..be4bdd4 100644
--- a/usr.sbin/xntpd/lib/tstotv.c
+++ b/usr.sbin/xntpd/lib/tstotv.c
@@ -1,4 +1,4 @@
-/* tstotv.c,v 3.1 1993/07/06 01:08:49 jbj Exp
+/*
* tstotv - tables for converting from NTP time stamps to struct timeval
*/
@@ -13,7 +13,7 @@
* These tables are rounded.
*/
-LONG tstoushi[256] = {
+long tstoushi[256] = {
0x000000, 0x007a12, 0x00f424, 0x016e36,
0x01e848, 0x02625a, 0x02dc6c, 0x03567e,
0x03d090, 0x044aa2, 0x04c4b4, 0x053ec6,
@@ -80,7 +80,7 @@ LONG tstoushi[256] = {
0x7829b8, 0x78a3ca, 0x791ddc, 0x7997ee
};
-LONG tstousmid[256] = {
+long tstousmid[256] = {
0x0000, 0x007a, 0x00f4, 0x016e, 0x01e8, 0x0262, 0x02dc, 0x0356,
0x03d1, 0x044b, 0x04c5, 0x053f, 0x05b9, 0x0633, 0x06ad, 0x0727,
0x07a1, 0x081b, 0x0895, 0x090f, 0x0989, 0x0a03, 0x0a7e, 0x0af8,
@@ -115,7 +115,7 @@ LONG tstousmid[256] = {
0x7641, 0x76bc, 0x7736, 0x77b0, 0x782a, 0x78a4, 0x791e, 0x7998
};
-LONG tstouslo[128] = {
+long tstouslo[128] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
diff --git a/usr.sbin/xntpd/lib/tvtoa.c b/usr.sbin/xntpd/lib/tvtoa.c
index 778caa1..dd9ee7e 100644
--- a/usr.sbin/xntpd/lib/tvtoa.c
+++ b/usr.sbin/xntpd/lib/tvtoa.c
@@ -1,4 +1,4 @@
-/* tvtoa.c,v 3.1 1993/07/06 01:08:50 jbj Exp
+/*
* tvtoa - return an asciized representation of a struct timeval
*/
#include <stdio.h>
@@ -12,8 +12,8 @@ tvtoa(tv)
struct timeval *tv;
{
register char *buf;
- register U_LONG sec;
- register U_LONG usec;
+ register u_long sec;
+ register u_long usec;
register int isneg;
if (tv->tv_sec < 0 || tv->tv_usec < 0) {
diff --git a/usr.sbin/xntpd/lib/tvtots.c b/usr.sbin/xntpd/lib/tvtots.c
index befc480..0bd2b69 100644
--- a/usr.sbin/xntpd/lib/tvtots.c
+++ b/usr.sbin/xntpd/lib/tvtots.c
@@ -1,4 +1,4 @@
-/* tvtots.c,v 3.1 1993/07/06 01:08:51 jbj Exp
+/*
* tvtots - tables for converting from Unix struct timeval's to
* NTP time stamp format.
*/
@@ -17,7 +17,7 @@
* +- 1.5 low order bits.
*/
-U_LONG ustotslo[256] = {
+u_long ustotslo[256] = {
0x00000000, 0x000010c7, 0x0000218e, 0x00003255,
0x0000431c, 0x000053e3, 0x000064aa, 0x00007571,
0x00008638, 0x000096ff, 0x0000a7c6, 0x0000b88d,
@@ -84,7 +84,7 @@ U_LONG ustotslo[256] = {
0x001083dc, 0x001094a3, 0x0010a56a, 0x0010b631,
};
-U_LONG ustotsmid[256] = {
+u_long ustotsmid[256] = {
0x00000000, 0x0010c6f8, 0x00218def, 0x003254e7,
0x00431bde, 0x0053e2d6, 0x0064a9ce, 0x007570c5,
0x008637bd, 0x0096feb4, 0x00a7c5ac, 0x00b88ca4,
@@ -151,7 +151,7 @@ U_LONG ustotsmid[256] = {
0x1083dbbc, 0x1094a2b4, 0x10a569ab, 0x10b630a3,
};
-U_LONG ustotshi[16] = {
+u_long ustotshi[16] = {
0x00000000, 0x10c6f79a, 0x218def35, 0x3254e6cf,
0x431bde6a, 0x53e2d604, 0x64a9cd9f, 0x7570c539,
0x8637bcd3, 0x96feb46e, 0xa7c5ac08, 0xb88ca3a3,
diff --git a/usr.sbin/xntpd/lib/uglydate.c b/usr.sbin/xntpd/lib/uglydate.c
index 308c703..25a8e56 100644
--- a/usr.sbin/xntpd/lib/uglydate.c
+++ b/usr.sbin/xntpd/lib/uglydate.c
@@ -1,4 +1,4 @@
-/* uglydate.c,v 3.1 1993/07/06 01:08:53 jbj Exp
+/*
* uglydate - convert a time stamp to something barely readable
* The string returned is 37 characters long.
*/
@@ -19,17 +19,15 @@ uglydate(ts)
char *bp;
char *timep;
struct tm *tm;
- U_LONG sec;
- U_LONG msec;
+ time_t sec;
+ long msec;
int year;
timep = ulfptoa(ts, 6); /* returns max 17 characters */
-
LIB_GETBUF(bp);
-
sec = ts->l_ui - JAN_1970;
msec = ts->l_uf / 4294967; /* fract / (2**32/1000) */
- tm = gmtime((LONG *)&sec);
+ tm = gmtime(&sec);
if (ts->l_ui == 0) {
/*
* Probably not a real good thing to do. Oh, well.
@@ -44,10 +42,8 @@ uglydate(ts)
while (year >= 100)
year -= 100;
}
-
- (void) sprintf(bp, "%17s %02d:%03d:%02d:%02d:%02d.%03d",
+ (void) sprintf(bp, "%17s %02d:%03d:%02d:%02d:%02d.%03ld",
timep, year, tm->tm_yday, tm->tm_hour, tm->tm_min,
tm->tm_sec, msec);
-
return bp;
}
diff --git a/usr.sbin/xntpd/lib/uinttoa.c b/usr.sbin/xntpd/lib/uinttoa.c
index ce29390..7c406dd 100644
--- a/usr.sbin/xntpd/lib/uinttoa.c
+++ b/usr.sbin/xntpd/lib/uinttoa.c
@@ -1,4 +1,4 @@
-/* uinttoa.c,v 3.1 1993/07/06 01:08:54 jbj Exp
+/*
* uinttoa - return an asciized unsigned integer
*/
#include <stdio.h>
@@ -8,12 +8,12 @@
char *
uinttoa(uval)
- U_LONG uval;
+ u_long uval;
{
register char *buf;
LIB_GETBUF(buf);
- (void) sprintf(buf, "%lu", uval);
+ (void) sprintf(buf, "%lu", (u_long)uval);
return buf;
}
diff --git a/usr.sbin/xntpd/lib/utvtoa.c b/usr.sbin/xntpd/lib/utvtoa.c
index b573f18..48310a8 100644
--- a/usr.sbin/xntpd/lib/utvtoa.c
+++ b/usr.sbin/xntpd/lib/utvtoa.c
@@ -1,4 +1,4 @@
-/* utvtoa.c,v 3.1 1993/07/06 01:08:55 jbj Exp
+/*
* utvtoa - return an asciized representation of an unsigned struct timeval
*/
#include <stdio.h>
@@ -15,7 +15,7 @@ utvtoa(tv)
LIB_GETBUF(buf);
- (void) sprintf(buf, "%lu.%06lu", (U_LONG)tv->tv_sec,
- (U_LONG)tv->tv_usec);
+ (void) sprintf(buf, "%lu.%06lu", (u_long)tv->tv_sec,
+ (u_long)tv->tv_usec);
return buf;
}
OpenPOWER on IntegriCloud