+1999-12-04 Harlan Stenn <stenn@whimsy.udel.edu>
+
+ * ntpd/ntp_refclock.c (refclock_open): "flags" processing cleanup
+ (refclock_open): PPS device initialization cleanup
+ * include/ntp_refclock.h (LDISC_CHU):
+ (LDISC_PPS): Clean up comments
+ From: Dave Mills <mills@udel.edu>
+
1999-12-03 Sven Dietrich <sven_dietrich@trimble.com>
* libntp/mexit.c: Moved WINNT port specific file to ports/winnt/libntp
#define LDISC_CLK 0x1 /* tty_clk \n intercept */
#define LDISC_CLKPPS 0x2 /* tty_clk \377 intercept */
#define LDISC_ACTS 0x4 /* tty_clk #* intercept */
-#define LDISC_CHU 0x8 /* tty_chu */
-#define LDISC_PPS 0x10 /* ppsclock */
+#define LDISC_CHU 0x8 /* depredated */
+#define LDISC_PPS 0x10 /* ppsclock, ppsapi */
#define LDISC_RAW 0x20 /* raw binary */
struct refclockproc {
refclock_open(
char *dev, /* device name pointer */
int speed, /* serial port speed (code) */
- int flags /* line discipline flags */
+ int lflags /* line discipline flags */
)
{
int fd, i;
+ int flags;
#ifdef HAVE_TERMIOS
struct termios ttyb, *ttyp;
#endif /* HAVE_TERMIOS */
u_long ltemp;
#endif /* TIOCMGET */
+ flags = lflags;
+ if (strcmp(dev, pps_device) == 0)
+ flags |= LDISC_PPS;
+
/*
* Open serial port and set default options
*/
+ flags = lflags;
+ if (strcmp(dev, pps_device) == 0)
+ flags |= LDISC_PPS;
#ifdef O_NONBLOCK
fd = open(dev, O_RDWR | O_NONBLOCK, 0777);
#else
"refclock_open: fd %d ioctl failed: %m", fd);
return (0);
}
-
- /*
- * If this is the PPS device, so say and initialize the thing.
- */
- if (strcmp(dev, pps_device) == 0)
- (void)refclock_ioctl(fd, LDISC_PPS);
return (fd);
}
#endif /* HAVE_TERMIOS || HAVE_SYSV_TTYS || HAVE_BSD_TTYS */
* their many other variants. The routine returns 1 if success and 0 if
* failure.
*/
-int
+static int
refclock_ioctl(
int fd, /* file descriptor */
int flags /* line discipline flags */
* Open serial port
*/
(void)sprintf(gpsdev, DEVICE, unit);
- if (!(fd = refclock_open(gpsdev, SPEED232, LDISC_PPS))) {
+ if (!(fd = refclock_open(gpsdev, SPEED232))) {
return (0);
}
#ifdef HAVE_TIOCGPPSEV