summaryrefslogtreecommitdiff
path: root/usr.bin/sort
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/sort')
-rw-r--r--usr.bin/sort/sort.16
-rw-r--r--usr.bin/sort/sort.c15
2 files changed, 15 insertions, 6 deletions
diff --git a/usr.bin/sort/sort.1 b/usr.bin/sort/sort.1
index e42e6435dea..39f25c29e64 100644
--- a/usr.bin/sort/sort.1
+++ b/usr.bin/sort/sort.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: sort.1,v 1.21 2003/07/14 12:56:07 jmc Exp $
+.\" $OpenBSD: sort.1,v 1.22 2005/09/27 23:40:07 dlg Exp $
.\"
.\" Copyright (c) 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -40,7 +40,7 @@
.Nd sort or merge text files
.Sh SYNOPSIS
.Nm sort
-.Op Fl cmubdfinrH
+.Op Fl cmubdfinrzH
.Op Fl t Ar char
.Op Fl R Ar char
.Oo
@@ -198,6 +198,8 @@ option replaces the obsolescent options
.Cm \(pl Ns Ar pos1
and
.Fl Ns Ar pos2 .
+.It Fl z
+Uses the nul character as the record separator.
.El
.Pp
The following operands are available:
diff --git a/usr.bin/sort/sort.c b/usr.bin/sort/sort.c
index 60611021c08..242abc1f7c4 100644
--- a/usr.bin/sort/sort.c
+++ b/usr.bin/sort/sort.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sort.c,v 1.25 2005/04/11 21:04:48 moritz Exp $ */
+/* $OpenBSD: sort.c,v 1.26 2005/09/27 23:40:07 dlg Exp $ */
/*-
* Copyright (c) 1993
@@ -42,7 +42,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)sort.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: sort.c,v 1.25 2005/04/11 21:04:48 moritz Exp $";
+static char rcsid[] = "$OpenBSD: sort.c,v 1.26 2005/09/27 23:40:07 dlg Exp $";
#endif
#endif /* not lint */
@@ -125,7 +125,7 @@ main(int argc, char *argv[])
fixit(&argc, argv);
if (!issetugid() && (outfile = getenv("TMPDIR")))
tmpdir = outfile;
- while ((ch = getopt(argc, argv, "bcdfik:mHno:rR:t:T:uy:")) != -1) {
+ while ((ch = getopt(argc, argv, "bcdfik:mHno:rR:t:T:uy:z")) != -1) {
switch (ch) {
case 'b': fldtab->flags |= BI | BT;
break;
@@ -185,6 +185,13 @@ main(int argc, char *argv[])
case 'y':
/* accept -y for backwards compat. */
break;
+ case 'z':
+ if (REC_D != '\n')
+ usage("multiple record delimiters");
+ REC_D = '\0';
+ d_mask['\n'] = d_mask[' '];
+ d_mask[REC_D] = REC_D_F;
+ break;
case '?':
default:
usage(NULL);
@@ -328,7 +335,7 @@ usage(char *msg)
if (msg != NULL)
warnx("%s", msg);
- (void)fprintf(stderr, "usage: %s [-T dir] [-o output] [-cmubdfinrH] "
+ (void)fprintf(stderr, "usage: %s [-T dir] [-o output] [-cmubdfinrHz] "
"[-t char] [-R char] [-k keydef] ... [files]\n", __progname);
exit(2);
}