usr.sbin/lpr/lpd/printjob.c
/*
 * Printer is on a remote host
 */
Printer is on a remote host
Printer is on a remote host
static void
openrem()
{
	register int i, n;
	int resp, port;
	for (i = 1; ; i = i < 256 ? i << 1 : i) {
		resp = -1;
		pfd = getport(RM, 0);
		if (pfd >= 0) {
			(void) sprintf(line, "\2%s\n", RP);
			n = strlen(line);
			if (write(pfd, line, n) == n &&
			    (resp = response()) == '\0')
				break;
			(void) close(pfd);
		}
		if (i == 1) {
			if (resp < 0)
				pstatus("waiting for %s to come up", RM);
			else {
				pstatus("waiting for queue to be enabled on %s",
					RM);
				i = 256;
			}
		}
		sleep(i);
	}
	pstatus("sending to %s", RM);
}
static void openrem ( ) { register int i , n ; int resp , port ; for ( i = 1 ; ; i = i < 256 ? i << 1 : i ) { resp = -1 ; pfd = getport ( RM , 0 ) ; if ( pfd >= 0 ) { ( void ) sprintf ( line , " \2 \n " , RP ) ; n = strlen ( line ) ; if ( write ( pfd , line , n ) == n && ( resp = response ( ) ) == ' \0 ' ) break ; ( void ) close ( pfd ) ; } if ( i == 1 ) { if ( resp < 0 ) pstatus ( " " , RM ) ; else { pstatus ( " " , RM ) ; i = 256 ; } } sleep ( i ) ; } pstatus ( " " , RM ) ; }
Printer is on a remote host
Printer is on a remote host