Date: Tue, 2 May 2000 17:49:01 +0200 From: "Lorenzo Iania" <l.iania@sintesi.net> To: <freebsd-hackers@freebsd.org> Subject: Re: lpr: order of print requests Message-ID: <047901bfb44d$f0173f00$0500000a@sintesi.intr>
next in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
Konrad Heuer wrote
> Hmm, I've never seen such a strange behaviour. Lpd should do FIFO. Could
> you give some more infos about your environment (os release, input filter
> program, printer type)?
Yes, I think it's a very strange behaviour.
In effect in the file /usr/src/usr.sbin/lpr/common_source/common.c there is:
.....
/*
* Scan the current directory and make a list of daemon files sorted by
* creation time.
* Return the number of entries and a pointer to the list.
*/
int
getq(pp, namelist)
const struct printer *pp;
struct queue *(*namelist[]);
{
.....
However I had the problem in more than one installation of the os from 2.2.7 to 3.4.
The printers are used in a very simple way,
...
lp|local line printer:\
:sh:sf:mx#0:\
:lp=/dev/lpt0:sd=/usr/spool/output/lpd:lf=/var/log/lpd-errs:
....
but the order is wrong. The problem occur when the number of consecutive requests grows, i. e. when I have to print requests from 1 to 100 (from tha same process), the first 40 are in the right order, then are printed those from 50 to 100 in the right order and at last those from 41 to 49.
All I do is simply open a pipe by a call to
fp=popen("lpr -Plp","a");
fprintf(fp,XXXXX);
....
.
..
.
fclose(fp);
The contents are almost the same for each request, simply characters; I don't use any input filter. The printer is always a character printer like IBM, EPSON ...
So I don't understand why this happens.
Any suggestions??
[-- Attachment #2 --]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=windows-1252" http-equiv=Content-Type>
<META content="MSHTML 5.00.2919.6307" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Konrad Heuer wrote</FONT></DIV>
<DIV><FONT face=Arial
size=2>
</FONT></DIV>
<DIV><FONT face=Arial size=2>> Hmm, I've never seen such a strange behaviour.
Lpd should do FIFO. Could<BR>> you give some more infos about your
environment (os release, input filter<BR>> program, printer
type)?<BR></FONT></DIV>
<DIV><FONT face=Arial size=2>Yes, I think it's a very strange
behaviour.</FONT></DIV>
<DIV><FONT face=Arial size=2>In effect in the file
/usr/src/usr.sbin/lpr/common_source/common.c there is:</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>.....</FONT></DIV>
<DIV><FONT face=Arial size=2>/*<BR> * Scan the current directory and make a
list of daemon files sorted by<BR> * creation time.<BR> * Return the
number of entries and a pointer to the list.<BR> */<BR>int<BR>getq(pp,
namelist)<BR> const struct printer
*pp;<BR> struct queue
*(*namelist[]);<BR>{<BR>.....</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>However I had the problem in more than one
installation of the os from 2.2.7 to 3.4.</FONT></DIV>
<DIV><FONT face=Arial size=2>The printers are used in a very simple
way,</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>...</FONT></DIV>
<DIV><FONT face=Arial size=2>lp|local line
printer:\<BR>
:sh:sf:mx#0:\<BR>
:lp=/dev/lpt0:sd=/usr/spool/output/lpd:lf=/var/log/lpd-errs:<BR>....</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>but the order is wrong. The problem occur when the
number of consecutive requests grows, i. e. when I have to print requests from 1
to 100 (from tha same process), the first 40 are in the right order, then are
printed those from 50 to 100 in the right order and at last those from 41 to
49.</FONT></DIV>
<DIV><FONT face=Arial size=2>All I do is simply open a pipe by a call to
</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>fp=popen("lpr -Plp","a");</FONT></DIV>
<DIV><FONT face=Arial size=2>fprintf(fp,XXXXX);</FONT></DIV>
<DIV><FONT face=Arial size=2>....</FONT></DIV>
<DIV><FONT face=Arial size=2>.</FONT></DIV>
<DIV><FONT face=Arial size=2>..</FONT></DIV>
<DIV><FONT face=Arial size=2>.</FONT></DIV>
<DIV><FONT face=Arial size=2>fclose(fp);</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>The contents are almost the same for each request,
simply characters; I don't use any input filter. The printer is always a
character printer like IBM, EPSON ...</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>So I don't understand why this
happens.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>Any suggestions??</FONT></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2><BR> </DIV></FONT></BODY></HTML>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?047901bfb44d$f0173f00$0500000a>
