FreeBSD/contrib/ntp/ntpd/refclock_arc.c
/*
Send command by copying into command buffer as far forward as possible,
after any pending output.

Indicate an error by returning 0 if there is not space for the command.
*/
Send command by copying into command buffer as far forward as possible,
after any pending output.

Indicate an error by returning 0 if there is not space for the command.
Send command by copying into command buffer as far forward as possible after any pending output . Indicate an error by returning 0 if there is not space for the command .
static int
send_slow(
	register struct arcunit *up,
	int fd,
	const char *s
	)
{
	int sl = strlen(s);
	int spaceleft = space_left(up);
#ifdef DEBUG
	if(debug > 1) { printf("arc: spaceleft = %d.\n", spaceleft); }
#endif
	if(spaceleft < sl) { 
#ifdef DEBUG
		msyslog(LOG_NOTICE, "ARCRON: send-buffer overrun (%d/%d)",
			sl, spaceleft);
#endif
		return(0);			
	}
	while(*s && spaceleft > 0) { up->cmdqueue[CMDQUEUELEN - spaceleft--] = *s++; }
	return(1);
}
static int send_slow ( register struct arcunit * up , int fd , const char * s ) { int sl = strlen ( s ) ; int spaceleft = space_left ( up ) ; #ifdef DEBUG if ( debug > 1 ) { printf ( " \n " , spaceleft ) ; } #endif if ( spaceleft < sl ) { #ifdef DEBUG msyslog ( LOG_NOTICE , " " , sl , spaceleft ) ; #endif return ( 0 ) ; } while ( * s && spaceleft > 0 ) { up -> cmdqueue [ CMDQUEUELEN - spaceleft -- ] = * s ++ ; } return ( 1 ) ; }
Send command by copying into command buffer as far forward as possible,
after any pending output.
Send command by copying into command buffer as far forward as possible after any pending output .
/* Should not normally happen... */ /* FAILED! */ /* Copy in the command to be sent. */