FreeBSD/contrib/ntp/util/tickadj.c
/*
 * readvar - read a variable from the file
 */
read a variable from the file
read a variable from the file
static void
readvar(
	int ifd,
	off_t off,
	int *var
	)
{
	int i;
	if (lseek(ifd, off, L_SET) == -1)
	{
		(void) fprintf(stderr, "%s: lseek fails: ", progname);
		perror("");
		exit(1);
	}
	i = read(ifd, (char *)var, sizeof(int));
	if (i < 0)
	{
		(void) fprintf(stderr, "%s: read fails: ", progname);
		perror("");
		exit(1);
	}
	if (i != sizeof(int))
	{
		(void) fprintf(stderr, "%s: read expected %d, got %d\n",
			       progname, (int)sizeof(int), i);
		exit(1);
	}
	return;
}
static void readvar ( int ifd , off_t off , int * var ) { int i ; if ( lseek ( ifd , off , L_SET ) == -1 ) { ( void ) fprintf ( stderr , " " , progname ) ; perror ( " " ) ; exit ( 1 ) ; } i = read ( ifd , ( char * ) var , sizeof ( int ) ) ; if ( i < 0 ) { ( void ) fprintf ( stderr , " " , progname ) ; perror ( " " ) ; exit ( 1 ) ; } if ( i != sizeof ( int ) ) { ( void ) fprintf ( stderr , " \n " , progname , ( int ) sizeof ( int ) , i ) ; exit ( 1 ) ; } return ; }
readvar - read a variable from the file
readvar - read a variable from the file