| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: refclock_acts.c,v 1.1.1.1 2009/12/13 16:55:43 kardel Exp $ */ | | 1 | /* $NetBSD: refclock_acts.c,v 1.2 2009/12/14 00:42:21 christos Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * refclock_acts - clock driver for the NIST/USNO/PTB/NPL Computer Time | | 4 | * refclock_acts - clock driver for the NIST/USNO/PTB/NPL Computer Time |
5 | * Services | | 5 | * Services |
6 | */ | | 6 | */ |
7 | #ifdef HAVE_CONFIG_H | | 7 | #ifdef HAVE_CONFIG_H |
8 | #include <config.h> | | 8 | #include <config.h> |
9 | #endif | | 9 | #endif |
10 | | | 10 | |
11 | #if defined(REFCLOCK) && (defined(CLOCK_ACTS) || defined(CLOCK_PTBACTS)) | | 11 | #if defined(REFCLOCK) && (defined(CLOCK_ACTS) || defined(CLOCK_PTBACTS)) |
12 | | | 12 | |
13 | #include "ntpd.h" | | 13 | #include "ntpd.h" |
14 | #include "ntp_io.h" | | 14 | #include "ntp_io.h" |
| @@ -320,27 +320,27 @@ acts_receive ( | | | @@ -320,27 +320,27 @@ acts_receive ( |
320 | pp->lencode = refclock_gtraw(rbufp, tbuf, BMAX - (up->bufptr - | | 320 | pp->lencode = refclock_gtraw(rbufp, tbuf, BMAX - (up->bufptr - |
321 | pp->a_lastcode), &pp->lastrec); | | 321 | pp->a_lastcode), &pp->lastrec); |
322 | for (tptr = tbuf; *tptr != '\0'; tptr++) { | | 322 | for (tptr = tbuf; *tptr != '\0'; tptr++) { |
323 | if (*tptr == LF) { | | 323 | if (*tptr == LF) { |
324 | if (up->bufptr == pp->a_lastcode) { | | 324 | if (up->bufptr == pp->a_lastcode) { |
325 | up->tstamp = pp->lastrec; | | 325 | up->tstamp = pp->lastrec; |
326 | continue; | | 326 | continue; |
327 | | | 327 | |
328 | } else { | | 328 | } else { |
329 | *up->bufptr = '\0'; | | 329 | *up->bufptr = '\0'; |
330 | acts_message(peer); | | 330 | acts_message(peer); |
331 | up->bufptr = pp->a_lastcode; | | 331 | up->bufptr = pp->a_lastcode; |
332 | } | | 332 | } |
333 | } else if (!iscntrl(*tptr)) { | | 333 | } else if (!iscntrl((unsigned char)*tptr)) { |
334 | *up->bufptr++ = *tptr; | | 334 | *up->bufptr++ = *tptr; |
335 | if (*tptr == '*' || *tptr == '#') { | | 335 | if (*tptr == '*' || *tptr == '#') { |
336 | up->tstamp = pp->lastrec; | | 336 | up->tstamp = pp->lastrec; |
337 | write(pp->io.fd, tptr, 1); | | 337 | write(pp->io.fd, tptr, 1); |
338 | } | | 338 | } |
339 | } | | 339 | } |
340 | } | | 340 | } |
341 | } | | 341 | } |
342 | | | 342 | |
343 | | | 343 | |
344 | /* | | 344 | /* |
345 | * acts_message - process message | | 345 | * acts_message - process message |
346 | */ | | 346 | */ |
| @@ -354,27 +354,27 @@ acts_message( | | | @@ -354,27 +354,27 @@ acts_message( |
354 | int dtr = TIOCM_DTR; | | 354 | int dtr = TIOCM_DTR; |
355 | char tbuf[SMAX]; | | 355 | char tbuf[SMAX]; |
356 | #ifdef DEBUG | | 356 | #ifdef DEBUG |
357 | u_int modem; | | 357 | u_int modem; |
358 | #endif | | 358 | #endif |
359 | | | 359 | |
360 | /* | | 360 | /* |
361 | * What to do depends on the state and the first token in the | | 361 | * What to do depends on the state and the first token in the |
362 | * message. */ | | 362 | * message. */ |
363 | pp = peer->procptr; | | 363 | pp = peer->procptr; |
364 | up = (struct actsunit *)pp->unitptr; | | 364 | up = (struct actsunit *)pp->unitptr; |
365 | #ifdef DEBUG | | 365 | #ifdef DEBUG |
366 | ioctl(pp->io.fd, TIOCMGET, (char *)&modem); | | 366 | ioctl(pp->io.fd, TIOCMGET, (char *)&modem); |
367 | snprintf(tbuf, sizeof(tbuf), "acts: %04x (%d %d) %d %s", modem, | | 367 | snprintf(tbuf, sizeof(tbuf), "acts: %04x (%d %d) %zu %s", modem, |
368 | up->state, up->timer, strlen(pp->a_lastcode), | | 368 | up->state, up->timer, strlen(pp->a_lastcode), |
369 | pp->a_lastcode); | | 369 | pp->a_lastcode); |
370 | if (debug) | | 370 | if (debug) |
371 | printf("%s\n", tbuf); | | 371 | printf("%s\n", tbuf); |
372 | #endif | | 372 | #endif |
373 | | | 373 | |
374 | /* | | 374 | /* |
375 | * Extract the first token in the line. A NO token sends the | | 375 | * Extract the first token in the line. A NO token sends the |
376 | * message to the clockstats. | | 376 | * message to the clockstats. |
377 | */ | | 377 | */ |
378 | strncpy(tbuf, pp->a_lastcode, SMAX); | | 378 | strncpy(tbuf, pp->a_lastcode, SMAX); |
379 | strtok(tbuf, " "); | | 379 | strtok(tbuf, " "); |
380 | if (strcmp(tbuf, "NO") == 0) { | | 380 | if (strcmp(tbuf, "NO") == 0) { |