🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.bugs.4bsd
Article #1329

lpd bug

#1329
From: Mark Bartelt
Date: Tue, 24 Jan 1989 15:38
38 lines
1791 bytes
First off, a minor error in the printcap(5) man page.  It says ...

        [lpd's] if filter is invoked with arguments:

             if [ -c ] -wwidth -llength [ ... ]

        [ ... ]  Width and length specify the page width and length
        (from pw and pl respectively) in characters.

Actually, it probably ought to add that the width value passed to the if
filter is the printcap "pw" value *unless* it's overridden by a W line in
the daemon control file (from invoking lpr with "-wnnn").

However, it doesn't really default to the pw value at all.  In printjob.c,
the following excerpt from init() does the correct thing:

        if ((PW = pgetnum("pw")) < 0)
                PW = DEFWIDTH;
        sprintf(&width[2], "%d", PW);
        if ((PL = pgetnum("pl")) < 0)
                PL = DEFLENGTH;
        sprintf(&length[2], "%d", PL);

However, near the beginning of printit() we find the following:

        strcpy(width+2, "0");

This causes the if filter to always be invoked with "-w0", unless printit()
encounters a W line in the daemon control file.

Is there any justification for the above strcpy()?  Or, more specifically,
can anyone think of a reason not to replace it with:

        sprintf(&width[2], "%d", PW);

Mark Bartelt                          UUCP: {utzoo,decvax}!sickkids!mark
Hospital for Sick Children, Toronto   BITNET: mark@sickkids.utoronto
416/598-6442                          INTERNET: mark@sickkids.toronto.edu
Technical Details
Message-ID: <137@sickkids.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!lsuc!sickkids!mark

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!lsuc!sickkids!mark
From: mark@sickkids.UUCP (Mark Bartelt)
Newsgroups: comp.bugs.4bsd
Subject: lpd bug
Message-ID: <137@sickkids.UUCP>
Date: 24 Jan 89 15:38:38 GMT
Reply-To: mark@sickkids.UUCP (Mark Bartelt)
Organization: Hospital for Sick Children, Toronto
Lines: 38