- initial checkin of colcrt as submitted by Steve Reeves

This commit is contained in:
gdr-ftp 1998-02-17 03:12:57 +00:00
parent 872341978d
commit e58b811b55
20 changed files with 1968 additions and 0 deletions

22
usr.bin/colcrt/Makefile Executable file
View File

@ -0,0 +1,22 @@
# @(#)Makefile 8.1 (Berkeley) 6/6/93
#
# Modified for GNO (Apple IIgs) and dmake(1) by Steve Reeves, January 1998
#
# $Id: Makefile,v 1.1 1998/02/17 03:12:27 gdr-ftp Exp $
PROG= colcrt
BINDIR= /usr/bin
DEFINES+= -DNOID
# Default stack size and optimization (can be overridden by cmd line)
# These values have been tested and certified as working
.IF $(STACK) == $(NULL)
STACK= 1024
.END
.IF $(OPTIMIZE) == $(NULL)
OPTIMIZE= 127
.END
.INCLUDE: /src/gno/prog.mk

124
usr.bin/colcrt/colcrt.1 Executable file
View File

@ -0,0 +1,124 @@
.\" Copyright (c) 1980, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)colcrt.1 8.1 (Berkeley) 6/30/93
.\"
.\" Modified for GNO (Apple IIgs) by Steve Reeves and Devin Reade's bsd2man
.\"
.\" $Id: colcrt.1,v 1.1 1998/02/17 03:12:28 gdr-ftp Exp $
.\"
.TH COLCRT 1 "January 22, 1998" GNO "Commands and Applications"
.SH NAME
.B colcrt
\- filter nroff output for CRT previewing
.SH SYNOPSIS
.B colcrt
[
.B \-
]
[
.B \-2
]
[
.IR file " ..."
]
.br
.B colcrt
.B \-V
.SH DESCRIPTION
.B Colcrt
provides virtual half-line and reverse line feed sequences
for terminals without such capability, and on which overstriking
is destructive.
Half-line characters and underlining (changed to dashing `\-')
are placed on new lines in between the normal output lines.
.SH OPTIONS
.IP \fB\-\fP
Suppress all underlining.
This option is especially useful for previewing
.I allboxed
tables from
.BR tbl (1).
.IP \fB\-2\fP
Causes all half-lines to be printed, effectively double spacing the output.
Normally, a minimal space output format is used which will suppress empty
lines.
The program never suppresses two consecutive empty lines, however.
The
.B \-2
option is useful for sending output to the line printer when the output
contains superscripts and subscripts which would otherwise be invisible.
.IP \fB\-V\fR
Prints version information and exits.
.SH EXAMPLES
A typical use of
.B colcrt
would be
.sp
.B "tbl exum2.n \&| nroff \-ms \&| colcrt \- \&| more"
.SH BUGS
Should fold underlines onto blanks even with the
.B \-
option so that
a true underline character would show.
.LP
Can't back up more than 102 lines.
.LP
General overstriking is lost;
as a special case
.B \&|
overstruck with
.B \-
or underline becomes
.BR \&+ .
.LP
Lines are trimmed to 132 characters.
.LP
Some provision should be made for processing superscripts and subscripts
in documents which are already double-spaced.
.SH HISTORY
The
.B colcrt
command appeared in
3.0BSD.
.SH ATTRIBUTIONS
This command was ported from FreeBSD source code
for distribution with GNO/ME 2.0.6.
.LP
This program contains material from the ORCA/C
Run-Time Libraries, copyright 1987-1998
by Byte Works, Inc. Used with permission.
.SH "SEE ALSO"
.BR col (1),
.BR more (1),
.BR nroff (1),
.BR troff (1),
.BR ul (1)

382
usr.bin/colcrt/colcrt.c Executable file
View File

@ -0,0 +1,382 @@
/*
* Copyright (c) 1980, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* Modified for GNO (Apple IIgs) by Steve Reeves, January 1998
*
* Added conditional compilation based on these macros:
*
* __ORCAC__ for constructs unacceptable to the compiler,
* __GNO__ for changes not related to the compiler,
* __STDC__ or __P() from <sys/cdefs.h> for ISO C prototyping,
* __STACK_CHECK__ for reporting stack space usage,
* NOID for excluding copyright and version control strings
*
* $Id: colcrt.c,v 1.1 1998/02/17 03:12:30 gdr-ftp Exp $
*
*/
#ifndef NOID
#ifndef lint
static char copyright[] =
"@(#) Copyright (c) 1980, 1993\n\
The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
static char sccsid[] = "@(#)colcrt.c 8.1 (Berkeley) 6/6/93";
#endif /* not lint */
#endif /* NOID */
#include <stdio.h>
#ifdef __GNO__
#include <sys/cdefs.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <err.h>
#include <gno/gno.h>
#endif
/*
* colcrt - replaces col for crts with new nroff esp. when using tbl.
* Bill Joy UCB July 14, 1977
*
* This filter uses a screen buffer, 267 half-lines by 132 columns.
* It interprets the up and down sequences generated by the new
* nroff when used with tbl and by \u \d and \r.
* General overstriking doesn't work correctly.
* Underlining is split onto multiple lines, etc.
*
* Option - suppresses all underlining.
* Option -2 forces printing of all half lines.
*
* For GNO: Option -V prints version information and exits.
*/
#ifndef __ORCAC__
char page[267][132];
#else
char *page;
#endif
int outline = 1;
int outcol;
char suppresul;
char printall;
FILE *f;
static void usage __P((void));
#ifdef __STDC__
int plus(char c, char d);
void pflush(int ol);
void move(int l, int m);
#endif
#if defined(__GNO__) && defined(__STACK_CHECK__)
/* Interface to check on how much stack space a C program uses. */
#ifndef _GNO_GNO_H_
#include <gno/gno.h>
#endif
static void report_stack(void)
{
fprintf(stderr,"\n ==> %d stack bytes used <== \n", _endStackCheck());
}
#endif
int
#ifndef __STDC__
main(argc, argv)
int argc;
char *argv[];
#else
main(int argc, char *argv[])
#endif
{
register int c;
register char *cp, *dp;
#if defined(__GNO__) && defined(__STACK_CHECK__)
_beginStackCheck();
atexit(report_stack);
#endif
argc--;
argv++;
while (argc > 0 && argv[0][0] == '-') {
switch (argv[0][1]) {
case '\0':
suppresul = 1;
break;
case '2':
printall = 1;
break;
#ifdef __GNO__
case 'V':
puts("colcrt v1.0");
exit(0);
#endif
default:
#ifdef __GNO__
fprintf(stderr, "%s: illegal option -- %c\n",
__prognameGS(), argv[0][1]);
#endif
usage();
}
argc--;
argv++;
}
#ifdef __ORCAC__
/* Dynamically allocate the page buffer, so we can use the
small memory model; buffer MUST be initialized to zeroes */
if ((page = calloc(1, 267 * 132L)) == NULL)
err(1, NULL);
#endif
do {
if (argc > 0) {
#ifndef __GNO__
close(0);
if (!(f = fopen(argv[0], "r"))) {
#else
if (!(f = freopen(argv[0], "r", stdin))) {
#endif
fflush(stdout);
err(1, argv[0]);
}
argc--;
argv++;
}
for (;;) {
c = getc(stdin);
if (c == -1) {
pflush(outline);
fflush(stdout);
break;
}
switch (c) {
case '\n':
if (outline >= 265)
pflush(62);
outline += 2;
outcol = 0;
continue;
case '\016':
case '\017':
continue;
case '\033':
c = getc(stdin);
switch (c) {
case '9':
if (outline >= 266)
pflush(62);
outline++;
continue;
case '8':
if (outline >= 1)
outline--;
continue;
case '7':
outline -= 2;
if (outline < 0)
outline = 0;
continue;
default:
continue;
}
case '\b':
if (outcol)
outcol--;
continue;
case '\t':
outcol += 8;
outcol &= ~7;
outcol--;
c = ' ';
default:
if (outcol >= 132) {
outcol++;
continue;
}
#ifndef __ORCAC__
cp = &page[outline][outcol];
#else
cp = page + 132L*outline + outcol;
#endif
outcol++;
if (c == '_') {
if (suppresul)
continue;
cp += 132;
c = '-';
}
if (*cp == '\0') {
*cp = c;
dp = cp - outcol;
for (cp--; cp >= dp && *cp == '\0'; cp--)
*cp = ' ';
} else
if (plus(c, *cp) || plus(*cp, c))
*cp = '+';
else if (*cp == ' ' || *cp == '\0')
*cp = c;
continue;
}
}
} while (argc > 0);
fflush(stdout);
exit(0);
}
static void
usage __P((void))
{
#ifndef __GNO__
fprintf(stderr, "usage: colcrt [ - ] [ -2 ] [ file ... ]\n");
#else
fprintf(stderr, "usage: %s [ - ] [ -2 ] [ -V ] [ file ... ]\n",
__prognameGS());
#endif
exit(1);
}
#ifndef __STDC__
plus(c, d)
char c, d;
#else
int
plus(char c, char d)
#endif
{
return (c == '|' && d == '-' || d == '_');
}
int first;
#ifndef __STDC__
pflush(ol)
int ol;
#else
void
pflush(int ol)
#endif
{
register int i, j;
register char *cp;
char lastomit;
int l;
l = ol;
lastomit = 0;
if (l > 266)
l = 266;
else
l |= 1;
for (i = first | 1; i < l; i++) {
move(i, i - 1);
move(i, i + 1);
}
for (i = first; i < l; i++) {
#ifndef __ORCAC__
cp = page[i];
#else
cp = page + 132L*i;
#endif
if (printall == 0 && lastomit == 0 && *cp == '\0') {
lastomit = 1;
continue;
}
lastomit = 0;
#ifndef __GNO__
printf("%s\n", cp);
#else
puts(cp);
#endif
}
#ifndef __ORCAC__
bcopy(page[ol], page, (267 - ol) * 132);
bzero(page[267- ol], ol * 132);
#else
bcopy(page + 132L*ol, page, (267 - ol) * 132L);
bzero(page + 132L*(267-ol), ol * 132L);
#endif
outline -= ol;
outcol = 0;
first = 1;
}
#ifndef __STDC__
move(l, m)
int l, m;
#else
void
move(int l, int m)
#endif
{
register char *cp, *dp;
#ifndef __ORCAC__
for (cp = page[l], dp = page[m]; *cp; cp++, dp++) {
#else
for (cp = page + 132L*l, dp = page + 132L*m; *cp; cp++, dp++) {
#endif
switch (*cp) {
case '|':
if (*dp != ' ' && *dp != '|' && *dp != '\0')
return;
break;
case ' ':
break;
default:
return;
}
}
if (*cp == '\0') {
#ifndef __ORCAC__
for (cp = page[l], dp = page[m]; *cp; cp++, dp++)
#else
for (cp = page + 132L*l, dp = page + 132L*m; *cp; cp++, dp++)
#endif
if (*cp == '|')
*dp = '|';
else if (*dp == '\0')
*dp = ' ';
#ifndef __ORCAC__
page[l][0] = '\0';
#else
*(page + 132L*l) = '\0';
#endif
}
}

9
usr.bin/colcrt/colcrt.desc Executable file
View File

@ -0,0 +1,9 @@
Name: colcrt
Version: 1.0 (January 22, 1998)
Shell: GNO
Author: Steve Reeves (from FreeBSD code)
Contact: stever@gate.net
Where: /usr/bin
FTP: ground.isca.uiowa.edu apple2.caltech.edu trenco.myrias.com
Filter nroff output for CRT previewing.

32
usr.bin/colcrt/colcrt.rez Executable file
View File

@ -0,0 +1,32 @@
/*
* Resources for colcrt
*
* $Id: colcrt.rez,v 1.1 1998/02/17 03:12:33 gdr-ftp Exp $
*/
#define PROG "colcrt"
#define DESC "Filter nroff output for CRT previewing."
#include "Types.rez"
/*
* Version
*/
resource rVersion (1, purgeable3) {
{ 1, 0, 0, /* Version 1.0.0 */
release, /* development|alpha|beta|final|release */
0 }, /* non-final release number */
verUS, /* Country */
PROG, /* Program name */
DESC "\nReleased with GNO/ME."
};
/*
* Comment
*/
resource rComment (1, purgeable3) {
PROG " v1.0 (January 22, 1998)\n"
"GNO utility: " DESC "\n"
"Ported from FreeBSD code by Steve Reeves."
};

View File

@ -0,0 +1,132 @@
COLCRT (1) Commands and Applications COLCRT (1)
NAME
colcrt - filter nroff output for CRT previewing
SYNOPSIS
colcrt [ - ] [ -2 ] [ file ... ]
colcrt -V
DESCRIPTION
Colcrt provides virtual half-line and reverse line feed
sequences for terminals without such capability, and on which
overstriking is destructive. Half-line characters and
underlining (changed to dashing `-') are placed on new lines in
between the normal output lines.
OPTIONS
-
Suppress all underlining. This option is especially
useful for previewing allboxed tables from tbl(1).
-2
Causes all half-lines to be printed, effectively double
spacing the output. Normally, a minimal space output
format is used which will suppress empty lines. The
program never suppresses two consecutive empty lines,
however. The -2 option is useful for sending output to
the line printer when the output contains superscripts
and subscripts which would otherwise be invisible.
-V
Prints version information and exits.
EXAMPLES
A typical use of colcrt would be
tbl exum2.n | nroff -ms | colcrt - | more
BUGS
Should fold underlines onto blanks even with the - option so
that a true underline character would show.
Can't back up more than 102 lines.
General overstriking is lost; as a special case | overstruck
with - or underline becomes +.
Lines are trimmed to 132 characters.
Some provision should be made for processing superscripts and
subscripts in documents which are already double-spaced.
GNO January 22, 1998 Page 1
COLCRT (1) Commands and Applications COLCRT (1)
HISTORY
The colcrt command appeared in 3.0BSD.
ATTRIBUTIONS
This command was ported from FreeBSD source code for
distribution with GNO/ME 2.0.6.
This program contains material from the ORCA/C Run-Time
Libraries, copyright 1987-1998 by Byte Works, Inc. Used with
permission.
SEE ALSO
col(1), more(1), nroff(1), troff(1), ul(1)
GNO January 22, 1998 Page 2

View File

@ -0,0 +1,132 @@
COLCRT (1) Commands and Applications COLCRT (1)
NAME
colcrt - filter nroff output for CRT previewing
SYNOPSIS
colcrt [ - ] [ -2 ] [ file ... ]
colcrt -V
DESCRIPTION
Colcrt provides virtual half-line and reverse line feed
sequences for terminals without such capability, and on which
overstriking is destructive. Half-line characters and
underlining (changed to dashing `-') are placed on new lines in
between the normal output lines.
OPTIONS
-
Suppress all underlining. This option is especially
useful for previewing allboxed tables from tbl(1).
-2
Causes all half-lines to be printed, effectively double
spacing the output. Normally, a minimal space output
format is used which will suppress empty lines. The
program never suppresses two consecutive empty lines,
however. The -2 option is useful for sending output to
the line printer when the output contains superscripts
and subscripts which would otherwise be invisible.
-V
Prints version information and exits.
EXAMPLES
A typical use of colcrt would be
tbl exum2.n | nroff -ms | colcrt - | more
BUGS
Should fold underlines onto blanks even with the - option so
that a true underline character would show.
Can't back up more than 102 lines.
General overstriking is lost; as a special case | overstruck
with - or underline becomes +.
Lines are trimmed to 132 characters.
Some provision should be made for processing superscripts and
subscripts in documents which are already double-spaced.
GNO January 22, 1998 Page 1
COLCRT (1) Commands and Applications COLCRT (1)
HISTORY
The colcrt command appeared in 3.0BSD.
ATTRIBUTIONS
This command was ported from FreeBSD source code for
distribution with GNO/ME 2.0.6.
This program contains material from the ORCA/C Run-Time
Libraries, copyright 1987-1998 by Byte Works, Inc. Used with
permission.
SEE ALSO
col(1), more(1), nroff(1), troff(1), ul(1)
GNO January 22, 1998 Page 2

View File

@ -0,0 +1,265 @@
COLCRT (1) Commands and Applications COLCRT (1)
NAME
colcrt - filter nroff output for CRT previewing
SYNOPSIS
colcrt [ - ] [ -2 ] [ file ... ]
colcrt -V
DESCRIPTION
Colcrt provides virtual half-line and reverse line feed
sequences for terminals without such capability, and on which
overstriking is destructive. Half-line characters and
underlining (changed to dashing `-') are placed on new lines in
between the normal output lines.
OPTIONS
-
Suppress all underlining. This option is especially
useful for previewing allboxed tables from tbl(1).
-2
Causes all half-lines to be printed, effectively double
spacing the output. Normally, a minimal space output
format is used which will suppress empty lines. The
program never suppresses two consecutive empty lines,
however. The -2 option is useful for sending output to
the line printer when the output contains superscripts
and subscripts which would otherwise be invisible.
-V
Prints version information and exits.
EXAMPLES
A typical use of colcrt would be
tbl exum2.n | nroff -ms | colcrt - | more
BUGS
Should fold underlines onto blanks even with the - option so
that a true underline character would show.
Can't back up more than 102 lines.
General overstriking is lost; as a special case | overstruck
with - or underline becomes +.
Lines are trimmed to 132 characters.
Some provision should be made for processing superscripts and
subscripts in documents which are already double-spaced.
GNO January 22, 1998 Page 1
COLCRT (1) Commands and Applications COLCRT (1)
HISTORY
The colcrt command appeared in 3.0BSD.
ATTRIBUTIONS
This command was ported from FreeBSD source code for
distribution with GNO/ME 2.0.6.
This program contains material from the ORCA/C Run-Time
Libraries, copyright 1987-1998 by Byte Works, Inc. Used with
permission.
SEE ALSO
col(1), more(1), nroff(1), troff(1), ul(1)
GNO January 22, 1998 Page 2

View File

@ -0,0 +1,265 @@
COLCRT (1) Commands and Applications COLCRT (1)
NAME
colcrt - filter nroff output for CRT previewing
SYNOPSIS
colcrt [ - ] [ -2 ] [ file ... ]
colcrt -V
DESCRIPTION
Colcrt provides virtual half-line and reverse line feed
sequences for terminals without such capability, and on which
overstriking is destructive. Half-line characters and
underlining (changed to dashing `-') are placed on new lines in
between the normal output lines.
OPTIONS
-
Suppress all underlining. This option is especially
useful for previewing allboxed tables from tbl(1).
-2
Causes all half-lines to be printed, effectively double
spacing the output. Normally, a minimal space output
format is used which will suppress empty lines. The
program never suppresses two consecutive empty lines,
however. The -2 option is useful for sending output to
the line printer when the output contains superscripts
and subscripts which would otherwise be invisible.
-V
Prints version information and exits.
EXAMPLES
A typical use of colcrt would be
tbl exum2.n | nroff -ms | colcrt - | more
BUGS
Should fold underlines onto blanks even with the - option so
that a true underline character would show.
Can't back up more than 102 lines.
General overstriking is lost; as a special case | overstruck
with - or underline becomes +.
Lines are trimmed to 132 characters.
Some provision should be made for processing superscripts and
subscripts in documents which are already double-spaced.
GNO January 22, 1998 Page 1
COLCRT (1) Commands and Applications COLCRT (1)
HISTORY
The colcrt command appeared in 3.0BSD.
ATTRIBUTIONS
This command was ported from FreeBSD source code for
distribution with GNO/ME 2.0.6.
This program contains material from the ORCA/C Run-Time
Libraries, copyright 1987-1998 by Byte Works, Inc. Used with
permission.
SEE ALSO
col(1), more(1), nroff(1), troff(1), ul(1)
GNO January 22, 1998 Page 2

View File

@ -0,0 +1,158 @@
COLCRT (1) Commands and Applications COLCRT (1)
NAME
colcrt - filter nroff output for CRT previewing
SYNOPSIS
colcrt [ - ] [ -2 ] [ file ... ]
colcrt -V
DESCRIPTION
Colcrt provides virtual half-line and reverse line feed
sequences for terminals without such capability, and on which
overstriking is destructive. Half-line characters and
underlining (changed to dashing `-') are placed on new lines in
between the normal output lines.
OPTIONS
-
Suppress all underlining. This option is especially
useful for previewing allboxed tables from tbl(1).
-2
Causes all half-lines to be printed, effectively double
spacing the output. Normally, a minimal space output
format is used which will suppress empty lines. The
program never suppresses two consecutive empty lines,
however. The -2 option is useful for sending output to
the line printer when the output contains superscripts
and subscripts which would otherwise be invisible.
-V
Prints version information and exits.
EXAMPLES
A typical use of colcrt would be
tbl exum2.n | nroff -ms | colcrt - | more
BUGS
Should fold underlines onto blanks even with the - option so
that a true underline character would show.
Can't back up more than 102 lines.
General overstriking is lost; as a special case | overstruck
with - or underline becomes +.
Lines are trimmed to 132 characters.
Some provision should be made for processing superscripts and
subscripts in documents which are already double-spaced.
GNO January 22, 1998 Page 1
COLCRT (1) Commands and Applications COLCRT (1)
HISTORY
The colcrt command appeared in 3.0BSD.
ATTRIBUTIONS
This command was ported from FreeBSD source code for
distribution with GNO/ME 2.0.6.
This program contains material from the ORCA/C Run-Time
Libraries, copyright 1987-1998 by Byte Works, Inc. Used with
permission.
SEE ALSO
col(1), more(1), nroff(1), troff(1), ul(1)
GNO January 22, 1998 Page 2
This is a regular line.
This line is underlined.
---- ---- -- ----------
This line is continuously underlined.
-------------------------------------
This line is in Times Roman font.
This line is in Times Italic font.
---- ---- -- -- ----- ------ ----
This line is in Times Bold font.
This line has just a few words in Times Italic.
- --- -----
This line has just a few words in Times Bold.
The next line contains a half-line character.
o
The current temperature is 72 F.
| overstruck with - is + (should be +).
- overstruck with | is + (should also be +).

View File

@ -0,0 +1,26 @@
This is a sample file to test how colcrt filters nroff output.
This is a regular line.
This line is underlined.
---- ---- -- ----------
This line is continuously underlined.
-------------------------------------
This line is in Times Roman font.
This line is in Times Italic font.
---- ---- -- -- ----- ------ ----
This line is in Times Bold font.
This line has just a few words in Times Italic.
- --- -----
This line has just a few words in Times Bold.
The next line contains a half-line character.
o
The current temperature is 72 F.
| overstruck with - is + (should be +).
- overstruck with | is + (should also be +).

View File

@ -0,0 +1,22 @@
This is a sample file to test how colcrt filters nroff output.
This is a regular line.
This line is underlined.
This line is continuously underlined.
This line is in Times Roman font.
This line is in Times Italic font.
This line is in Times Bold font.
This line has just a few words in Times Italic.
This line has just a few words in Times Bold.
The next line contains a half-line character.
o
The current temperature is 72 F.
| overstruck with - is + (should be +).
- overstruck with | is + (should also be +).

View File

@ -0,0 +1,43 @@
This is a sample file to test how colcrt filters nroff output.
This is a regular line.
This line is underlined.
---- ---- -- ----------
This line is continuously underlined.
-------------------------------------
This line is in Times Roman font.
This line is in Times Italic font.
---- ---- -- -- ----- ------ ----
This line is in Times Bold font.
This line has just a few words in Times Italic.
- --- -----
This line has just a few words in Times Bold.
The next line contains a half-line character.
o
The current temperature is 72 F.
| overstruck with - is + (should be +).
- overstruck with | is + (should also be +).

View File

@ -0,0 +1,43 @@
This is a sample file to test how colcrt filters nroff output.
This is a regular line.
This line is underlined.
This line is continuously underlined.
This line is in Times Roman font.
This line is in Times Italic font.
This line is in Times Bold font.
This line has just a few words in Times Italic.
This line has just a few words in Times Bold.
The next line contains a half-line character.
o
The current temperature is 72 F.
| overstruck with - is + (should be +).
- overstruck with | is + (should also be +).

View File

@ -0,0 +1,2 @@
colcrt: illegal option -- x
usage: colcrt [ - ] [ -2 ] [ -V ] [ file ... ]

View File

@ -0,0 +1 @@
colcrt v1.0

128
usr.bin/colcrt/tests/dotests Executable file
View File

@ -0,0 +1,128 @@
# Tests for colcrt command; invoked by command file "fulltests"
# Adapted from a test script written by Dave Tribby
#
# $Id: dotests,v 1.1 1998/02/17 03:12:50 gdr-ftp Exp $
# Location of the command to be tested
set testcmd="../colcrt"
# Record starting time
echo -n "Testing command $testcmd beginning at"
date
set src="input.a"
set cmp="colcrt.out.a1"
set dest="/tmp/$cmp"
echo "Filtering nroff output contained in file $src"
$testcmd $src > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
set cmp="colcrt.out.a2"
set dest="/tmp/$cmp"
echo "Filtering nroff output contained in file $src, suppressing underlining"
$testcmd - $src > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
set cmp="colcrt.out.a3"
set dest="/tmp/$cmp"
echo "Filtering nroff output contained in file $src, printing all half-lines"
$testcmd -2 $src > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
set cmp="colcrt.out.a4"
set dest="/tmp/$cmp"
echo "Filtering nroff output contained in file $src, suppressing underlining and printing half-lines"
$testcmd - -2 $src > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
set src="input.b"
set cmp="colcrt.out.b1"
set dest="/tmp/$cmp"
echo "Filtering nroff output redirected from file $src"
$testcmd < $src > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
set cmp="colcrt.out.b2"
set dest="/tmp/$cmp"
echo "Filtering nroff output redirected from file $src, suppressing underlining"
$testcmd - < $src > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
set cmp="colcrt.out.b3"
set dest="/tmp/$cmp"
echo "Filtering nroff output redirected from file $src, printing all half-lines"
$testcmd -2 < $src > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
set cmp="colcrt.out.b4"
set dest="/tmp/$cmp"
echo "Filtering nroff output redirected from file $src, suppressing underlining and printing half-lines"
$testcmd - -2 < $src > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
set src1="input.a"
set src2="input.b"
set cmp="colcrt.out.ab"
set dest="/tmp/$cmp"
echo "Filtering nroff output contained in both files $src1 and $src2"
$testcmd $src1 $src2 > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
echo "***** Version *****"
set cmp="colcrt.out.ver"
set dest="/tmp/$cmp"
echo "Printing version information"
$testcmd -V > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
echo "***** Error Messages *****"
set cmp="colcrt.out.err"
set dest="/tmp/$cmp"
echo "Expected error: illegal option"
$testcmd -x >& $dest
echo " Error completion status = $status (expected: 1)"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"

29
usr.bin/colcrt/tests/fulltests Executable file
View File

@ -0,0 +1,29 @@
# gsh script to run tests and collect results
# Written by Dave Tribby * August 1997
# $Id: fulltests,v 1.1 1998/02/17 03:12:53 gdr-ftp Exp $
# Name of gsh script containing test cases
set command="dotests"
# Sometimes the file type is modified by editing; make it executable
chtyp -l exec $command
# Filenames for raw and modified results
set raw_file="/tmp/rawlist"
set result_file="test.list"
# Location of tr command that knows how to handle classes
set trcmd="/src/gno/usr.bin/tr/tr"
# --- Begin the tests ---
echo -n "Executing test script \"$command\" from directory "
pwd
# Create a new gsh invocation and record all I/O
echo "$command ; exit" | script $raw_file
# Cleanup control chars using either of the following...
echo "Done with tests. Removing control characters from results file"
$trcmd -c -ds '[:print:]\r' '\r' < $raw_file > $result_file
echo "Tests results have been saved as \"$result_file\""

132
usr.bin/colcrt/tests/input.a Executable file
View File

@ -0,0 +1,132 @@
COLCRT (1) Commands and Applications COLCRT (1)
NAME
colcrt - filter nroff output for CRT previewing
SYNOPSIS
colcrt [ - ] [ -2 ] [ file ... ]
colcrt -V
DESCRIPTION
Colcrt provides virtual half-line and reverse line feed
sequences for terminals without such capability, and on which
overstriking is destructive. Half-line characters and
underlining (changed to dashing `-') are placed on new lines in
between the normal output lines.
OPTIONS
-
Suppress all underlining. This option is especially
useful for previewing allboxed tables from tbl(1).
-2
Causes all half-lines to be printed, effectively double
spacing the output. Normally, a minimal space output
format is used which will suppress empty lines. The
program never suppresses two consecutive empty lines,
however. The -2 option is useful for sending output to
the line printer when the output contains superscripts
and subscripts which would otherwise be invisible.
-V
Prints version information and exits.
EXAMPLES
A typical use of colcrt would be
tbl exum2.n | nroff -ms | colcrt - | more
BUGS
Should fold underlines onto blanks even with the - option so
that a true underline character would show.
Can't back up more than 102 lines.
General overstriking is lost; as a special case | overstruck
with - or underline becomes +.
Lines are trimmed to 132 characters.
Some provision should be made for processing superscripts and
subscripts in documents which are already double-spaced.
GNO January 22, 1998 Page 1
COLCRT (1) Commands and Applications COLCRT (1)
HISTORY
The colcrt command appeared in 3.0BSD.
ATTRIBUTIONS
This command was ported from FreeBSD source code for
distribution with GNO/ME 2.0.6.
This program contains material from the ORCA/C Run-Time
Libraries, copyright 1987-1998 by Byte Works, Inc. Used with
permission.
SEE ALSO
col(1), more(1), nroff(1), troff(1), ul(1)
GNO January 22, 1998 Page 2

21
usr.bin/colcrt/tests/input.b Executable file
View File

@ -0,0 +1,21 @@
This is a sample file to test how colcrt filters nroff output.
This is a regular line.
_T_h_i_s _l_i_n_e _i_s _u_n_d_e_r_l_i_n_e_d.
_T_h_i_s__l_i_n_e__i_s__c_o_n_t_i_n_u_o_u_s_l_y__u_n_d_e_r_l_i_n_e_d_.
This line is in Times Roman font.
_T_h_i_s _l_i_n_e _i_s _i_n _T_i_m_e_s _I_t_a_l_i_c _f_o_n_t.
TTTThhhhiiiissss lllliiiinnnneeee iiiissss iiiinnnn TTTTiiiimmmmeeeessss BBBBoooolllldddd ffffoooonnnntttt....
This line has just _a _f_e_w _w_o_r_d_s in Times Italic.
This line has just aaaa ffffeeeewwww wwwwoooorrrrddddssss in Times Bold.
The next line contains a half-line character.
The current temperature is 728o9F.
| overstruck with - is |- (should be +).
- overstruck with | is -| (should also be +).