usr.sbin/lpr/pac/pac.c
/*
 * Rewrite the summary file with the summary information we have accumulated.
 */
Rewrite the summary file with the summary information we have accumulated.
Rewrite the summary file with the summary information we have accumulated .
static void
rewrite()
{
	register struct hent *hp;
	register int i;
	register FILE *acctf;
	if ((acctf = fopen(sumfile, "w")) == NULL) {
		perror(sumfile);
		errs++;
		return;
	}
	for (i = 0; i < HSHSIZE; i++) {
		hp = hashtab[i];
		while (hp != NULL) {
			fprintf(acctf, "%7.2f\t%s\t%d\n", hp->h_feetpages,
			    hp->h_name, hp->h_count);
			hp = hp->h_link;
		}
	}
	fflush(acctf);
	if (ferror(acctf)) {
		perror(sumfile);
		errs++;
	}
	fclose(acctf);
	if ((acctf = fopen(acctfile, "w")) == NULL)
		perror(acctfile);
	else
		fclose(acctf);
}
static void rewrite ( ) { register struct hent * hp ; register int i ; register FILE * acctf ; if ( ( acctf = fopen ( sumfile , " " ) ) == NULL ) { perror ( sumfile ) ; errs ++ ; return ; } for ( i = 0 ; i < HSHSIZE ; i ++ ) { hp = hashtab [ i ] ; while ( hp != NULL ) { fprintf ( acctf , " \t \t \n " , hp -> h_feetpages , hp -> h_name , hp -> h_count ) ; hp = hp -> h_link ; } } fflush ( acctf ) ; if ( ferror ( acctf ) ) { perror ( sumfile ) ; errs ++ ; } fclose ( acctf ) ; if ( ( acctf = fopen ( acctfile , " " ) ) == NULL ) perror ( acctfile ) ; else fclose ( acctf ) ; }
Rewrite the summary file with the summary information we have accumulated.
Rewrite the summary file with the summary information we have accumulated .