How to print from Windows XP to cups-lpd

Helge Blischke h.blischke at acm.org
Mon Sep 7 04:38:57 PDT 2009


Kai Lanz wrote:

>> Kai Lanz wrote:
>>
>> > Short version: How do I print from a Windows XP client to cups-lpd?
>> >
>> > Then in /var/log/messages, we see an error from cups-lpd:
>> >
>> > Sep  4 14:07:18 pangea2 cups-lpd[2219]: Connection from a65pc20
>> > (171.64.175.30)
>> > Sep  4 14:07:18 pangea2 cups-lpd[2219]: Receive print job for
>> > a65-laserjet
>> > Sep  4 14:07:18 pangea2 cups-lpd[2219]: Error while reading file -
>> > Success
>> > Sep  4 14:07:18 pangea2 cups-lpd[2219]: Closing connection
>> >
>> > The odd-looking message, "Error while reading file - Success", comes
>> > from cups-lpd.c (line 714, in the source for v1.1.23). It would seem to
>> > indicate that the previous fread or write operation returned <1 byte,
>> > though the operation itself did not fail (meaning, errno was set to 0).
>> > I don't know what that implies about the file cups-lpd got from the PC.
>>
>> Can you manage to temporarily replace the cups-lpd by a smple script that
>> dumps the input to a file and post (an URL to) that?
>>
>> If I can have a detailed look into such a dump, I could check if it is
>> the same issue for which I patched cups-lpd for both 1.1.19 and 1.3.5
>> some time ago.
>>
>> Helge
> 
> That's a great idea, but the answer seems to be no, I haven't yet managed
> to successfully replace cups-lpd by a program that dumps the input to a
> file. The best I can manage is to capture the first line of the control
> file, I think:
> 
> 00000000  02 61 36 35 2d 6c 61 73 65 72 6a 65 74 0a        .a65-laserjet.
> 
> This was obtained from the following little program that just reads
> everything coming in on stdin and writes it to a file:
> 
> #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;
> }
> 
> This program works perfectly if I run it by hand, redirecting its input
> from some random text-file. But I'm sure it's too simple-minded to do what
> we want when called by xinetd as a replacement for lpd. Can you point me
> to a working example of such a script?
> 
> -- Kai

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





More information about the cups mailing list