Index: Makefile
===================================================================
--- Makefile (nonexistent)
+++ Makefile (revision 5)
@@ -0,0 +1,55 @@
+
+COMPONENT_TARGETS = $(HARDWARE_NOARCH)
+
+
+include ../../../../build-system/constants.mk
+
+
+url = $(DOWNLOAD_SERVER)/sources/packages/n/netdate
+
+pkgname = netdate
+suffix = tar.gz
+
+tarballs = $(addsuffix .$(suffix), $(pkgname))
+sha1s = $(addsuffix .sha1sum, $(tarballs))
+
+patches = $(CURDIR)/patches/netdate.patch
+
+.NOTPARALLEL: $(patches)
+
+
+BUILD_TARGETS = $(tarballs) $(sha1s) $(patches)
+
+
+include ../../../../build-system/core.mk
+
+
+.PHONY: download_clean
+
+
+$(tarballs):
+ @echo -e "\n======= Downloading source tarballs =======" ; \
+ for tarball in $(tarballs) ; do \
+ echo "$(url)/$$tarball" | xargs -n 1 -P 100 wget $(WGET_OPTIONS) - & \
+ done ; wait
+
+$(sha1s): $(tarballs)
+ @for sha in $@ ; do \
+ echo -e "\n======= Downloading '$$sha' signature =======\n" ; \
+ echo "$(url)/$$sha" | xargs -n 1 -P 100 wget $(WGET_OPTIONS) - & wait %1 ; \
+ touch $$sha ; \
+ echo -e "\n======= Check the '$$sha' sha1sum =======\n" ; \
+ sha1sum --check $$sha ; ret="$$?" ; \
+ if [ "$$ret" == "1" ]; then \
+ echo -e "\n======= ERROR: Bad '$$sha' sha1sum =======\n" ; \
+ exit 1 ; \
+ fi ; \
+ done
+
+$(patches): $(sha1s)
+ @echo -e "\n======= Create Patches =======\n" ; \
+ ( cd create-make-patch ; ./create.patch.sh ) ; \
+ echo -e "\n"
+
+download_clean:
+ @rm -f $(tarballs) $(sha1s) $(patches)
Index: create-make-patch/create.patch.sh
===================================================================
--- create-make-patch/create.patch.sh (nonexistent)
+++ create-make-patch/create.patch.sh (revision 5)
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+VERSION=none
+
+tar --files-from=file.list -xzvf ../netdate.tar.gz
+mv netdate netdate-orig
+
+cp -rf ./netdate-new ./netdate
+
+diff --unified -Nr netdate-orig netdate > netdate.patch
+
+mv netdate.patch ../patches
+
+rm -rf ./netdate
+rm -rf ./netdate-orig
Property changes on: create-make-patch/create.patch.sh
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: create-make-patch/file.list
===================================================================
--- create-make-patch/file.list (nonexistent)
+++ create-make-patch/file.list (revision 5)
@@ -0,0 +1,3 @@
+netdate/Makefile
+netdate/netdate.8
+netdate/netdate.c
Index: create-make-patch/netdate-new/Makefile
===================================================================
--- create-make-patch/netdate-new/Makefile (nonexistent)
+++ create-make-patch/netdate-new/Makefile (revision 5)
@@ -0,0 +1,18 @@
+
+WARNINGS = -Wall -W -Wpointer-arith -Wbad-function-cast -Wcast-qual \
+ -Wstrict-prototypes -Wmissing-prototypes \
+ -Wmissing-declarations -Wnested-externs -Winline -Wcast-align
+
+CFLAGS += -g $(WARNINGS)
+
+all: netdate
+
+netdate: netdate.o
+
+install: netdate
+ install -s netdate /usr/sbin/
+ install -m 0644 netdate.8 /usr/man/man8/
+
+clean:
+ rm -f netdate *~ *.o core
+
Index: create-make-patch/netdate-new/netdate.8
===================================================================
--- create-make-patch/netdate-new/netdate.8 (nonexistent)
+++ create-make-patch/netdate-new/netdate.8 (revision 5)
@@ -0,0 +1,106 @@
+.TH NETDATE 8L 85/08/21
+.UC 4
+.SH NAME
+netdate \- set date and time by ARPA Internet RFC 868
+.SH SYNOPSIS
+.B
+netdate
+[ \-v ] [ \-l limit ] [ protocol ] hostname...
+.SH DESCRIPTION
+\fINetdate\fP takes a list of names of Internet hosts as arguments,
+selects the one which supplies the best time, and sets
+the system time accordingly.
+The invoker must be the super-user for the time to be set.
+Protocol names (either \fBudp\fP or \fBtcp\fP) may be
+interspersed with the host names, and determine the
+protocol which will be used to connect to the hosts
+whose names follow, up to the next protocol name or
+the end of the arguments.
+The default protocol is \fBudp\fP.
+.PP
+The ``best'' time is chosen by polling the named hosts
+once each to find their times and taking their differences
+from the local host's time.
+These differences are used to find the largest group of hosts
+whose times agree with each other within a certain limit.
+The first host in the largest group is picked as the best host.
+(The assumption is that the hosts which are usually most accurate
+will be named first.)
+That host is polled again and the local host's time is set to the result.
+The chosen host's time is checked on this second poll to insure that
+its difference from the local host's time has not varied more than the limit
+from its difference at the first poll.
+.PP
+The default limit is five seconds. It may be set with the \fB\-l\fP option.
+The \fB\-v\fP option causes the groups to be shown.
+The host name \fBlocalhost\fP is recognized as a synonym for the name
+of the local host, no network connection is made for it, and its
+time difference is always zero.
+If \fBlocalhost\fP is chosen as having the best time,
+the system time will not be set.
+Hosts which do not respond are not counted in the groups.
+If the limit is set to zero, the time is set to that of the
+first host to respond and no other checking is done.
+Supplying only one host name argument also sets the limit to zero.
+.PP
+While the RFC868 protocol only returns 32\ bits of data, containing
+the time in seconds, \fInetdate\fP will accept an extra 32\ bits,
+containing microseconds (expected to be accurate to no more than milliseconds).
+Delays on long haul networks may make this extra precision useless,
+but it is useful on local area networks.
+The extra precision is not used on the first poll of a host,
+but it is used on the second poll of the chosen host,
+if that host supplies it.
+.SH EXAMPLE
+The most accurate hosts are named first in each example.
+Some such call on \fInetdate\fP should be put at the end of
+\fB/etc/rc.d/rc.local\fP,
+so that the time will be set properly on system startup.
+It is also useful to have a shell script, e.g., \fB/sbin/timehosts\fP,
+which contains a call on \fInetdate\fP with arguments appropriate
+to the local system, so that it is easy to set the time manually.
+.SH "netdate -l 30 udp dcn\-gate tcp neighbor"
+\fIDcn\-gate\fP is a hypothetical host which usually keeps time
+accurate to within milliseconds of Coordinated Universal Time,
+but may occasionally be eight hours off.
+\fINeighbor\fP is a neighbor of the local host which keeps time
+with moderate accuracy.
+The time will be set to that of \fIdcn\-gate\fP if that and \fIneighbor\fP
+agree to within thirty seconds, else it will not be set at all.
+This is almost good enough for most circumstances, but won't do
+when the local host's time is known to be wrong (e.g., after
+a long downtime or a bad crash) and must be set to something.
+If one of the hosts named is inaccurate or not responding, there is a problem.
+.SH "netdate -l 30 udp dcn\-gate tcp neighbor neighbor2"
+Only two of the three hosts named must agree on the time.
+The time will still be set (to that of the first neighbor),
+even if \fIdcn\-gate\fP is far off as long as the two neighbors agree.
+This is probably good enough for most cases.
+One can arbitrarily gerrymander the vote for more insurance
+(and less clarity), as in the following example.
+.SH "netdate\ udp\ dcn\-gate\ dcn1\ tcp\ bbn\-unix\ localhost\ neighbor"
+Here \fIdcn1\fP and \fIbbn\-unix\fP are more hypothetical very accurate
+timekeepers, at least one of which keeps time independently from
+\fIdcn\-gate\fP, one hopes.
+It is very likely that the time will be set to that one of those three
+very accurate hosts, as long as at least two of them agree, or at least
+one of them agrees with the neighbor or the local host's time.
+If all the foreign hosts disagree, the time will not be set,
+since \fBlocalhost\fP will be chosen as best.
+.SH "netdate\ \-l\ 3\ localhost\ localhost\ udp\ dcn\-gate\ dcn1\ tcp\ bbn\-unix"
+This example gives \fBlocalhost\fP two votes and declares it to usually
+have the most accurate time.
+All three foreign hosts must agree within three seconds
+and also differ from \fBlocalhosts\fP by more than three seconds
+for the time to be set.
+Thus the time will be set only if it really needs to be.
+.SH FILES
+.nf
+/etc/services for the time service port number
+/etc/protocols for the protocol numbers
+/var/log/wtmp to record time-setting
+.SH SEE ALSO
+ARPANET Request for Comments 868, gettimeofday(2), date(1),
+WWV (USA):
+2.5,5,10,15 MHz AM for Coordinated Universal Time (UCT).
+.SH DIAGNOSTICS
Index: create-make-patch/netdate-new/netdate.c
===================================================================
--- create-make-patch/netdate-new/netdate.c (nonexistent)
+++ create-make-patch/netdate-new/netdate.c (revision 5)
@@ -0,0 +1,510 @@
+/*
+ NO WARRANTY
+
+ THERE IS NO WARRANTY FOR THIS PROGRAM, TO THE EXTENT PERMITTED BY
+ APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+ HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+ OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+ IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
+ ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+ REDISTRIBUTE THE PROGRAM, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+ GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+ USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+ DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+ EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGES.
+
+ */
+
+#ifndef lint
+ char sccsid[]="@(#) netdate.c 1.16 85/08/21";
+#endif
+#include <sys/param.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <time.h>
+
+#include <netinet/in.h>
+
+#include <fcntl.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <netdb.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <utmp.h>
+#define WTMP "/var/log/wtmp"
+
+#ifndef __GLIBC__
+struct utmp wtmp[2] = {
+ { 0, 0, "|", "", 0, "", "", 0},
+ { 0, 0, "{", "", 0, "", "", 0}
+};
+#else
+struct utmp wtmp[2] = {
+ { 0, 0, "|", "", "", "", {0, 0}, 0, {0, 0}, {0, 0, 0, 0}, "" },
+ { 0, 0, "|", "", "", "", {0, 0}, 0, {0, 0}, {0, 0, 0, 0}, "" },
+};
+#endif
+
+char *service = "time";
+char *defaultproto = "udp";
+/* difference between 1900 (RFC868) and 1970 (UNIX) base times */
+#define NETBASE 2208988800u
+
+long limit = 5;
+#define MAXHOSTS 20
+
+#define LOCALHOST "localhost"
+char *whoami;
+char hostname[65];
+struct timeval now;
+struct timehost {
+ char *hostname;
+ short local;
+ short bad;
+ char *protoname;
+ long protonumber;
+ int socktype;
+ struct timeval asked;
+ struct timeval then;
+ struct timeval acked;
+ long difference;
+ long count;
+} timehosts[MAXHOSTS];
+struct timehost *tophost = &timehosts[MAXHOSTS];
+
+void usage (void);
+int setproto (char *, struct timehost *);
+int getdiff (struct timehost *);
+int getdate (struct timehost *);
+void printit (struct timehost *);
+void tvsub (struct timeval *, struct timeval *, struct timeval *);
+void printdiff (char *, struct timeval *);
+void timeout (int);
+long getport (char *protoname);
+
+static int internettime (struct timehost *thishost);
+struct timehost *mungediffs(struct timehost *);
+
+
+void
+usage (void)
+{
+ fprintf (stderr,
+"usage: %s [ -l limit ] host ...\n"
+"%s tries to find a group of at least two hosts whose times agree\n"
+"within %ld seconds, and sets the time to that of the first host in the group.\n",
+ whoami, whoami, limit);
+ fprintf (stderr,
+"The limit may be set with the -l option. Setting it to zero (or supplying\n"
+"only one host name argument) will set the time to that of the first host to\n"
+"respond. The caller must be super-user for the system time to be set.\n");
+
+ exit (1);
+}
+
+int rdate = 0;
+int verbose = 0;
+int debug = 0;
+
+int
+main (int argc, char **argv)
+{
+ register struct timehost *thishost;
+ int hostargs = 0;
+
+ /* skip warning: unused argc */
+ argc = argc;
+
+ if ((whoami = rindex(*argv, '/')) != NULL)
+ whoami++;
+ else
+ whoami = *argv;
+ if (strcmp (whoami, "rdate") == 0) { /* emulate SMI rdate command */
+ rdate = 1;
+ defaultproto = "tcp";
+ limit = 0;
+ }
+ if (gethostname(hostname, (int)sizeof (hostname)) == -1) {
+ perror ("gethostname");
+ exit (1);
+ }
+ while (*++argv != NULL && **argv == '-') {
+ switch (argv[0][1]) {
+ case 'd':
+ debug++;
+ break;
+ case 'v':
+ verbose++;
+ break;
+ case 'l':
+ if (*++argv == NULL)
+ usage();
+ limit = atoi(*argv);
+ break;
+ default:
+ fprintf (stderr, "Unknown option: %s\n", *argv);
+ usage();
+ break;
+ }
+ }
+ if (*argv == NULL)
+ usage();
+ if (debug)
+ fprintf (stderr, "%s: rdate %d; verbose %d; limit %ld.\n",
+ whoami, rdate, verbose, limit);
+ for (thishost = &timehosts[0]; *argv != NULL; argv++) {
+ if (thishost >= tophost) {
+ fprintf(stderr, "Too many hosts: ignoring");
+ do {
+ fprintf (stderr, " %s", *argv);
+ } while (*++argv != NULL);
+ fprintf (stderr, "\n");
+ break;
+ }
+ if (setproto(*argv, thishost))
+ continue;
+ thishost -> hostname = *argv;
+ thishost -> bad = 0;
+ if (strcmp (thishost -> hostname, LOCALHOST) == 0)
+ thishost -> local = 1;
+ if (++hostargs == 1 && argv[1] == NULL) /* Only one host arg, */
+ limit = 0; /* so just set to it. */
+ if (limit == 0) {
+ if (!getdate(thishost))
+ continue;
+ exit(0);
+ }
+ if (!getdiff (thishost))
+ continue;
+ thishost++;
+ }
+ if (limit == 0)
+ exit(1);
+ if (thishost == &timehosts[0])
+ exit(1);
+ if ((thishost = mungediffs(thishost)) == NULL) {
+ fprintf (stderr,
+ "No two hosts agree on the time within %ld seconds\n",
+ limit);
+ exit(1);
+ }
+ if (!getdate (thishost))
+ exit (1);
+ exit(0);
+}
+
+int
+setproto(char *what, struct timehost *thishost)
+{
+ static char *protoname;
+ static long protonumber;
+ static int socktype;
+ register struct protoent *pp;
+
+ setprotoent(1);
+ if ((pp = getprotobyname (what)) == NULL) {
+ if (protoname == NULL)
+ if (!setproto(defaultproto, thishost)) {
+ fprintf(stderr,
+ "Default protocol %s was not found in /etc/protocols.\n",
+ defaultproto);
+ exit(1);
+ }
+ thishost -> protoname = protoname;
+ thishost -> protonumber = protonumber;
+ thishost -> socktype = socktype;
+ return(0);
+ }
+ protoname = what; /*pp -> p_name; this is static: don't use it.*/
+ protonumber = pp -> p_proto;
+ switch (protonumber) {
+ case IPPROTO_TCP:
+ socktype = SOCK_STREAM;
+ if (debug)
+ fprintf(stderr, "%s SOCK_STREAM\n", protoname);
+ break;
+ case IPPROTO_UDP:
+ socktype = SOCK_DGRAM;
+ if (debug)
+ fprintf(stderr, "%s SOCK_DGRAM\n", protoname);
+ break;
+ default:
+ fprintf(stderr, "Unknown protocol: %s\n", protoname);
+ exit(1);
+ break;
+ }
+ return(1);
+}
+
+int
+getdiff(struct timehost *thishost)
+{
+ if (!internettime (thishost))
+ return(0);
+ thishost -> difference = thishost -> then.tv_sec - now.tv_sec;
+ if (!rdate)
+ printit(thishost);
+ return(1);
+}
+
+
+/*
+ Find the largest group of hosts which agree within the limit
+ and return the first of that group. If no two hosts agree,
+ give up.
+ */
+
+struct timehost *
+mungediffs(struct timehost *tophost)
+{
+ register struct timehost *thishost, *ahost, *goodhost;
+ long diff;
+
+ tophost--; /* simplifies the comparisons */
+ goodhost = &timehosts[0];
+ for (thishost = &timehosts[0]; thishost < tophost; thishost++) {
+ if (thishost -> bad)
+ continue;
+ thishost -> count = 1;
+ if (verbose)
+ printf ("%s", thishost -> hostname);
+ for (ahost = thishost + 1; ahost <= tophost; ahost++) {
+ if (thishost -> bad)
+ continue;
+ diff = ahost -> difference - thishost -> difference;
+ if (abs(diff) < limit) {
+ thishost -> count++;
+ if (verbose)
+ printf (" %s", ahost -> hostname);
+ }
+ }
+ if (verbose) {
+ printf (" %ld\n", thishost -> count);
+ (void)fflush(stdout);
+ }
+ if (thishost -> count > goodhost -> count)
+ goodhost = thishost;
+ }
+ if (goodhost -> count > 1)
+ return(goodhost);
+ return(NULL);
+}
+
+int
+getdate (struct timehost *thishost)
+{
+ int set = 0;
+
+ if (!internettime (thishost))
+ return (0);
+ if (thishost -> local) {
+ printf ("Local host %s has best time, so not setting date\n",
+ hostname);
+ printit(thishost);
+ exit(0);
+ }
+ if (limit != 0
+ && abs((thishost -> then.tv_sec - now.tv_sec) - thishost -> difference)
+ > limit) {
+ fprintf (stderr,
+ "Time from %s has varied more than the limit of %ld seconds\n",
+ thishost -> hostname, limit);
+ printit(thishost);
+ exit(1);
+ }
+ if (settimeofday (&thishost -> then, (struct timezone *)0) == -1)
+ perror ("netdate: settimeofday");
+ else {
+ int wf;
+ if ((wf = open(WTMP, 1)) >= 0) {
+ wtmp[0].ut_time = now.tv_sec;
+ wtmp[1].ut_time = thishost -> then.tv_sec;
+ (void)lseek(wf, 0L, 2);
+ (void)write(wf, (char *)wtmp, sizeof(wtmp));
+ (void)close(wf);
+ }
+ set = 1;
+ }
+ printit(thishost);
+ return(set);
+}
+
+void
+printit(struct timehost *thishost)
+{
+ struct tm *tp;
+ struct timeval diff;
+ char newstring[128];
+
+ if (rdate)
+ printf ("%s", ctime((const time_t *)&thishost -> then.tv_sec));
+ else {
+ (void)sprintf(newstring, "%s ", thishost -> hostname);
+ tvsub(&diff, &thishost -> then, &now);
+ printdiff(&newstring[strlen(newstring)], &diff);
+ printf ("%-24s %.19s.%03ld", newstring,
+ ctime((const time_t *)&thishost -> then.tv_sec),
+ thishost -> then.tv_usec / 1000);
+ if (verbose) {
+ tp = localtime((const time_t *)&thishost -> acked);
+ printf(" at %02d:%02d:%02d.%03ld",
+ tp -> tm_hour, tp -> tm_min, tp -> tm_sec,
+ thishost -> acked.tv_usec / 1000);
+ tvsub(&diff, &thishost -> acked, &thishost -> asked);
+ printdiff(newstring, &diff);
+ printf(" delay %s", newstring);
+ }
+ printf("\n");
+ }
+ (void)fflush (stdout);
+}
+
+void
+tvsub(tdiff, t1, t0)
+struct timeval *tdiff, *t1, *t0;
+{
+ tdiff->tv_sec = t1->tv_sec - t0->tv_sec;
+ tdiff->tv_usec = t1->tv_usec - t0->tv_usec;
+ if (tdiff->tv_sec < 0 && tdiff->tv_usec > 0)
+ tdiff->tv_sec++, tdiff->tv_usec -= 1000000;
+ if (tdiff->tv_sec > 0 && tdiff->tv_usec < 0)
+ tdiff->tv_sec--, tdiff->tv_usec += 1000000;
+}
+
+void
+printdiff(char *where, struct timeval *diff)
+{
+ (void) sprintf (where, "%c%d.%.03d",
+ (diff->tv_sec < 0 || diff->tv_usec < 0) ? '-' : '+',
+ abs(diff->tv_sec), abs(diff->tv_usec) / 1000);
+}
+
+static jmp_buf jb;
+void
+timeout( int arg )
+{
+ arg = arg;
+ longjmp(jb, 1);
+}
+
+static int
+internettime (struct timehost *thishost)
+{
+ register struct hostent *hp;
+ struct sockaddr_in sin;
+ long port;
+ int nread;
+ static int s = -1;
+
+ if (thishost -> local) {
+ if (gettimeofday (&now, (struct timezone *)0) == -1) {
+ perror ("netdate: gettimeofday");
+ exit (1);
+ }
+ thishost -> asked = now;
+ thishost -> then = now;
+ thishost -> acked = now;
+ return(1);
+ }
+ timerclear(&thishost -> then);
+ if (setjmp(jb))
+ goto bad;
+ (void)signal(SIGALRM, timeout);
+ if (s != -1)
+ (void) close (s), s = -1;
+ port = getport(thishost -> protoname);
+ bzero((char *)&sin, sizeof (sin));
+ sethostent(1);
+ if ((hp = gethostbyname(thishost -> hostname)) == NULL) {
+ fprintf(stderr, "%s: %s: unknown host\n",
+ whoami, thishost -> hostname);
+ goto out;
+ }
+ sin.sin_family = hp->h_addrtype;
+ (void)alarm(20);
+ s = socket(hp->h_addrtype, thishost -> socktype, 0 /*protonumber*/);
+ if (s < 0) {
+ perror("netdate: socket");
+ (void)alarm(0);
+ goto out;
+ }
+ if (thishost -> socktype == SOCK_STREAM) {
+ if (bind(s, (struct sockaddr *)&sin, sizeof (sin)) < 0) {
+ perror("netdate: bind");
+ goto bad;
+ }
+ }
+ bcopy(hp->h_addr, (char *)&sin.sin_addr, hp->h_length);
+ sin.sin_port = port;
+ (void)gettimeofday (&thishost -> asked, (struct timezone *)0);
+ if (connect(s, (struct sockaddr *)&sin, sizeof (sin)) < 0) {
+ perror("netdate: connect");
+ goto bad;
+ }
+
+ if (thishost -> socktype == SOCK_DGRAM) {
+ if (send (s, "\n", 1, 0) < 0) {
+ perror ("netdate: send");
+ goto bad;
+ }
+ }
+ nread = recv (s, (char *)&thishost -> then, sizeof (thishost -> then), 0);
+ (void)gettimeofday (&thishost -> acked, (struct timezone *)0);
+ (void)alarm(0);
+ now = thishost -> acked;
+
+ if (nread != 4) {
+ perror ("netdate: read");
+ goto bad;
+ }
+
+ /* RFC 868 only allows seconds, but what the hell */
+ if (nread == sizeof(thishost -> then))
+ thishost -> then.tv_usec = ntohl(thishost -> then.tv_usec);
+ else
+ thishost -> then.tv_usec = 0L;
+ thishost -> then.tv_sec = ntohl (thishost -> then.tv_sec) - NETBASE;
+ return (1); /* don't close before returning to avoid delays */
+bad:
+ (void)alarm(0);
+ (void) close (s), s = -1;
+out:
+ if (gettimeofday (&now, (struct timezone *)0) == -1) {
+ perror ("netdate: gettimeofday");
+ exit (1);
+ }
+ thishost -> asked = now;
+ thishost -> then = now;
+ thishost -> acked = now;
+ thishost -> bad = 1;
+ fprintf (stderr, "Connection with %s to %s failed.\n",
+ thishost -> protoname, thishost -> hostname);
+ return(0);
+}
+
+long
+getport(char *protoname)
+{
+ register struct servent *sp;
+ static long port;
+
+ if (port != 0)
+ return(port);
+ if ((sp = getservbyname(service, protoname)) == 0) {
+ fprintf(stderr, "%s: %s/%s: unknown service\n",
+ whoami, service, protoname);
+ exit(1);
+ }
+ return (port = sp->s_port);
+}
Index: create-make-patch/netdate-new
===================================================================
--- create-make-patch/netdate-new (nonexistent)
+++ create-make-patch/netdate-new (revision 5)
Property changes on: create-make-patch/netdate-new
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,73 ##
+
+# install dir
+dist
+
+# Target build dirs
+.a1x-newlib
+.a2x-newlib
+.at91sam7s-newlib
+
+.build-machine
+
+.a1x-glibc
+.a2x-glibc
+.h3-glibc
+.h5-glibc
+.i586-glibc
+.i686-glibc
+.imx6-glibc
+.jz47xx-glibc
+.makefile
+.am335x-glibc
+.omap543x-glibc
+.p5600-glibc
+.power8-glibc
+.power8le-glibc
+.power9-glibc
+.power9le-glibc
+.m1000-glibc
+.riscv64-glibc
+.rk328x-glibc
+.rk33xx-glibc
+.rk339x-glibc
+.s8xx-glibc
+.s9xx-glibc
+.x86_64-glibc
+
+# Hidden files (each file)
+.makefile
+.dist
+.rootfs
+
+# src & hw requires
+.src_requires
+.src_requires_depend
+.requires
+.requires_depend
+
+# Tarballs
+*.gz
+*.bz2
+*.lz
+*.xz
+*.tgz
+*.txz
+
+# Signatures
+*.asc
+*.sig
+*.sign
+*.sha1sum
+
+# Patches
+*.patch
+
+# Descriptions
+*.dsc
+*.txt
+
+# Default linux config files
+*.defconfig
+
+# backup copies
+*~
Index: create-make-patch
===================================================================
--- create-make-patch (nonexistent)
+++ create-make-patch (revision 5)
Property changes on: create-make-patch
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,73 ##
+
+# install dir
+dist
+
+# Target build dirs
+.a1x-newlib
+.a2x-newlib
+.at91sam7s-newlib
+
+.build-machine
+
+.a1x-glibc
+.a2x-glibc
+.h3-glibc
+.h5-glibc
+.i586-glibc
+.i686-glibc
+.imx6-glibc
+.jz47xx-glibc
+.makefile
+.am335x-glibc
+.omap543x-glibc
+.p5600-glibc
+.power8-glibc
+.power8le-glibc
+.power9-glibc
+.power9le-glibc
+.m1000-glibc
+.riscv64-glibc
+.rk328x-glibc
+.rk33xx-glibc
+.rk339x-glibc
+.s8xx-glibc
+.s9xx-glibc
+.x86_64-glibc
+
+# Hidden files (each file)
+.makefile
+.dist
+.rootfs
+
+# src & hw requires
+.src_requires
+.src_requires_depend
+.requires
+.requires_depend
+
+# Tarballs
+*.gz
+*.bz2
+*.lz
+*.xz
+*.tgz
+*.txz
+
+# Signatures
+*.asc
+*.sig
+*.sign
+*.sha1sum
+
+# Patches
+*.patch
+
+# Descriptions
+*.dsc
+*.txt
+
+# Default linux config files
+*.defconfig
+
+# backup copies
+*~
Index: patches/README
===================================================================
--- patches/README (nonexistent)
+++ patches/README (revision 5)
@@ -0,0 +1,6 @@
+
+/* begin *
+
+ TODO: Leave some comment here.
+
+ * end */
Index: patches
===================================================================
--- patches (nonexistent)
+++ patches (revision 5)
Property changes on: patches
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,73 ##
+
+# install dir
+dist
+
+# Target build dirs
+.a1x-newlib
+.a2x-newlib
+.at91sam7s-newlib
+
+.build-machine
+
+.a1x-glibc
+.a2x-glibc
+.h3-glibc
+.h5-glibc
+.i586-glibc
+.i686-glibc
+.imx6-glibc
+.jz47xx-glibc
+.makefile
+.am335x-glibc
+.omap543x-glibc
+.p5600-glibc
+.power8-glibc
+.power8le-glibc
+.power9-glibc
+.power9le-glibc
+.m1000-glibc
+.riscv64-glibc
+.rk328x-glibc
+.rk33xx-glibc
+.rk339x-glibc
+.s8xx-glibc
+.s9xx-glibc
+.x86_64-glibc
+
+# Hidden files (each file)
+.makefile
+.dist
+.rootfs
+
+# src & hw requires
+.src_requires
+.src_requires_depend
+.requires
+.requires_depend
+
+# Tarballs
+*.gz
+*.bz2
+*.lz
+*.xz
+*.tgz
+*.txz
+
+# Signatures
+*.asc
+*.sig
+*.sign
+*.sha1sum
+
+# Patches
+*.patch
+
+# Descriptions
+*.dsc
+*.txt
+
+# Default linux config files
+*.defconfig
+
+# backup copies
+*~
Index: .
===================================================================
--- . (nonexistent)
+++ . (revision 5)
Property changes on: .
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,73 ##
+
+# install dir
+dist
+
+# Target build dirs
+.a1x-newlib
+.a2x-newlib
+.at91sam7s-newlib
+
+.build-machine
+
+.a1x-glibc
+.a2x-glibc
+.h3-glibc
+.h5-glibc
+.i586-glibc
+.i686-glibc
+.imx6-glibc
+.jz47xx-glibc
+.makefile
+.am335x-glibc
+.omap543x-glibc
+.p5600-glibc
+.power8-glibc
+.power8le-glibc
+.power9-glibc
+.power9le-glibc
+.m1000-glibc
+.riscv64-glibc
+.rk328x-glibc
+.rk33xx-glibc
+.rk339x-glibc
+.s8xx-glibc
+.s9xx-glibc
+.x86_64-glibc
+
+# Hidden files (each file)
+.makefile
+.dist
+.rootfs
+
+# src & hw requires
+.src_requires
+.src_requires_depend
+.requires
+.requires_depend
+
+# Tarballs
+*.gz
+*.bz2
+*.lz
+*.xz
+*.tgz
+*.txz
+
+# Signatures
+*.asc
+*.sig
+*.sign
+*.sha1sum
+
+# Patches
+*.patch
+
+# Descriptions
+*.dsc
+*.txt
+
+# Default linux config files
+*.defconfig
+
+# backup copies
+*~