* Copyright (c) 1987 Regents of the University of California.
* Redistribution and use in source and binary forms are permitted
* provided that this notice is preserved and that due credit is given
* to the University of California at Berkeley. The name of the University
* may not be used to endorse or promote products derived from this
* software without specific prior written permission. This software
* is provided ``as is'' without express or implied warranty.
"@(#) Copyright (c) 1987 Regents of the University of California.\n\
static char sccsid
[] = "@(#)sidebyside.c 1.3 (Berkeley) %G%";
* sidebyside -- make wide listings by placing pages side by side
char screen
[EJLINE
][LINELN
];
while (argc
> 0 && argv
[0][0] == '-') {
fprintf(stderr
, "usage: sidebyside [ -wwidth ] file ...\n");
clear(screen
, EJLINE
* LINELN
);
if (freopen(argv
[0], "r", stdin
) == NULL
) {
while (fgets(linebuf
, sizeof linebuf
, stdin
)) {
for (cp
= linebuf
; c
= *cp
; cp
++) switch (c
) {
} while ((outcol
- origin
) % 8 != 0);
if (origin
+ width
> LINELN
) {
if (origin * 2 + LMARG < LINELN && origin * 3 > LINELN) {
if (outline
|| origin
!= LMARG
) {
register char *cp
= screen
[outline
];
if (c
< 040 || c
>= 0177)
if (d
== '_' || c
== '_') {
clear(ul
[outline
], LINELN
);
ul
[outline
][outcol
] = '_';
register int i
, j
, oc
, dc
, c
;
for (j = 0; j < LINELN; j++)
for (i
= 0; i
< EJLINE
; i
++) {
for (i
= 0; i
< LINELN
; i
++)
clear(screen
, EJLINE
* LINELN
);
screen
[0][o
- LMARG
] = '|';
screen
[1][o
- LMARG
] = '|';
screen
[EJLINE
- 1][o
- LMARG
] = '|';
screen
[EJLINE
- 2][o
- LMARG
] = '|';
if ((c
= *cp
++) == ' ') {
while (((oc
+ 8) &~ 7) < dc
) {