[TUHS] Line Numbers Before SysIII nl? BSD num?

Ralph Corderoy ralph at inputplus.co.uk
Sat Jul 23 23:36:56 AEST 2022


Hi Rob,

> Very odd. I thought so too, but the 8th Edition manual says pr -n
> prints in n columns, while the 9th and 10th say it numbers the lines.

8th Edition's pr.c has -n and -x which both turn on line numbers.
The optional argument gives the width used for the line number.
https://minnie.tuhs.org/cgi-bin/utree.pl?file=V8/usr/src/cmd/pr.c

    case 'n':
    case 'x': /* retained for historical reasons */
            ++Lnumb;
            if ((Numw = intopt(argv, &Nsepc)) <= 0)
                    Numw = NUMW;

    if (Lnumb && C != EOF && (colno == 0 || Multi == 'a')) {
            if (Page >= Fpage) {
                    putspace();
                    printf("%*ld", Numw, Buffer ?
                            Colpts[colno].c_lno++ : Lnumb);
                    Outpos += Numw;
                    put(Nsepc);
            }
            ++Lnumb;
    }

I think -n and -x are undocumented in the matching man page.
https://minnie.tuhs.org/cgi-bin/utree.pl?file=V8/usr/man/man1/pr.1

The -n you're referring to is an italic ā€˜nā€™, e.g. -3 for three columns.

    .TP
    .BI \- n
    Produce
    .IR n -column
    output.

-- 
Cheers, Ralph.


More information about the TUHS mailing list