summaryrefslogtreecommitdiff
path: root/usr.bin/sort/sort.c
diff options
context:
space:
mode:
authorEric Jackson <ericj@cvs.openbsd.org>2001-02-04 21:27:02 +0000
committerEric Jackson <ericj@cvs.openbsd.org>2001-02-04 21:27:02 +0000
commit7c9239b092687212692b33fd3bc949bbc97bda80 (patch)
tree7669d1925177125a756ba36106579d657e49f1c8 /usr.bin/sort/sort.c
parent102fd29b8c10ae3a319396eec50f11e40742869c (diff)
Bring in some recent fixup's from NetBSD. This allows lines longer than 65522
to be properly sorted. Many other cleanup's done, and depreciate register. millert@ and deraadt@ ok.
Diffstat (limited to 'usr.bin/sort/sort.c')
-rw-r--r--usr.bin/sort/sort.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/sort/sort.c b/usr.bin/sort/sort.c
index 7da39b63aeb..d9d1676c202 100644
--- a/usr.bin/sort/sort.c
+++ b/usr.bin/sort/sort.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sort.c,v 1.15 2001/01/19 17:58:18 deraadt Exp $ */
+/* $OpenBSD: sort.c,v 1.16 2001/02/04 21:27:01 ericj Exp $ */
/*-
* Copyright (c) 1993
@@ -46,7 +46,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.15 2001/01/19 17:58:18 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: sort.c,v 1.16 2001/02/04 21:27:01 ericj Exp $";
#endif
#endif /* not lint */
@@ -62,6 +62,7 @@ static char rcsid[] = "$OpenBSD: sort.c,v 1.15 2001/01/19 17:58:18 deraadt Exp $
#include <sys/types.h>
#include <sys/stat.h>
+#include <locale.h>
#include <paths.h>
#include <signal.h>
#include <stdlib.h>
@@ -119,6 +120,8 @@ main(argc, argv)
FILE *outfp = NULL;
void *p;
+ setlocale(LC_ALL, "");
+
if ((clist = calloc((ND+1)*2, sizeof(struct coldesc))) == NULL ||
(ftpos = fldtab = calloc(ND+2, sizeof(struct field))) == NULL)
errx(2, "cannot allocate memory");
@@ -331,7 +334,7 @@ usage(msg)
{
extern char *__progname;
- if (msg)
+ if (msg != NULL)
warnx("%s", msg);
(void)fprintf(stderr, "usage: %s [-T dir] [-o output] [-cmubdfinrH] "
"[-t char] [-R char] [-k keydef] ... [files]\n", __progname);