FreeBSD/usr.bin/lastcomm/readrec.c
/*
 * Read an accounting record stored at the current
 * position of stream f.
 * Old-format records are converted to the current record
 * format.
 * Return the number of records read (1 or 0 at the end-of-file),
 * or EOF on error.
 */
Read an accounting record stored at the current
position of stream f.
Old-format records are converted to the current record
format.
Return the number of records read (1 or 0 at the end-of-file),
or EOF on error.
Read an accounting record stored at the current position of stream f . Old - format records are converted to the current record format . Return the number of records read ( 1 or 0 at the end - of - file ) or EOF on error .
int
readrec_forward(FILE *f, struct acctv2 *av2)
{
	int magic, rv;
	if ((magic = getc(f)) == EOF)
		return (ferror(f) ? EOF : 0);
	if (ungetc(magic, f) == EOF)
		return (EOF);
	if (magic != 0)
		rv = readrec_v1(f, av2);
	else
		rv = readrec_vx(f, av2);
	return (rv == EOF ? EOF : 1);
}
int readrec_forward ( FILE * f , struct acctv2 * av2 ) { int magic , rv ; if ( ( magic = getc ( f ) ) == EOF ) return ( ferror ( f ) ? EOF : 0 ) ; if ( ungetc ( magic , f ) == EOF ) return ( EOF ) ; if ( magic != 0 ) rv = readrec_v1 ( f , av2 ) ; else rv = readrec_vx ( f , av2 ) ; return ( rv == EOF ? EOF : 1 ) ; }
Read an accounting record stored at the current
 position of stream f.
 Old-format records are converted to the current record
 format.
Read an accounting record stored at the current position of stream f . Old - format records are converted to the current record format .
/* Old record format. */ /* New record formats. */