mirror of
https://github.com/GnoConsortium/gno.git
synced 2024-09-28 18:54:51 +00:00
cut(1) as contributed by Dave Tribby
This commit is contained in:
parent
a739102c3a
commit
8a461e09b4
12
usr.bin/cut/Makefile
Normal file
12
usr.bin/cut/Makefile
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#
|
||||||
|
# This makefile is intended for use with dmake(1) on Apple IIGS
|
||||||
|
#
|
||||||
|
# Created by Dave Tribby, August 1997
|
||||||
|
|
||||||
|
# Program name
|
||||||
|
PROG= cut
|
||||||
|
|
||||||
|
# Delivery directory
|
||||||
|
BINDIR = /usr/bin
|
||||||
|
|
||||||
|
.INCLUDE : <gno.prog.mk>
|
118
usr.bin/cut/cut.1
Normal file
118
usr.bin/cut/cut.1
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
.\" Copyright (c) 1989, 1990, 1993
|
||||||
|
.\" The Regents of the University of California. All rights reserved.
|
||||||
|
.\"
|
||||||
|
.\" This code is derived from software contributed to Berkeley by
|
||||||
|
.\" the Institute of Electrical and Electronics Engineers, Inc.
|
||||||
|
.\"
|
||||||
|
.\" 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.
|
||||||
|
.\"
|
||||||
|
.\" @(#)cut.1 8.1 (Berkeley) 6/6/93
|
||||||
|
.\"
|
||||||
|
.TH CUT 1 "August 1997" "GNO" "Commands and Applications"
|
||||||
|
.SH NAME
|
||||||
|
.BR cut
|
||||||
|
\- select portions of each line of a file
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.BR cut
|
||||||
|
.BI "-c " list
|
||||||
|
.RI [ file " ...]"
|
||||||
|
.PP
|
||||||
|
.BR cut
|
||||||
|
.BI "-f " list
|
||||||
|
.RB [ -d
|
||||||
|
.IR delim\| ]
|
||||||
|
.RB [ -s ]
|
||||||
|
.RI [ file " ...]"
|
||||||
|
.BR
|
||||||
|
.SH DESCRIPTION
|
||||||
|
The
|
||||||
|
.BR cut
|
||||||
|
utility selects portions of each line (as specified by
|
||||||
|
.BR list )
|
||||||
|
from each
|
||||||
|
.IR file
|
||||||
|
(or the standard input by default), and writes them to the
|
||||||
|
standard output.
|
||||||
|
The items specified by
|
||||||
|
.BR list
|
||||||
|
can be in terms of column position or in terms of fields delimited
|
||||||
|
by a special character. Column numbering starts from 1.
|
||||||
|
.LP
|
||||||
|
.BR List
|
||||||
|
is a comma or whitespace separated set of increasing numbers and/or
|
||||||
|
number ranges.
|
||||||
|
Number ranges consist of a number, a dash
|
||||||
|
.BR - ,
|
||||||
|
and a second number
|
||||||
|
and select the fields or columns from the first number to the second,
|
||||||
|
inclusive.
|
||||||
|
Numbers or number ranges may be preceded by a dash, which selects all
|
||||||
|
fields or columns from 1 to the first number.
|
||||||
|
Numbers or number ranges may be followed by a dash, which selects all
|
||||||
|
fields or columns from the last number to the end of the line.
|
||||||
|
Numbers and number ranges may be repeated, overlapping, and in any order.
|
||||||
|
It is not an error to select fields or columns not present in the
|
||||||
|
input line.
|
||||||
|
.PP
|
||||||
|
.BR Cut
|
||||||
|
exits 0 on success, 1 if an error occurred.
|
||||||
|
.SS OPTIONS
|
||||||
|
The options are as follows:
|
||||||
|
.IP \fB-c\fR list
|
||||||
|
The
|
||||||
|
.IR list
|
||||||
|
specifies character positions.
|
||||||
|
.IP \fB-d\fR delim
|
||||||
|
Use the first character of
|
||||||
|
.IR delim
|
||||||
|
as the field delimiter character instead of the tab character.
|
||||||
|
.IP \fB-f\fR list
|
||||||
|
The
|
||||||
|
.IR list
|
||||||
|
specifies fields, delimited in the input by a single tab character.
|
||||||
|
Output fields are separated by a single tab character.
|
||||||
|
.IP \fB-s\fR
|
||||||
|
Suppresses lines with no field delimiter characters.
|
||||||
|
Unless specified, lines with no delimiters are passed through unmodified.
|
||||||
|
.RE
|
||||||
|
.LP
|
||||||
|
.SH ATTRIBUTIONS
|
||||||
|
This command was ported from FreeBSD source code
|
||||||
|
for distribution with GNO/ME 2.0.6.
|
||||||
|
.SH SEE ALSO
|
||||||
|
.BR paste (1)
|
||||||
|
.SH STANDARDS
|
||||||
|
The
|
||||||
|
.BR cut
|
||||||
|
utility is expected to conform to the POSIX.2 standard.
|
||||||
|
.SH HISTORY
|
||||||
|
Version 1.0 (April 27, 1994) of
|
||||||
|
.BR cut ,
|
||||||
|
was written by Jason Perez (jperez@ee.tamu.edu) and distributed as a
|
||||||
|
separate package compatible with GNO.
|
340
usr.bin/cut/cut.c
Normal file
340
usr.bin/cut/cut.c
Normal file
@ -0,0 +1,340 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 1989, 1993
|
||||||
|
* The Regents of the University of California. All rights reserved.
|
||||||
|
*
|
||||||
|
* This code is derived from software contributed to Berkeley by
|
||||||
|
* Adam S. Moskowitz of Menlo Consulting and Marciano Pitargue.
|
||||||
|
*
|
||||||
|
* 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 Dave Tribby, August 1997
|
||||||
|
*
|
||||||
|
* Constructs unacceptable to compiler are replaced using #ifndef __ORCAC__
|
||||||
|
*
|
||||||
|
* Changes not related to compiler are replaced using #ifndef __GNO__
|
||||||
|
*
|
||||||
|
* Added prototyped headers, surrounded by #ifndef __STDC__
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __GNO__ /* GNO doesn't use what strings */
|
||||||
|
#ifndef lint
|
||||||
|
static char copyright[] =
|
||||||
|
"@(#) Copyright (c) 1989, 1993\n\
|
||||||
|
The Regents of the University of California. All rights reserved.\n";
|
||||||
|
#endif /* not lint */
|
||||||
|
|
||||||
|
#ifndef lint
|
||||||
|
static char sccsid[] = "@(#)cut.c 8.3 (Berkeley) 5/4/95";
|
||||||
|
#endif /* not lint */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <err.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int cflag;
|
||||||
|
char dchar;
|
||||||
|
int dflag;
|
||||||
|
int fflag;
|
||||||
|
int sflag;
|
||||||
|
|
||||||
|
void c_cut __P((FILE *, char *));
|
||||||
|
void f_cut __P((FILE *, char *));
|
||||||
|
void get_list __P((char *));
|
||||||
|
static void usage __P((void));
|
||||||
|
|
||||||
|
/* Interface to check on how much stack space a C program uses. */
|
||||||
|
#if defined(__GNO__) && defined(__STACK_CHECK__)
|
||||||
|
#ifndef _STDLIB_H_
|
||||||
|
#include <stdlib.h>
|
||||||
|
#endif
|
||||||
|
extern void begin_stack_check(void);
|
||||||
|
extern int end_stack_check(void);
|
||||||
|
static void report_stack(void)
|
||||||
|
{
|
||||||
|
fprintf(stderr,"\n ==> %d stack bytes used <== \n", end_stack_check());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
#ifndef __STDC__
|
||||||
|
main(argc, argv)
|
||||||
|
int argc;
|
||||||
|
char *argv[];
|
||||||
|
#else
|
||||||
|
main(int argc,
|
||||||
|
char *argv[])
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
FILE *fp;
|
||||||
|
void (*fcn) __P((FILE *, char *));
|
||||||
|
int ch;
|
||||||
|
|
||||||
|
#if defined(__GNO__) && defined(__STACK_CHECK__)
|
||||||
|
begin_stack_check();
|
||||||
|
atexit(report_stack);
|
||||||
|
#endif
|
||||||
|
dchar = '\t'; /* default delimiter is \t */
|
||||||
|
|
||||||
|
while ((ch = getopt(argc, argv, "c:d:f:s")) != -1)
|
||||||
|
switch(ch) {
|
||||||
|
case 'c':
|
||||||
|
fcn = c_cut;
|
||||||
|
get_list(optarg);
|
||||||
|
cflag = 1;
|
||||||
|
break;
|
||||||
|
case 'd':
|
||||||
|
dchar = *optarg;
|
||||||
|
dflag = 1;
|
||||||
|
break;
|
||||||
|
case 'f':
|
||||||
|
get_list(optarg);
|
||||||
|
fcn = f_cut;
|
||||||
|
fflag = 1;
|
||||||
|
break;
|
||||||
|
case 's':
|
||||||
|
sflag = 1;
|
||||||
|
break;
|
||||||
|
case '?':
|
||||||
|
default:
|
||||||
|
usage();
|
||||||
|
}
|
||||||
|
argc -= optind;
|
||||||
|
#ifndef __ORCAC__
|
||||||
|
argv += optind;
|
||||||
|
#else
|
||||||
|
argv = argv + optind;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (fflag) {
|
||||||
|
if (cflag)
|
||||||
|
usage();
|
||||||
|
} else if (!cflag || dflag || sflag)
|
||||||
|
usage();
|
||||||
|
|
||||||
|
if (*argv)
|
||||||
|
for (; *argv; ++argv) {
|
||||||
|
if (!(fp = fopen(*argv, "r")))
|
||||||
|
err(1, "%s", *argv);
|
||||||
|
fcn(fp, *argv);
|
||||||
|
(void)fclose(fp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
fcn(stdin, "stdin");
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int autostart, autostop, maxval;
|
||||||
|
|
||||||
|
char positions[_POSIX2_LINE_MAX + 1];
|
||||||
|
|
||||||
|
void
|
||||||
|
#ifndef __STDC__
|
||||||
|
get_list(list)
|
||||||
|
char *list;
|
||||||
|
#else
|
||||||
|
get_list(char *list)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
#ifndef __GNO__
|
||||||
|
register int setautostart, start, stop;
|
||||||
|
#else /* GNO's ints are short; start & stop must be long to catch errors */
|
||||||
|
long setautostart, start, stop;
|
||||||
|
#endif
|
||||||
|
register char *pos;
|
||||||
|
char *p;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* set a byte in the positions array to indicate if a field or
|
||||||
|
* column is to be selected; use +1, it's 1-based, not 0-based.
|
||||||
|
* This parser is less restrictive than the Draft 9 POSIX spec.
|
||||||
|
* POSIX doesn't allow lists that aren't in increasing order or
|
||||||
|
* overlapping lists. We also handle "-3-5" although there's no
|
||||||
|
* real reason too.
|
||||||
|
*/
|
||||||
|
for (; p = strtok(list, ", \t"); list = NULL) {
|
||||||
|
setautostart = start = stop = 0;
|
||||||
|
if (*p == '-') {
|
||||||
|
++p;
|
||||||
|
setautostart = 1;
|
||||||
|
}
|
||||||
|
if (isdigit(*p)) {
|
||||||
|
start = stop = strtol(p, &p, 10);
|
||||||
|
if (setautostart && start > autostart)
|
||||||
|
autostart = start;
|
||||||
|
}
|
||||||
|
if (*p == '-') {
|
||||||
|
if (isdigit(p[1]))
|
||||||
|
stop = strtol(p + 1, &p, 10);
|
||||||
|
if (*p == '-') {
|
||||||
|
++p;
|
||||||
|
if (!autostop || autostop > stop)
|
||||||
|
autostop = stop;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (*p)
|
||||||
|
errx(1, "[-cf] list: illegal list value");
|
||||||
|
if (!stop || !start)
|
||||||
|
errx(1, "[-cf] list: values may not include zero");
|
||||||
|
if (stop > _POSIX2_LINE_MAX)
|
||||||
|
#ifndef __GNO__
|
||||||
|
errx(1, "[-cf] list: %d too large (max %d)",
|
||||||
|
#else
|
||||||
|
errx(1, "[-cf] list: %ld too large (max %d)",
|
||||||
|
#endif
|
||||||
|
stop, _POSIX2_LINE_MAX);
|
||||||
|
if (maxval < stop)
|
||||||
|
maxval = stop;
|
||||||
|
for (pos = positions + start; start++ <= stop; *pos++ = 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* overlapping ranges */
|
||||||
|
if (autostop && maxval > autostop)
|
||||||
|
maxval = autostop;
|
||||||
|
|
||||||
|
/* set autostart */
|
||||||
|
if (autostart)
|
||||||
|
memset(positions + 1, '1', autostart);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ARGSUSED */
|
||||||
|
void
|
||||||
|
#ifndef __STDC__
|
||||||
|
c_cut(fp, fname)
|
||||||
|
FILE *fp;
|
||||||
|
char *fname;
|
||||||
|
#else
|
||||||
|
c_cut( FILE *fp,
|
||||||
|
char *fname)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
register int ch, col;
|
||||||
|
register char *pos;
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
pos = positions + 1;
|
||||||
|
for (col = maxval; col; --col) {
|
||||||
|
if ((ch = getc(fp)) == EOF)
|
||||||
|
return;
|
||||||
|
if (ch == '\n')
|
||||||
|
break;
|
||||||
|
if (*pos++)
|
||||||
|
(void)putchar(ch);
|
||||||
|
}
|
||||||
|
if (ch != '\n')
|
||||||
|
if (autostop)
|
||||||
|
while ((ch = getc(fp)) != EOF && ch != '\n')
|
||||||
|
(void)putchar(ch);
|
||||||
|
else
|
||||||
|
while ((ch = getc(fp)) != EOF && ch != '\n');
|
||||||
|
(void)putchar('\n');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
#ifndef __STDC__
|
||||||
|
f_cut(fp, fname)
|
||||||
|
FILE *fp;
|
||||||
|
char *fname;
|
||||||
|
#else
|
||||||
|
f_cut( FILE *fp,
|
||||||
|
char *fname)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
register int ch, field, isdelim;
|
||||||
|
register char *pos, *p, sep;
|
||||||
|
int output;
|
||||||
|
#ifndef __GNO__
|
||||||
|
char lbuf[_POSIX2_LINE_MAX + 1];
|
||||||
|
#else
|
||||||
|
static char lbuf[_POSIX2_LINE_MAX + 1];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
for (sep = dchar; fgets(lbuf, sizeof(lbuf), fp);) {
|
||||||
|
output = 0;
|
||||||
|
for (isdelim = 0, p = lbuf;; ++p) {
|
||||||
|
if (!(ch = *p))
|
||||||
|
errx(1, "%s: line too long", fname);
|
||||||
|
/* this should work if newline is delimiter */
|
||||||
|
if (ch == sep)
|
||||||
|
isdelim = 1;
|
||||||
|
if (ch == '\n') {
|
||||||
|
if (!isdelim && !sflag)
|
||||||
|
(void)printf("%s", lbuf);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!isdelim)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
pos = positions + 1;
|
||||||
|
for (field = maxval, p = lbuf; field; --field, ++pos) {
|
||||||
|
if (*pos) {
|
||||||
|
if (output++)
|
||||||
|
(void)putchar(sep);
|
||||||
|
while ((ch = *p++) != '\n' && ch != sep)
|
||||||
|
(void)putchar(ch);
|
||||||
|
} else
|
||||||
|
while ((ch = *p++) != '\n' && ch != sep);
|
||||||
|
if (ch == '\n')
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (ch != '\n')
|
||||||
|
if (autostop) {
|
||||||
|
if (output)
|
||||||
|
(void)putchar(sep);
|
||||||
|
for (; (ch = *p) != '\n'; ++p)
|
||||||
|
(void)putchar(ch);
|
||||||
|
} else
|
||||||
|
for (; (ch = *p) != '\n'; ++p);
|
||||||
|
(void)putchar('\n');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
#ifndef __STDC__
|
||||||
|
usage()
|
||||||
|
#else
|
||||||
|
usage(void)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
(void)fprintf(stderr, "%s\n%s\n",
|
||||||
|
"usage: cut -c list [file1 ...]",
|
||||||
|
" cut -f list [-s] [-d delim] [file ...]");
|
||||||
|
exit(1);
|
||||||
|
}
|
9
usr.bin/cut/cut.desc
Normal file
9
usr.bin/cut/cut.desc
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
Name: cut
|
||||||
|
Version: 2.0 (August 1997)
|
||||||
|
Shell: GNO
|
||||||
|
Author: Dave Tribby (from FreeBSD code)
|
||||||
|
Contact: tribby@cup.hp.com
|
||||||
|
Where: /usr/bin/cut
|
||||||
|
FTP: ground.isca.uiowa.edu apple2.caltech.edu trenco.myrias.com
|
||||||
|
|
||||||
|
Select portions of each line of a file.
|
29
usr.bin/cut/cut.rez
Normal file
29
usr.bin/cut/cut.rez
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Resources for cut version and comment
|
||||||
|
*/
|
||||||
|
#define PROG "cut"
|
||||||
|
#define DESC "Select portions of each line of a file."
|
||||||
|
|
||||||
|
#include "Types.rez"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Version
|
||||||
|
*/
|
||||||
|
resource rVersion (1, purgeable3) {
|
||||||
|
{ 2, 0, 0, /* Version 2.0.0 */
|
||||||
|
release, /* development|alpha|beta|final|release */
|
||||||
|
0 }, /* non-final release number */
|
||||||
|
verUS, /* Country */
|
||||||
|
PROG, /* Program name */
|
||||||
|
DESC " Released with GNO/ME."
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Comment
|
||||||
|
*/
|
||||||
|
resource rComment (1, purgeable3) {
|
||||||
|
PROG " v2.0 (August 1997)\n"
|
||||||
|
"GNO utility: " DESC "\n"
|
||||||
|
"Ported from FreeBSD code by Dave Tribby."
|
||||||
|
};
|
48
usr.bin/cut/tests/cut.f1.colcmp
Normal file
48
usr.bin/cut/tests/cut.f1.colcmp
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
|
||||||
|
exe aroff
|
||||||
|
exe binprint
|
||||||
|
exe cal
|
||||||
|
exe cat
|
||||||
|
exe center
|
||||||
|
exe chtyp
|
||||||
|
exe cmp
|
||||||
|
exe compress
|
||||||
|
exe conv
|
||||||
|
exe cp
|
||||||
|
exe date
|
||||||
|
exe du
|
||||||
|
exe egrep
|
||||||
|
exe fgrep
|
||||||
|
exe freeze
|
||||||
|
exe grep
|
||||||
|
exe gsh
|
||||||
|
exe head
|
||||||
|
exe info
|
||||||
|
exe init
|
||||||
|
exe less
|
||||||
|
txt less.hlp
|
||||||
|
exe lpr
|
||||||
|
exe ls
|
||||||
|
src make
|
||||||
|
exe mkdir
|
||||||
|
exe more
|
||||||
|
exe passwd
|
||||||
|
exe purge
|
||||||
|
exe script
|
||||||
|
exe shutdown
|
||||||
|
exe sleep
|
||||||
|
exe split
|
||||||
|
exe strings
|
||||||
|
exe stty
|
||||||
|
exe su
|
||||||
|
exe tail
|
||||||
|
exe tar
|
||||||
|
exe time
|
||||||
|
exe touch
|
||||||
|
exe uncompress
|
||||||
|
exe uniq
|
||||||
|
exe upper
|
||||||
|
exe vi
|
||||||
|
exe wc
|
||||||
|
exe who
|
||||||
|
exe yes
|
48
usr.bin/cut/tests/cut.f1.colcmpA
Normal file
48
usr.bin/cut/tests/cut.f1.colcmpA
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
|
||||||
|
exe aroff
|
||||||
|
exe binprint
|
||||||
|
exe cal
|
||||||
|
exe cat
|
||||||
|
exe center
|
||||||
|
exe chtyp
|
||||||
|
exe cmp
|
||||||
|
exe compress
|
||||||
|
exe conv
|
||||||
|
exe cp
|
||||||
|
exe date
|
||||||
|
exe du
|
||||||
|
exe egrep
|
||||||
|
exe fgrep
|
||||||
|
exe freeze
|
||||||
|
exe grep
|
||||||
|
exe gsh
|
||||||
|
exe head
|
||||||
|
exe info
|
||||||
|
exe init
|
||||||
|
exe less
|
||||||
|
txt less.hlp
|
||||||
|
exe lpr
|
||||||
|
exe ls
|
||||||
|
src make
|
||||||
|
exe mkdir
|
||||||
|
exe more
|
||||||
|
exe passwd
|
||||||
|
exe purge
|
||||||
|
exe script
|
||||||
|
exe shutdown
|
||||||
|
exe sleep
|
||||||
|
exe split
|
||||||
|
exe strings
|
||||||
|
exe stty
|
||||||
|
exe su
|
||||||
|
exe tail
|
||||||
|
exe tar
|
||||||
|
exe time
|
||||||
|
exe touch
|
||||||
|
exe uncompress
|
||||||
|
exe uniq
|
||||||
|
exe upper
|
||||||
|
exe vi
|
||||||
|
exe wc
|
||||||
|
exe who
|
||||||
|
exe yes
|
48
usr.bin/cut/tests/cut.f1.column
Normal file
48
usr.bin/cut/tests/cut.f1.column
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/bin/
|
||||||
|
-rwxbrd 0100 exe 21604 May 2 1992 aroff
|
||||||
|
-rwxbrd 0100 exe 16012 Sep 13 1993 binprint
|
||||||
|
-rwxbrd 0100 exe 12225 Feb 24 1992 cal
|
||||||
|
-rwxbrd 0100 exe 18756 Apr 27 1993 cat
|
||||||
|
-rwxbrd 0100 exe 11490 Jan 4 1992 center
|
||||||
|
-rwxbrd 0100 exe 18381 May 17 1993 chtyp
|
||||||
|
-rwxbrd 0000 exe 21356 Jul 16 1992 cmp
|
||||||
|
-rwxbrd 0100 exe 59392 Mar 2 1989 compress
|
||||||
|
-rwxbrd 0100 exe 18292 Feb 24 1992 conv
|
||||||
|
erwxbrd 0100 exe 28158 Apr 19 1993 cp
|
||||||
|
-rwxbrd 0100 exe 2452 Jun 29 1993 date
|
||||||
|
-rwxbrd 0100 exe 21742 Aug 15 1993 du
|
||||||
|
-rwxbrd 0100 exe 28549 Sep 21 1992 egrep
|
||||||
|
-rwxbrd 0100 exe 22230 Mar 28 1993 fgrep
|
||||||
|
-rwxbrd 0100 exe 71366 May 12 1992 freeze
|
||||||
|
-rwxbrd 0100 exe 17882 Sep 21 1992 grep
|
||||||
|
-rwxbrd 0100 exe 60178 Nov 27 1993 gsh
|
||||||
|
-rwxbrd 0100 exe 11158 Feb 24 1992 head
|
||||||
|
erwxbrd 0100 exe 17463 Nov 21 1993 info
|
||||||
|
-rwxbrd 0100 exe 3258 Aug 12 1993 init
|
||||||
|
-rwxbrd 0100 exe 95332 Aug 14 1993 less
|
||||||
|
-rw-brd 0000 txt 4745 May 4 1992 less.hlp
|
||||||
|
-rwxbrd 0100 exe 17777 Dec 12 1993 lpr
|
||||||
|
-rwxbrd 0100 exe 25292 Aug 14 1993 ls
|
||||||
|
erwxbrd 0006 src 775 Jul 17 23:25 make
|
||||||
|
-rwxbrd 0100 exe 12786 Jul 15 1993 mkdir
|
||||||
|
-rwxbrd 0100 exe 19818 Jun 4 1993 more
|
||||||
|
erwxbrd 0100 exe 26015 Sep 6 1993 passwd
|
||||||
|
-rwxbrd 0100 exe 2974 Dec 31 1991 purge
|
||||||
|
-rwxbrd 0100 exe 20346 Sep 5 1993 script
|
||||||
|
-rwxbrd 0100 exe 1711 Feb 11 1993 shutdown
|
||||||
|
-rwxbrd 0100 exe 3712 Feb 24 1992 sleep
|
||||||
|
-rwxbrd 0100 exe 21680 Nov 12 1992 split
|
||||||
|
-rwxbrd 0100 exe 14762 May 26 1992 strings
|
||||||
|
-rwxbrd 0100 exe 16276 Sep 5 1993 stty
|
||||||
|
erwxbrd 0100 exe 26396 Sep 5 1993 su
|
||||||
|
-rwxbrd 0000 exe 16416 Jan 18 1993 tail
|
||||||
|
-rwxbrd 0100 exe 23710 Oct 16 1993 tar
|
||||||
|
-rwxbrd 0100 exe 12326 Jul 10 1993 time
|
||||||
|
-rwxbrd 0100 exe 11599 Feb 4 1992 touch
|
||||||
|
-rwxbrd 0100 exe 1791 Apr 27 1992 uncompress
|
||||||
|
-rwxbrd 0100 exe 15431 Feb 24 1992 uniq
|
||||||
|
-rwxbrd 0100 exe 1775 Feb 1 1992 upper
|
||||||
|
-rwxbrd 0100 exe 119028 Feb 3 1994 vi
|
||||||
|
-rwxbrd 0100 exe 16548 Jul 20 1992 wc
|
||||||
|
-rwxbrd 0100 exe 20021 Sep 28 1993 who
|
||||||
|
-rwxbrd 0100 exe 8517 Feb 24 1992 yes
|
48
usr.bin/cut/tests/cut.f1.semcmp
Normal file
48
usr.bin/cut/tests/cut.f1.semcmp
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/bin/
|
||||||
|
exe;aroff
|
||||||
|
exe;binprint
|
||||||
|
exe;cal
|
||||||
|
exe;cat
|
||||||
|
exe;center
|
||||||
|
exe;chtyp
|
||||||
|
exe;cmp
|
||||||
|
exe;compress
|
||||||
|
exe;conv
|
||||||
|
exe;cp
|
||||||
|
exe;date
|
||||||
|
exe;du
|
||||||
|
exe;egrep
|
||||||
|
exe;fgrep
|
||||||
|
exe;freeze
|
||||||
|
exe;grep
|
||||||
|
exe;gsh
|
||||||
|
exe;head
|
||||||
|
exe;info
|
||||||
|
exe;init
|
||||||
|
exe;less
|
||||||
|
txt;less.hlp
|
||||||
|
exe;lpr
|
||||||
|
exe;ls
|
||||||
|
src;make
|
||||||
|
exe;mkdir
|
||||||
|
exe;more
|
||||||
|
exe;passwd
|
||||||
|
exe;purge
|
||||||
|
exe;script
|
||||||
|
exe;shutdown
|
||||||
|
exe;sleep
|
||||||
|
exe;split
|
||||||
|
exe;strings
|
||||||
|
exe;stty
|
||||||
|
exe;su
|
||||||
|
exe;tail
|
||||||
|
exe;tar
|
||||||
|
exe;time
|
||||||
|
exe;touch
|
||||||
|
exe;uncompress
|
||||||
|
exe;uniq
|
||||||
|
exe;upper
|
||||||
|
exe;vi
|
||||||
|
exe;wc
|
||||||
|
exe;who
|
||||||
|
exe;yes
|
47
usr.bin/cut/tests/cut.f1.semcmpA
Normal file
47
usr.bin/cut/tests/cut.f1.semcmpA
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
exe;aroff
|
||||||
|
exe;binprint
|
||||||
|
exe;cal
|
||||||
|
exe;cat
|
||||||
|
exe;center
|
||||||
|
exe;chtyp
|
||||||
|
exe;cmp
|
||||||
|
exe;compress
|
||||||
|
exe;conv
|
||||||
|
exe;cp
|
||||||
|
exe;date
|
||||||
|
exe;du
|
||||||
|
exe;egrep
|
||||||
|
exe;fgrep
|
||||||
|
exe;freeze
|
||||||
|
exe;grep
|
||||||
|
exe;gsh
|
||||||
|
exe;head
|
||||||
|
exe;info
|
||||||
|
exe;init
|
||||||
|
exe;less
|
||||||
|
txt;less.hlp
|
||||||
|
exe;lpr
|
||||||
|
exe;ls
|
||||||
|
src;make
|
||||||
|
exe;mkdir
|
||||||
|
exe;more
|
||||||
|
exe;passwd
|
||||||
|
exe;purge
|
||||||
|
exe;script
|
||||||
|
exe;shutdown
|
||||||
|
exe;sleep
|
||||||
|
exe;split
|
||||||
|
exe;strings
|
||||||
|
exe;stty
|
||||||
|
exe;su
|
||||||
|
exe;tail
|
||||||
|
exe;tar
|
||||||
|
exe;time
|
||||||
|
exe;touch
|
||||||
|
exe;uncompress
|
||||||
|
exe;uniq
|
||||||
|
exe;upper
|
||||||
|
exe;vi
|
||||||
|
exe;wc
|
||||||
|
exe;who
|
||||||
|
exe;yes
|
48
usr.bin/cut/tests/cut.f1.semi
Normal file
48
usr.bin/cut/tests/cut.f1.semi
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/bin/
|
||||||
|
-rwxbrd;0100;exe;21604;May;2;1992;aroff
|
||||||
|
-rwxbrd;0100;exe;16012;Sep;13;1993;binprint
|
||||||
|
-rwxbrd;0100;exe;12225;Feb;24;1992;cal
|
||||||
|
-rwxbrd;0100;exe;18756;Apr;27;1993;cat
|
||||||
|
-rwxbrd;0100;exe;11490;Jan;4;1992;center
|
||||||
|
-rwxbrd;0100;exe;18381;May;17;1993;chtyp
|
||||||
|
-rwxbrd;0000;exe;21356;Jul;16;1992;cmp
|
||||||
|
-rwxbrd;0100;exe;59392;Mar;2;1989;compress
|
||||||
|
-rwxbrd;0100;exe;18292;Feb;24;1992;conv
|
||||||
|
erwxbrd;0100;exe;28158;Apr;19;1993;cp
|
||||||
|
-rwxbrd;0100;exe;2452;Jun;29;1993;date
|
||||||
|
-rwxbrd;0100;exe;21742;Aug;15;1993;du
|
||||||
|
-rwxbrd;0100;exe;28549;Sep;21;1992;egrep
|
||||||
|
-rwxbrd;0100;exe;22230;Mar;28;1993;fgrep
|
||||||
|
-rwxbrd;0100;exe;71366;May;12;1992;freeze
|
||||||
|
-rwxbrd;0100;exe;17882;Sep;21;1992;grep
|
||||||
|
-rwxbrd;0100;exe;60178;Nov;27;1993;gsh
|
||||||
|
-rwxbrd;0100;exe;11158;Feb;24;1992;head
|
||||||
|
erwxbrd;0100;exe;17463;Nov;21;1993;info
|
||||||
|
-rwxbrd;0100;exe;3258;Aug;12;1993;init
|
||||||
|
-rwxbrd;0100;exe;95332;Aug;14;1993;less
|
||||||
|
-rw-brd;0000;txt;4745;May;4;1992;less.hlp
|
||||||
|
-rwxbrd;0100;exe;17777;Dec;12;1993;lpr
|
||||||
|
-rwxbrd;0100;exe;25292;Aug;14;1993;ls
|
||||||
|
erwxbrd;0006;src;775;Jul;17;23:25;make
|
||||||
|
-rwxbrd;0100;exe;12786;Jul;15;1993;mkdir
|
||||||
|
-rwxbrd;0100;exe;19818;Jun;4;1993;more
|
||||||
|
erwxbrd;0100;exe;26015;Sep;6;1993;passwd
|
||||||
|
-rwxbrd;0100;exe;2974;Dec;31;1991;purge
|
||||||
|
-rwxbrd;0100;exe;20346;Sep;5;1993;script
|
||||||
|
-rwxbrd;0100;exe;1711;Feb;11;1993;shutdown
|
||||||
|
-rwxbrd;0100;exe;3712;Feb;24;1992;sleep
|
||||||
|
-rwxbrd;0100;exe;21680;Nov;12;1992;split
|
||||||
|
-rwxbrd;0100;exe;14762;May;26;1992;strings
|
||||||
|
-rwxbrd;0100;exe;16276;Sep;5;1993;stty
|
||||||
|
erwxbrd;0100;exe;26396;Sep;5;1993;su
|
||||||
|
-rwxbrd;0000;exe;16416;Jan;18;1993;tail
|
||||||
|
-rwxbrd;0100;exe;23710;Oct;16;1993;tar
|
||||||
|
-rwxbrd;0100;exe;12326;Jul;10;1993;time
|
||||||
|
-rwxbrd;0100;exe;11599;Feb;4;1992;touch
|
||||||
|
-rwxbrd;0100;exe;1791;Apr;27;1992;uncompress
|
||||||
|
-rwxbrd;0100;exe;15431;Feb;24;1992;uniq
|
||||||
|
-rwxbrd;0100;exe;1775;Feb;1;1992;upper
|
||||||
|
-rwxbrd;0100;exe;119028;Feb;3;1994;vi
|
||||||
|
-rwxbrd;0100;exe;16548;Jul;20;1992;wc
|
||||||
|
-rwxbrd;0100;exe;20021;Sep;28;1993;who
|
||||||
|
-rwxbrd;0100;exe;8517;Feb;24;1992;yes
|
48
usr.bin/cut/tests/cut.f1.tab
Normal file
48
usr.bin/cut/tests/cut.f1.tab
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/bin/
|
||||||
|
-rwxbrd 0100 exe 21604 May 2 1992 aroff
|
||||||
|
-rwxbrd 0100 exe 16012 Sep 13 1993 binprint
|
||||||
|
-rwxbrd 0100 exe 12225 Feb 24 1992 cal
|
||||||
|
-rwxbrd 0100 exe 18756 Apr 27 1993 cat
|
||||||
|
-rwxbrd 0100 exe 11490 Jan 4 1992 center
|
||||||
|
-rwxbrd 0100 exe 18381 May 17 1993 chtyp
|
||||||
|
-rwxbrd 0000 exe 21356 Jul 16 1992 cmp
|
||||||
|
-rwxbrd 0100 exe 59392 Mar 2 1989 compress
|
||||||
|
-rwxbrd 0100 exe 18292 Feb 24 1992 conv
|
||||||
|
erwxbrd 0100 exe 28158 Apr 19 1993 cp
|
||||||
|
-rwxbrd 0100 exe 2452 Jun 29 1993 date
|
||||||
|
-rwxbrd 0100 exe 21742 Aug 15 1993 du
|
||||||
|
-rwxbrd 0100 exe 28549 Sep 21 1992 egrep
|
||||||
|
-rwxbrd 0100 exe 22230 Mar 28 1993 fgrep
|
||||||
|
-rwxbrd 0100 exe 71366 May 12 1992 freeze
|
||||||
|
-rwxbrd 0100 exe 17882 Sep 21 1992 grep
|
||||||
|
-rwxbrd 0100 exe 60178 Nov 27 1993 gsh
|
||||||
|
-rwxbrd 0100 exe 11158 Feb 24 1992 head
|
||||||
|
erwxbrd 0100 exe 17463 Nov 21 1993 info
|
||||||
|
-rwxbrd 0100 exe 3258 Aug 12 1993 init
|
||||||
|
-rwxbrd 0100 exe 95332 Aug 14 1993 less
|
||||||
|
-rw-brd 0000 txt 4745 May 4 1992 less.hlp
|
||||||
|
-rwxbrd 0100 exe 17777 Dec 12 1993 lpr
|
||||||
|
-rwxbrd 0100 exe 25292 Aug 14 1993 ls
|
||||||
|
erwxbrd 0006 src 775 Jul 17 23:25 make
|
||||||
|
-rwxbrd 0100 exe 12786 Jul 15 1993 mkdir
|
||||||
|
-rwxbrd 0100 exe 19818 Jun 4 1993 more
|
||||||
|
erwxbrd 0100 exe 26015 Sep 6 1993 passwd
|
||||||
|
-rwxbrd 0100 exe 2974 Dec 31 1991 purge
|
||||||
|
-rwxbrd 0100 exe 20346 Sep 5 1993 script
|
||||||
|
-rwxbrd 0100 exe 1711 Feb 11 1993 shutdown
|
||||||
|
-rwxbrd 0100 exe 3712 Feb 24 1992 sleep
|
||||||
|
-rwxbrd 0100 exe 21680 Nov 12 1992 split
|
||||||
|
-rwxbrd 0100 exe 14762 May 26 1992 strings
|
||||||
|
-rwxbrd 0100 exe 16276 Sep 5 1993 stty
|
||||||
|
erwxbrd 0100 exe 26396 Sep 5 1993 su
|
||||||
|
-rwxbrd 0000 exe 16416 Jan 18 1993 tail
|
||||||
|
-rwxbrd 0100 exe 23710 Oct 16 1993 tar
|
||||||
|
-rwxbrd 0100 exe 12326 Jul 10 1993 time
|
||||||
|
-rwxbrd 0100 exe 11599 Feb 4 1992 touch
|
||||||
|
-rwxbrd 0100 exe 1791 Apr 27 1992 uncompress
|
||||||
|
-rwxbrd 0100 exe 15431 Feb 24 1992 uniq
|
||||||
|
-rwxbrd 0100 exe 1775 Feb 1 1992 upper
|
||||||
|
-rwxbrd 0100 exe 119028 Feb 3 1994 vi
|
||||||
|
-rwxbrd 0100 exe 16548 Jul 20 1992 wc
|
||||||
|
-rwxbrd 0100 exe 20021 Sep 28 1993 who
|
||||||
|
-rwxbrd 0100 exe 8517 Feb 24 1992 yes
|
48
usr.bin/cut/tests/cut.f1.tabcmp
Normal file
48
usr.bin/cut/tests/cut.f1.tabcmp
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/bin/
|
||||||
|
exe aroff
|
||||||
|
exe binprint
|
||||||
|
exe cal
|
||||||
|
exe cat
|
||||||
|
exe center
|
||||||
|
exe chtyp
|
||||||
|
exe cmp
|
||||||
|
exe compress
|
||||||
|
exe conv
|
||||||
|
exe cp
|
||||||
|
exe date
|
||||||
|
exe du
|
||||||
|
exe egrep
|
||||||
|
exe fgrep
|
||||||
|
exe freeze
|
||||||
|
exe grep
|
||||||
|
exe gsh
|
||||||
|
exe head
|
||||||
|
exe info
|
||||||
|
exe init
|
||||||
|
exe less
|
||||||
|
txt less.hlp
|
||||||
|
exe lpr
|
||||||
|
exe ls
|
||||||
|
src make
|
||||||
|
exe mkdir
|
||||||
|
exe more
|
||||||
|
exe passwd
|
||||||
|
exe purge
|
||||||
|
exe script
|
||||||
|
exe shutdown
|
||||||
|
exe sleep
|
||||||
|
exe split
|
||||||
|
exe strings
|
||||||
|
exe stty
|
||||||
|
exe su
|
||||||
|
exe tail
|
||||||
|
exe tar
|
||||||
|
exe time
|
||||||
|
exe touch
|
||||||
|
exe uncompress
|
||||||
|
exe uniq
|
||||||
|
exe upper
|
||||||
|
exe vi
|
||||||
|
exe wc
|
||||||
|
exe who
|
||||||
|
exe yes
|
103
usr.bin/cut/tests/dotests
Normal file
103
usr.bin/cut/tests/dotests
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
# Tests for cut command; invoked by command file "fulltests"
|
||||||
|
# Written by Dave Tribby (August 1997)
|
||||||
|
|
||||||
|
# Can generate a set of test files by the following:
|
||||||
|
# ll /bin > cut.f1.columns
|
||||||
|
# tr ' ' '\t' < cut.f1.columns | tr -s '\t' > cut.f1.tab
|
||||||
|
# tr '\t' ';' < cut.f1.tab > cut.f1.semi
|
||||||
|
|
||||||
|
# Location of the cut command to be tested
|
||||||
|
set testcmd="../cut"
|
||||||
|
|
||||||
|
# Record starting time
|
||||||
|
echo -n "Testing command $testcmd beginning at"
|
||||||
|
date
|
||||||
|
|
||||||
|
set src="cut.f1.column"
|
||||||
|
set cmp="cut.f1.colcmp"
|
||||||
|
set dest="/tmp/$cmp"
|
||||||
|
echo "Cutting columns from $src"
|
||||||
|
$testcmd -c 14-17,41- $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="${cmp}A"
|
||||||
|
set dest="/tmp/$cmp"
|
||||||
|
echo "Cutting columns from $src using stdin"
|
||||||
|
$testcmd -c 14-17,41- < $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="cut.f1.tab"
|
||||||
|
set cmp="cut.f1.tabcmp"
|
||||||
|
set dest="/tmp/$cmp"
|
||||||
|
echo "Cutting tab-delimited fields from $src"
|
||||||
|
$testcmd -f 3,8 $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="cut.f1.semi"
|
||||||
|
set cmp="cut.f1.semcmp"
|
||||||
|
set dest="/tmp/$cmp"
|
||||||
|
echo "Cutting semicolon-delimited fields from $src"
|
||||||
|
$testcmd -d ';' -f 3,8 $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="${cmp}A"
|
||||||
|
set dest="/tmp/$cmp"
|
||||||
|
echo "Cutting semicolon-delimited fields from $src, supressing extra lines"
|
||||||
|
$testcmd -d ';' -f 3,8 -s $src > $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 dest="/tmp/err.cond"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Expected error: illegal option"
|
||||||
|
$testcmd -x $src > $dest
|
||||||
|
echo " Error completion status = $status (expected: 1)"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Expected error: values may not include zero:"
|
||||||
|
$testcmd -f 0,1,2 $src > $dest
|
||||||
|
echo " Error completion status = $status (expected: 1)"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Expected error: values may not include zero:"
|
||||||
|
$testcmd -c 0-5 $src > $dest
|
||||||
|
echo " Error completion status = $status (expected: 1)"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Expected error: <number> too large (max <max_value>)"
|
||||||
|
$testcmd -c 2000-32767 $src > $dest
|
||||||
|
echo " Error completion status = $status (expected: 1)"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Expected error: <number> too large (max <max_value>)"
|
||||||
|
$testcmd -f 300000 $src > $dest
|
||||||
|
echo " Error completion status = $status (expected: 1)"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
set src="badname"
|
||||||
|
echo "Expected error: $src: no such file or directory"
|
||||||
|
$testcmd -f 3 $src > $dest
|
||||||
|
echo " Error completion status = $status (expected: 1)"
|
28
usr.bin/cut/tests/fulltests
Normal file
28
usr.bin/cut/tests/fulltests
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
# gsh script to run tests and collect results
|
||||||
|
# Written by Dave Tribby * August 1997
|
||||||
|
|
||||||
|
# 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/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\""
|
67
usr.bin/cut/tests/test.list
Normal file
67
usr.bin/cut/tests/test.list
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
Script started on: Mon Sep 01 15:09:25 1997
|
||||||
|
[61] test=> dotests ; exit
|
||||||
|
Testing command ../cut beginning at Mon Sep 1 15:09:36 1997
|
||||||
|
Cutting columns from cut.f1.column
|
||||||
|
==> 591 stack bytes used <==
|
||||||
|
Completion status = 0
|
||||||
|
Checking results against control file cut.f1.colcmp (no differences expected)
|
||||||
|
Completion status = 0
|
||||||
|
|
||||||
|
Cutting columns from cut.f1.column using stdin
|
||||||
|
==> 591 stack bytes used <==
|
||||||
|
Completion status = 0
|
||||||
|
Checking results against control file cut.f1.colcmpA (no differences expected)
|
||||||
|
Completion status = 0
|
||||||
|
|
||||||
|
Cutting tab-delimited fields from cut.f1.tab
|
||||||
|
==> 822 stack bytes used <==
|
||||||
|
Completion status = 0
|
||||||
|
Checking results against control file cut.f1.tabcmp (no differences expected)
|
||||||
|
Completion status = 0
|
||||||
|
|
||||||
|
Cutting semicolon-delimited fields from cut.f1.semi
|
||||||
|
==> 822 stack bytes used <==
|
||||||
|
Completion status = 0
|
||||||
|
Checking results against control file cut.f1.semcmp (no differences expected)
|
||||||
|
Completion status = 0
|
||||||
|
|
||||||
|
Cutting semicolon-delimited fields from cut.f1.semi, supressing extra lines
|
||||||
|
==> 626 stack bytes used <==
|
||||||
|
Completion status = 0
|
||||||
|
Checking results against control file cut.f1.semcmpA (no differences expected)
|
||||||
|
Completion status = 0
|
||||||
|
|
||||||
|
***** Error Messages *****
|
||||||
|
|
||||||
|
Expected error: illegal option
|
||||||
|
cut: illegal option -- x
|
||||||
|
usage: cut -c list [file1 ...]
|
||||||
|
cut -f list [-s] [-d delim] [file ...]
|
||||||
|
==> 1831 stack bytes used <==
|
||||||
|
Error completion status = 1 (expected: 1)
|
||||||
|
|
||||||
|
Expected error: values may not include zero:
|
||||||
|
cut: [-cf] list: values may not include zero
|
||||||
|
==> 1881 stack bytes used <==
|
||||||
|
Error completion status = 1 (expected: 1)
|
||||||
|
|
||||||
|
Expected error: values may not include zero:
|
||||||
|
cut: [-cf] list: values may not include zero
|
||||||
|
==> 1881 stack bytes used <==
|
||||||
|
Error completion status = 1 (expected: 1)
|
||||||
|
|
||||||
|
Expected error: <number> too large (max <max_value>)
|
||||||
|
cut: [-cf] list: 32767 too large (max 2048)
|
||||||
|
==> 1887 stack bytes used <==
|
||||||
|
Error completion status = 1 (expected: 1)
|
||||||
|
|
||||||
|
Expected error: <number> too large (max <max_value>)
|
||||||
|
cut: [-cf] list: 300000 too large (max 2048)
|
||||||
|
==> 1887 stack bytes used <==
|
||||||
|
Error completion status = 1 (expected: 1)
|
||||||
|
|
||||||
|
Expected error: badname: no such file or directory
|
||||||
|
cut: badname: no such file or directory
|
||||||
|
==> 1850 stack bytes used <==
|
||||||
|
Error completion status = 1 (expected: 1)
|
||||||
|
Script done on: Mon Sep 01 15:10:29 1997
|
Loading…
Reference in New Issue
Block a user