Lines Matching +full:num +full:- +full:columns

1 /*-
2 * SPDX-License-Identifier: BSD-4-Clause
60 * output. By default, input is separated into 66-line pages, each
71 static int clcnt; /* number of columns */
72 static int colwd; /* column data width - multiple columns */
90 static int sflag; /* -s option for multiple columns */
162 int cnt = -1; in onecol()
166 int num; in onecol() local
182 num = nmwd + 1; in onecol()
184 num = 0; in onecol()
185 off = num + offst; in onecol()
205 lbuf = nbuf + num; in onecol()
206 if (num) in onecol()
207 nbuf[--num] = nmchar; in onecol()
257 if (num) in onecol()
258 addnum(nbuf, num, ++lncnt); in onecol()
284 if (linecnt && prtail(lines-linecnt-lrgln, lrgln)) in onecol()
318 int cnt = -1; in vertcol()
328 int mclcnt = clcnt - 1; in vertcol()
489 else if ((pln = col-cnt) > 0) { in vertcol()
507 * when -t (no header) is specified the spec requires in vertcol()
509 * balanced length columns. To fix this we must reorder in vertcol()
510 * the columns. This is a very slow technique so it is in vertcol()
511 * only used under limited conditions. Without -t, the in vertcol()
512 * balancing of text columns is unspecified. To NOT in vertcol()
518 --cvc; in vertcol()
523 if ((cnt < 0) && cvc && ((mvc-cvc) >= clcnt)){ in vertcol()
577 if (prtail((lines - pln), 0)) in vertcol()
604 if ((j = lstdat[i] - ptbf) <= offst) in vertcol()
613 if (pln && prtail((lines - pln), 0)) in vertcol()
647 int cnt = -1; in horzcol()
740 else if ((pln = col - cnt) > 0) { in horzcol()
749 if ((j = lstdat - buf) <= offst) in horzcol()
764 if (i && prtail(lines-i, 0)) in horzcol()
835 * do not know how many columns yet. The number of operands provide an in mulfile()
836 * upper bound on the number of columns. We use the number of files in mulfile()
837 * we can open successfully to set the number of columns. The operation in mulfile()
838 * of the merge operation (-m) in relation to unsuccessful file opens in mulfile()
861 colwd = (pgwd - clcnt - nmwd)/clcnt; in mulfile()
862 pgwd = ((colwd + 1) * clcnt) - nmwd - 2; in mulfile()
864 colwd = (pgwd + 1 - clcnt)/clcnt; in mulfile()
865 pgwd = ((colwd + 1) * clcnt) - 1; in mulfile()
869 "pr: page width too small for %d columns\n", clcnt); in mulfile()
932 --actf; in mulfile()
954 } else if ((pln = col - cnt) > 0) { in mulfile()
963 if ((j = lstdat - buf) <= offst) in mulfile()
987 if (i && prtail(lines-i, 0)) in mulfile()
1027 while ((--lim >= 0) && ((ch = getc(inf)) != EOF)) { in inln()
1035 col = (ptbuf - buf) + *cps; in inln()
1036 col = gap - (col % gap); in inln()
1047 while ((--col >= 0) && (--lim >= 0)) in inln()
1059 while ((--lim >= 0) && ((ch = getc(inf)) != EOF)) { in inln()
1065 col = ptbuf - buf; in inln()
1070 return(-1); in inln()
1115 * 1 is more, 0 is complete, -1 is no \n's
1147 ips += gap - (ips % gap); in otln()
1155 while (ips - ops > 1) { in otln()
1159 if ((tbps = ops + gap - (ops % gap)) > ips) in otln()
1200 while (ips - ops > 1) { in otln()
1204 if ((tbps = ops + gap - (ops % gap)) > ips) in otln()
1260 while(--pgcnt > 0) { in inskip()
1263 if ((c == '\n') && (--cnt == 0)) in inskip()
1280 * dt if set skips the date processing (used with -m)
1289 static int twice = -1; in nxtfile()
1306 if ((tv_sec = time(NULL)) == -1) { in nxtfile()
1310 eoptind = argc - 1; in nxtfile()
1316 if (strcmp(argv[eoptind], "-") == 0) { in nxtfile()
1318 * process a "-" for filename in nxtfile()
1329 if ((tv_sec = time(NULL)) == -1) { in nxtfile()
1360 if ((tv_sec = time(NULL)) == -1) { in nxtfile()
1409 * spec does not specify if -i processing should or should not
1420 *--pt = digs[line % 10]; in addnum()
1428 *--pt = ' '; in addnum()
1461 if (offst && otln(buf, offst, &ips, &ops, -1)) in prhead()
1522 while (--cnt >= 0) { in prtail()
1576 "usage: pr [+page] [-col] [-adFfmprt] [-e[ch][gap]] [-h header]\n", in usage()
1579 " [-i[ch][gap]] [-l line] [-n[ch][width]] [-o offset]\n",err); in usage()
1581 " [-L locale] [-s[ch]] [-w width] [-] [file ...]\n", err); in usage()
1610 while ((c = egetopt(argc, argv, "#adFfmrte?h:i?L:l:n?o:ps?w:")) != -1) { in setup()
1619 case '-': in setup()
1621 (void)fputs("pr: -columns must be 1 or more\n",err); in setup()
1642 "pr: -e gap must be 0 or more\n", err); in setup()
1649 "pr: invalid value for -e %s\n", eoptarg); in setup()
1672 "pr: -i gap must be 0 or more\n", err); in setup()
1679 "pr: invalid value for -i %s\n", eoptarg); in setup()
1705 "pr: -n width must be 1 or more\n",err); in setup()
1710 "pr: invalid value for -n %s\n", eoptarg); in setup()
1717 (void)fputs("pr: -o offset must be 1 or more\n", in setup()
1736 "pr: invalid value for -s %s\n", in setup()
1751 "pr: -w width must be 1 or more \n",err); in setup()
1766 if ((clcnt = argc - eoptind) <= 1) { in setup()
1775 (void)fputs("pr: -a flag requires multiple columns\n", in setup()
1780 (void)fputs("pr: -m cannot be used with -a\n", err); in setup()
1803 "pr: -m cannot be used with multiple columns\n", err); in setup()
1807 colwd = (pgwd + 1 - (clcnt * (nmwd + 2)))/clcnt; in setup()
1808 pgwd = ((colwd + nmwd + 2) * clcnt) - 1; in setup()
1810 colwd = (pgwd + 1 - clcnt)/clcnt; in setup()
1811 pgwd = ((colwd + 1) * clcnt) - 1; in setup()
1815 "pr: page width is too small for %d columns\n",clcnt); in setup()
1828 lines -= HEADLEN + TAILLEN; in setup()