static char *sccsid
= "@(#)pr.c 4.1 (Berkeley) %G%";
* print file with headings
/* Making putcp a macro sped things up by 14%. */
#define putcp(c) if (page >= fpage) putchar(c)
char buffer
[BUFS
]; /* for multi-column output */
if (signal(SIGINT
, SIG_IGN
) != SIG_IGN
)
for (nfdone
=0; argc
>1; argc
--) {
} else if (**argv
== '+') {
print((char *)0, (char **)0);
mode
= sbuf
.st_mode
&0777;
if (ncol
>72 || ncol
>width
) {
fprintf(stderr
, "pr: No room for columns.\n");
colw
= width
/(ncol
==0? 1 : ncol
);
if((file
=fopen(fp
, "r"))==NULL
) {
fprintf(stderr
, "pr: can't open %s\n", fp
);
cbuf
= ctime(&sbuf
.st_mtime
);
colp
[ncol
] = bufp
= buffer
;
while (mflg
&&nofile
|| (!mflg
)&&tpgetc(ncol
)>0) {
colp
[ncol
] = &buffer
[BUFS
];
/* Assume a ff takes two blank lines at the
sprintf(linebuf
, "%s %s %s Page %d\n\n\n",
cbuf
+4, cbuf
+20, header
, page
);
sprintf(linebuf
, "\n\n%s %s %s Page %d\n\n\n",
cbuf
+4, cbuf
+20, header
, page
);
for(cp
=linebuf
;*cp
;) put(*cp
++);
while((p1
= *p
) && p
++ <= lastarg
) {
if((ifile
[nofile
]=fopen(p1
, "r")) == NULL
){
fprintf(stderr
, "pr: Too many args\n");
register int lastcol
, i
, c
;
while((c
= tpgetc(0)) && c
!='\n' && c
!=FF
)
if (mflg
==0) for (i
=1; i
<=ncol
; i
++) {
for (j
= margin
; j
<length
; j
++)
while((c
=tpgetc(i
))!='\n')
while ((c
=pgetc(i
)) && c
!='\n')
if (col
<lastcol
|| tabc
!=0)
while ((c
= pgetc(ncol
)) && c
!='\n')
n
= &buffer
[BUFS
] - rbufp
;
if((n
=fread(rbufp
,1,n
,file
)) <= 0){
if (rbufp
>= &buffer
[BUFS
])
if((c
=getc(ifile
[i
])) == EOF
) {
c
= **(p
= &colp
[i
]) & 0377;
if (nspace
>2 && col
> (ns
=((col
-nspace
)|07))) {