Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!seismo!cmcl2!beta!unm-la!unmvax!merlin!mcdermot From: mcdermot@merlin.UUCP Newsgroups: comp.dcom.lans Subject: Re: Connecting a printer to an Ethernet Message-ID: <422@unmvax.unm.edu> Date: Thu, 12-Mar-87 12:19:25 EST Article-I.D.: unmvax.422 Posted: Thu Mar 12 12:19:25 1987 Date-Received: Sat, 14-Mar-87 20:36:16 EST References: <5923@charlie.UUCP> <57700001@umn-cs.UUCP> Sender: news@unmvax.unm.edu Reply-To: mcdermot@merlin.UUCP (John McDermott) Organization: University of New Mexico, Albuquerque Lines: 73 I have connected a printer to a Bridge using lpr. Here is the printcap entry: office:for printed mail:\ :lp=/dev/null:sd=/usr/spool/bpd:\ :lf=/usr/adm/lpd-errs:\ :if=/etc/lproffice:\ :rf=/usr/ucb/fpr: Here is the source for lproffice: The clue is to use telnet which the bridge understands. The name of this file should be '/etc/lproffice' because it users the trailing part of the filename to do the printer selection. I'm sorry there are not more comments. This was a quick hack and I had no intent of distributing it. Also, please forgive me for including source here (that is flame /dev/null for all such complaints!). #include #include #include #include #include #include main(ac,av) int ac; char *av[]; { int c; struct sockaddr_in server; struct servent *sp; struct hostent *hp; FILE *printer; int s; loop: sp = getservbyname("telnet","tcp"); /* running code named lprxxxx where xxxx is printer Bridge name*/ hp = gethostbyname(av[0]+3); if(hp == NULL){ fprintf(stderr,"lpfilter: unknown printer: %s\n",av[0]+3); exit(2); } bzero((char *)&server,sizeof(server)); bcopy(hp -> h_addr,(char *)&server.sin_addr,hp->h_length); server.sin_family = hp->h_addrtype; server.sin_port = sp->s_port; s = socket (AF_INET, SOCK_STREAM,0); if(connect(s,(char *)&server,sizeof(server))<0){ perror("lpfilter: cannot connect"); exit (2); } printer = fdopen(s,"w"); /* boy, lpd is a mess! */ while ( (c = getchar()) != EOF){ if(c == '\n') fprintf(printer,"\n\r "); else if(c == '\031') { if (( c = getchar()) == '\01'){ fflush(printer); kill(getpid(),SIGSTOP); continue; } else { ungetc(c,stdin); c = '\031'; } } putc(c,printer); } exit(0); } John McDermott {gatech|ucbvax|lanl}!unmvax!mcdermot Univ of NM W (505) 277-4650 Albuquerque, NM 87131 H (505) 255-7796