How to print from Windows XP to cups-lpd

Helge Blischke h.blischke at acm.org
Tue Sep 8 03:51:37 PDT 2009


Kai Lanz wrote:

>> Kai Lanz wrote:
>>
>> > #include <string.h>
>> > #include <sys/file.h>
>> > #include <stdlib.h>
>> > #include <unistd.h>
>> >
>> > int main(int argc, char** argv)
>> > {
>> >     char buf[2];
>> >     int fd;
>> >     char name[] = "/var/tmp/cups.XXXXXX";
>> >
>> >     daemon(1,1);
>> >     fd = mkstemp(name);
>> >         if (fd < 0){
>> >             exit(1);
>> >         }
>> >
>> >     while((buf[0] = fgetc(stdin)) != EOF)
>> >         write(fd,buf,1);
>> >
>> >     close(fd);
>> >     return 0;
>> > }
>>
>>
>> Kai,
>>
>> replacing cups-lpd in xinetd.conf by this little program should do
>> what is desired.I suppose we need it run only once.
>>
>> Helge
> 
> You're right! My little program works better than I thought. If I print
> from a Mac, it captures only the one line I posted earlier:
> 
> 00000000  02 61 36 35 2d 6c 61 73 65 72 6a 65 74 0a        .a65-laserjet.
> 
> But if I print from a Windows XP PC, it captures what looks like the
> entire data file. To see the file I got, go here:
> 
>     http://pangea.stanford.edu/~lanz/cups
> 
> where you should see 3 files, mac2lpd.raw (14b), pc2lpd.raw (53603b), and
> pc2lpd-hex.txt (a hex dump of pc2lpd.raw). If that doesn't work, you can
> grab the same files via anonymous ftp to pangea.stanford.edu, in the
> /ftp/pub/lanz directory.
> 
> The file captured from the PC print attempt starts with the same line as
> the Mac capture, but the PC example then continues with what looks to me
> like the expected PJL preamble, starting with the <ESC>%-12345X at PJL
> string.
> 
> I hope this is useful. Thanks for your help.
> 
> -- Kai

Kai,

what I could deduce immediately from your files is that the LPD service on 
your Windows box obviously does not conform to the LPD protocol as described
by the RFC 1179 (that is the one cups-lpd is designed after), whereas the 
mac side behaves correctly (as you stated earlier).

What kind of LPD software do you use on your Windows box?

Helge





More information about the cups mailing list