WARNSify, fix .Nm usage, getopt returns -1 not EOF, deprecate register
This commit is contained in:
parent
46f4e7d336
commit
263324f188
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: cut.1,v 1.6 1995/10/02 20:19:26 jtc Exp $
|
||||
.\" $NetBSD: cut.1,v 1.7 1997/10/18 13:21:28 lukem Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1989, 1990, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
|
@ -43,21 +43,21 @@
|
|||
.Nm cut
|
||||
.Nd select portions of each line of a file
|
||||
.Sh SYNOPSIS
|
||||
.Nm cut
|
||||
.Nm
|
||||
.Fl b Ar list
|
||||
.Op Fl n
|
||||
.Op Ar
|
||||
.Nm cut
|
||||
.Nm "'
|
||||
.Fl c Ar list
|
||||
.Op Ar
|
||||
.Nm cut
|
||||
.Nm ""
|
||||
.Fl f Ar list
|
||||
.Op Fl d Ar delim
|
||||
.Op Fl s
|
||||
.Op Ar
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm cut
|
||||
.Nm
|
||||
utility selects portions of each line (as specified by
|
||||
.Ar list )
|
||||
from each
|
||||
|
@ -111,12 +111,12 @@ Suppresses lines with no field delimiter characters.
|
|||
Unless specified, lines with no delimiters are passed through unmodified.
|
||||
.El
|
||||
.Pp
|
||||
.Nm Cut
|
||||
.Nm
|
||||
exits 0 on success, 1 if an error occurred.
|
||||
.Sh SEE ALSO
|
||||
.Xr paste 1
|
||||
.Sh STANDARDS
|
||||
The
|
||||
.Nm cut
|
||||
.Nm
|
||||
utility conforms to
|
||||
.St -p1003.2-92 .
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cut.c,v 1.10 1997/02/11 09:41:45 mrg Exp $ */
|
||||
/* $NetBSD: cut.c,v 1.11 1997/10/18 13:21:39 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
|
@ -36,17 +36,17 @@
|
|||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"@(#) Copyright (c) 1989, 1993\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
__COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\
|
||||
The Regents of the University of California. All rights reserved.\n");
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)cut.c 8.3 (Berkeley) 5/4/95";
|
||||
#endif
|
||||
static char rcsid[] = "$NetBSD: cut.c,v 1.10 1997/02/11 09:41:45 mrg Exp $";
|
||||
__RCSID("$NetBSD: cut.c,v 1.11 1997/10/18 13:21:39 lukem Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <ctype.h>
|
||||
|
@ -68,6 +68,7 @@ int sflag;
|
|||
void c_cut __P((FILE *, char *));
|
||||
void f_cut __P((FILE *, char *));
|
||||
void get_list __P((char *));
|
||||
int main __P((int, char **));
|
||||
void usage __P((void));
|
||||
|
||||
int
|
||||
|
@ -79,6 +80,7 @@ main(argc, argv)
|
|||
void (*fcn) __P((FILE *, char *));
|
||||
int ch;
|
||||
|
||||
fcn = NULL;
|
||||
setlocale (LC_ALL, "");
|
||||
|
||||
dchar = '\t'; /* default delimiter is \t */
|
||||
|
@ -140,8 +142,8 @@ void
|
|||
get_list(list)
|
||||
char *list;
|
||||
{
|
||||
register int setautostart, start, stop;
|
||||
register char *pos;
|
||||
int setautostart, start, stop;
|
||||
char *pos;
|
||||
char *p;
|
||||
|
||||
/*
|
||||
|
@ -152,7 +154,7 @@ get_list(list)
|
|||
* overlapping lists. We also handle "-3-5" although there's no
|
||||
* real reason too.
|
||||
*/
|
||||
for (; p = strtok(list, ", \t"); list = NULL) {
|
||||
for (; (p = strtok(list, ", \t")) != NULL; list = NULL) {
|
||||
setautostart = start = stop = 0;
|
||||
if (*p == '-') {
|
||||
++p;
|
||||
|
@ -199,9 +201,10 @@ c_cut(fp, fname)
|
|||
FILE *fp;
|
||||
char *fname;
|
||||
{
|
||||
register int ch, col;
|
||||
register char *pos;
|
||||
int ch, col;
|
||||
char *pos;
|
||||
|
||||
ch = 0;
|
||||
for (;;) {
|
||||
pos = positions + 1;
|
||||
for (col = maxval; col; --col) {
|
||||
|
@ -227,8 +230,8 @@ f_cut(fp, fname)
|
|||
FILE *fp;
|
||||
char *fname;
|
||||
{
|
||||
register int ch, field, isdelim;
|
||||
register char *pos, *p, sep;
|
||||
int ch, field, isdelim;
|
||||
char *pos, *p, sep;
|
||||
int output;
|
||||
char lbuf[_POSIX2_LINE_MAX + 1];
|
||||
|
||||
|
|
Loading…
Reference in New Issue