FreeBSD/usr.sbin/lpr/common_source/displayq.c
/*
 * Print the job's rank in the queue,
 *   update col for screen management
 */
Print the job's rank in the queue,
update col for screen management
Print the job ' s rank in the queue update col for screen management
void
prank(int n)
{
	char rline[100];
	static const char *r[] = {
		"th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th"
	};
	if (n == 0) {
		printf("active");
		col += 6;
		return;
	}
	if ((n/10)%10 == 1)
		(void)snprintf(rline, sizeof(rline), "%dth", n);
	else
		(void)snprintf(rline, sizeof(rline), "%d%s", n, r[n%10]);
	col += strlen(rline);
	printf("%s", rline);
}
void prank ( int n ) { char rline [ 100 ] ; static const char * r [ ] = { " " , " " , " " , " " , " " , " " , " " , " " , " " , " " } ; if ( n == 0 ) { printf ( " " ) ; col += 6 ; return ; } if ( ( n / 10 ) % 10 == 1 ) ( void ) snprintf ( rline , sizeof ( rline ) , " " , n ) ; else ( void ) snprintf ( rline , sizeof ( rline ) , " " , n , r [ n % 10 ] ) ; col += strlen ( rline ) ; printf ( " " , rline ) ; }
Print the job's rank in the queue,
   update col for screen management
Print the job ' s rank in the queue update col for screen management