usr.sbin/lpr/pac/pac.c
/*
 * Sort the hashed entries by name or footage
 * and print it all out.
 */
Sort the hashed entries by name or footage
and print it all out.
Sort the hashed entries by name or footage and print it all out .
static void
dumpit()
{
	struct hent **base;
	register struct hent *hp, **ap;
	register int hno, c, runs;
	float feet;
	hp = hashtab[0];
	hno = 1;
	base = (struct hent **) calloc(sizeof hp, hcount);
	for (ap = base, c = hcount; c--; ap++) {
		while (hp == NULL)
			hp = hashtab[hno++];
		*ap = hp;
		hp = hp->h_link;
	}
	qsort(base, hcount, sizeof hp, qucmp);
	printf("  Login               pages/feet   runs    price\n");
	feet = 0.0;
	runs = 0;
	for (ap = base, c = hcount; c--; ap++) {
		hp = *ap;
		runs += hp->h_count;
		feet += hp->h_feetpages;
		printf("%-24s %7.2f %4d   $%6.2f\n", hp->h_name,
		    hp->h_feetpages, hp->h_count, hp->h_feetpages * price);
	}
	if (allflag) {
		printf("\n");
		printf("%-24s %7.2f %4d   $%6.2f\n", "total", feet, 
		    runs, feet * price);
	}
}
static void dumpit ( ) { struct hent * * base ; register struct hent * hp , * * ap ; register int hno , c , runs ; float feet ; hp = hashtab [ 0 ] ; hno = 1 ; base = ( struct hent * * ) calloc ( sizeof hp , hcount ) ; for ( ap = base , c = hcount ; c -- ; ap ++ ) { while ( hp == NULL ) hp = hashtab [ hno ++ ] ; * ap = hp ; hp = hp -> h_link ; } qsort ( base , hcount , sizeof hp , qucmp ) ; printf ( " \n " ) ; feet = 0.0 ; runs = 0 ; for ( ap = base , c = hcount ; c -- ; ap ++ ) { hp = * ap ; runs += hp -> h_count ; feet += hp -> h_feetpages ; printf ( " \n " , hp -> h_name , hp -> h_feetpages , hp -> h_count , hp -> h_feetpages * price ) ; } if ( allflag ) { printf ( " \n " ) ; printf ( " \n " , " " , feet , runs , feet * price ) ; } }
Sort the hashed entries by name or footage
 and print it all out.
Sort the hashed entries by name or footage and print it all out .