version 1.17, 2003/06/10 22:20:49 |
version 1.18, 2003/06/12 20:58:10 |
|
|
* Line length is unlimited. |
* Line length is unlimited. |
*/ |
*/ |
int |
int |
onecol(argc, argv) |
onecol(int argc, char *argv[]) |
int argc; |
|
char *argv[]; |
|
{ |
{ |
int off; |
int off; |
int lrgln; |
int lrgln; |
|
|
* the general approach is to buffer a page of data, then print |
* the general approach is to buffer a page of data, then print |
*/ |
*/ |
int |
int |
vertcol(argc, argv) |
vertcol(int argc, char *argv[]) |
int argc; |
|
char *argv[]; |
|
{ |
{ |
char *ptbf; |
char *ptbf; |
char **lstdat; |
char **lstdat; |
|
|
* horzcol: print files with more than one column of output across a page |
* horzcol: print files with more than one column of output across a page |
*/ |
*/ |
int |
int |
horzcol(argc, argv) |
horzcol(int argc, char *argv[]) |
int argc; |
|
char *argv[]; |
|
{ |
{ |
char *ptbf; |
char *ptbf; |
int pln; |
int pln; |
|
|
* processing has completed |
* processing has completed |
*/ |
*/ |
void |
void |
flsh_errs() |
flsh_errs(void) |
{ |
{ |
struct ferrlist *f; |
struct ferrlist *f; |
|
|
|
|
* more than one file concurrently |
* more than one file concurrently |
*/ |
*/ |
int |
int |
mulfile(argc, argv) |
mulfile(int argc, char *argv[]) |
int argc; |
|
char *argv[]; |
|
{ |
{ |
char *ptbf; |
char *ptbf; |
int j; |
int j; |
|
|
* mor: set if more data in line (not truncated) |
* mor: set if more data in line (not truncated) |
*/ |
*/ |
int |
int |
inln(inf, buf, lim, cnt, cps, trnc, mor) |
inln(FILE *inf, char *buf, int lim, int *cnt, int *cps, int trnc, int *mor) |
FILE *inf; |
|
char *buf; |
|
int lim; |
|
int *cnt; |
|
int *cps; |
|
int trnc; |
|
int *mor; |
|
{ |
{ |
int col; |
int col; |
int gap = ingap; |
int gap = ingap; |
|
|
* 1 is more, 0 is complete, -1 is no \n's |
* 1 is more, 0 is complete, -1 is no \n's |
*/ |
*/ |
int |
int |
otln(buf, cnt, svips, svops, mor) |
otln(char *buf, int cnt, int *svips, int *svops, int mor) |
char *buf; |
|
int cnt; |
|
int *svops; |
|
int *svips; |
|
int mor; |
|
{ |
{ |
int ops; /* last col output */ |
int ops; /* last col output */ |
int ips; /* last col in buf examined */ |
int ips; /* last col in buf examined */ |
|
|
* lncnt number of lines per page |
* lncnt number of lines per page |
*/ |
*/ |
int |
int |
inskip(inf, pgcnt, lncnt) |
inskip(FILE *inf, int pgcnt, int lncnt) |
FILE *inf; |
|
int pgcnt; |
|
int lncnt; |
|
{ |
{ |
int c; |
int c; |
int cnt; |
int cnt; |
|
|
* dt if set skips the date processing (used with -m) |
* dt if set skips the date processing (used with -m) |
*/ |
*/ |
FILE * |
FILE * |
nxtfile(argc, argv, fname, buf, dt) |
nxtfile(int argc, char *argv[], char **fname, char *buf, int dt) |
int argc; |
|
char **argv; |
|
char **fname; |
|
char *buf; |
|
int dt; |
|
{ |
{ |
FILE *inf = NULL; |
FILE *inf = NULL; |
struct timeval tv; |
struct timeval tv; |
|
|
* numbers as part of the column so spaces may be replaced. |
* numbers as part of the column so spaces may be replaced. |
*/ |
*/ |
void |
void |
addnum(buf, wdth, line) |
addnum(char *buf, int wdth, int line) |
char *buf; |
|
int wdth; |
|
int line; |
|
{ |
{ |
char *pt = buf + wdth; |
char *pt = buf + wdth; |
|
|
|
|
* the context each output mode, but we let the caller figure that out. |
* the context each output mode, but we let the caller figure that out. |
*/ |
*/ |
int |
int |
prhead(buf, fname, pagcnt) |
prhead(char *buf, char *fname, int pagcnt) |
char *buf; |
|
char *fname; |
|
int pagcnt; |
|
{ |
{ |
int ips = 0; |
int ips = 0; |
int ops = 0; |
int ops = 0; |
|
|
* we haven't printed a hearder, these no need for a trailer |
* we haven't printed a hearder, these no need for a trailer |
*/ |
*/ |
int |
int |
prtail(cnt, incomp) |
prtail(int cnt, int incomp) |
int cnt; |
|
int incomp; |
|
{ |
{ |
/* |
/* |
* if were's skipping to page N or haven't put out anything yet just exit |
* if were's skipping to page N or haven't put out anything yet just exit |
|
|
* terminate(): when a SIGINT is recvd |
* terminate(): when a SIGINT is recvd |
*/ |
*/ |
void |
void |
terminate(which_sig) |
terminate(int which_sig) |
int which_sig; |
|
{ |
{ |
flsh_errs(); |
flsh_errs(); |
_exit(1); |
_exit(1); |
} |
} |
|
|
void |
void |
mfail() |
mfail(void) |
{ |
{ |
ferrout("pr: memory allocation failed\n"); |
ferrout("pr: memory allocation failed\n"); |
} |
} |
|
|
void |
void |
pfail() |
pfail(void) |
{ |
{ |
ferrout("pr: write failure, %s\n", strerror(errno)); |
ferrout("pr: write failure, %s\n", strerror(errno)); |
} |
} |
|
|
void |
void |
usage() |
usage(void) |
{ |
{ |
ferrout( |
ferrout( |
"usage: pr [+page] [-col] [-adfFmrt] [-e[ch][gap]] [-h header]\n"); |
"usage: pr [+page] [-col] [-adfFmrt] [-e[ch][gap]] [-h header]\n"); |
|
|
* checks on options |
* checks on options |
*/ |
*/ |
int |
int |
setup(argc, argv) |
setup(int argc, char *argv[]) |
int argc; |
|
char **argv; |
|
{ |
{ |
int c; |
int c; |
int eflag = 0; |
int eflag = 0; |