The version of the lpr package in RH6.0 doesn't support network printers in the lp= capability. HP LaserJets with the JetDirect Ethernet interface are an example. Here is a patch to add the missing functionality, adapted from the current BSD lpd that comes with BSD/OS 4.0.1. The extended syntax for the lp= directive is either a file name or service@ipaddr. This should be applied in the directory /usr/src/redhat/BUILD/lpr-0.35/lpd --- printjob.c.dist Tue Feb 16 15:01:45 1999 +++ printjob.c Tue Jun 22 14:08:15 1999 @@ -1464,6 +1464,44 @@ char *cp; if (!sendtorem && *LP) { + if ((cp = strchr(LP, '@')) != NULL) { + char savech; + struct servent *sp; + struct hostent *hp; + struct sockaddr_in sin; + + savech = *cp; + *cp = '\0'; + if ((sp = getservbyname(LP, "tcp")) != NULL) { + sin.sin_port = sp->s_port; + } else if (isdigit(*LP)) { + sin.sin_port = htons(atoi(LP)); + } else { + syslog(LOG_ERR, "%s: bad service spec", LP); + exit(1); + } + *cp = savech; + if (inet_aton(cp+1, &sin.sin_addr)) + NULL; + else if ((hp = gethostbyname(cp+1)) != NULL) + sin.sin_addr.s_addr = *(u_long *)hp->h_addr; + else { + syslog(LOG_ERR, "%s: bad host spec", cp+1); + exit(1); + } + if ((pfd = socket(AF_INET, SOCK_STREAM, PF_UNSPEC)) < 0){ + syslog(LOG_ERR, "socket: %m"); + exit(1); + } +#ifndef __linux__ + sin.sin_len = sizeof sin; +#endif + sin.sin_family = AF_INET; + if (connect(pfd, (struct sockaddr*)&sin, sizeof sin) <0){ + syslog(LOG_ERR, "connect: %m"); + exit(1); + } + } else { for (i = 1; ; i = i < 32 ? i << 1 : i) { pfd = open(LP, RW ? O_RDWR : O_WRONLY); if (pfd >= 0) @@ -1478,6 +1516,7 @@ } if (isatty(pfd)) setty(); + } pstatus("%s is ready and printing", printer); } else if (RM != NULL) { for (i = 1; ; i = i < 256 ? i << 1 : i) {
Thanks for the patch. applied in lpr-0.38, available in the next Raw Hide release...