FreeBSD/sbin/recoverdisk/recoverdisk.c
/* Read the worklist if -r was given */
Read the worklist if -r was given
Read the worklist if - r was given
static off_t
read_worklist(off_t t)
{
	off_t s, l, d;
	int state, lines;
	FILE *file;
	(void)fprintf(stderr, "Reading worklist ...");
	fflush(stderr);
	file = fopen(rworklist, "r");
	if (file == NULL)
		err(1, "Error opening file %s", rworklist);
	lines = 0;
	d = t;
	for (;;) {
		++lines;
		if (3 != fscanf(file, "%jd %jd %d\n", &s, &l, &state)) {
			if (!feof(file))
				err(1, "Error parsing file %s at line %d",
				    rworklist, lines);
			else
				break;
		}
		new_lump(s, l, state);
		d -= l;
	}
	(void)fprintf(stderr, " done.\n");
	return (d);
}
static off_t read_worklist ( off_t t ) { off_t s , l , d ; int state , lines ; FILE * file ; ( void ) fprintf ( stderr , " " ) ; fflush ( stderr ) ; file = fopen ( rworklist , " " ) ; if ( file == NULL ) err ( 1 , " " , rworklist ) ; lines = 0 ; d = t ; for ( ; ; ) { ++ lines ; if ( 3 != fscanf ( file , " \n " , & s , & l , & state ) ) { if ( ! feof ( file ) ) err ( 1 , " " , rworklist , lines ) ; else break ; } new_lump ( s , l , state ) ; d -= l ; } ( void ) fprintf ( stderr , " \n " ) ; return ( d ) ; }
Read the worklist if -r was given
Read the worklist if - r was given
/*
	 * Return the number of bytes already read
	 * (at least not in worklist).
	 */