Subject: Re: printcap flag entries
To: Brook Milligan <brook@trillium.NMSU.Edu>
From: Christoph Kukulies <kuku@gilberto.physik.rwth-aachen.de>
List: netbsd-help
Date: 01/19/1996 16:48:26
>
> Since FreeBSD and NetBSD aren't that different (don't know for
> sure if /usr/include/sys/termios is the same WRT flags) I post my working
> /etc/printcap now here:
>
> # @(#)printcap 5.3 (Berkeley) 6/30/90
> lp0|lp|local laser printer:\
> :lp=/dev/cuaa2:\
> :fc#0xffffffff:fs#0x8600:br#38400:\
> :if=/usr/local/bin/lpif:\
> :of=/usr/local/bin/lpof:\
> :mx#0:sd=/var/spool/output/lpd:lf=/var/log/lpd-errs:
>
> I thought the flags variables (or any numeric variables for that
> matter) were either octal or decimal depending on whether the first
> character was 0 or not. Am I confused here or can you really use hex,
> also? That may be part of your problem (but I don't think it was part
> of my original problem). By the way, what capabilities were you
> intending to invoke? Also, is it guarrenteed that the bits in fc are
> cleared BEFORE those in fs are set? Finally, why did you use only
> fc/fs and not xc/xs?
Because DEC Ultrix did it the same way - hmm, you may be right with using
hex causing me problems.
I wanted to set
ixon,ixoff,CLOCAL
>
> Here is the source code in /usr/src/usr.sbin/lpr/common_source/printcap.c:
>
> /*
> * Return the (numeric) option id.
> * Numeric options look like
> * li#80
> * i.e. the option string is separated from the numeric value by
> * a # character. If the option is not found we return -1.
> * Note that we handle octal numbers beginning with 0.
> */
> int
> tgetnum(id)
> char *id;
> {
> register int i, base;
> register char *bp = tbuf;
>
> for (;;) {
> bp = tskip(bp);
> if (*bp == 0)
> return (-1);
> if (*bp++ != id[0] || *bp == 0 || *bp++ != id[1])
> continue;
> if (*bp == '@')
> return(-1);
> if (*bp != '#')
> continue;
> bp++;
> base = 10;
> if (*bp == '0')
> base = 8;
> i = 0;
> while (isdigit(*bp))
> i *= base, i += *bp++ - '0';
> return (i);
> }
> }
>
> Cheers,
> Brook
>
--Chris Christoph P. U. Kukulies kuku@gil.physik.rwth-aachen.de