summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2002-06-07 01:04:24 +0000
committertjr <tjr@FreeBSD.org>2002-06-07 01:04:24 +0000
commite20227aeb23a1c3b5aa07638cf4e7c8c2772a2bc (patch)
treec92f2d6f1e19637166c9c1d92e23973a70534e48
parentc1a85efa3ab52899e85a6244b2f062ac0284c2d6 (diff)
downloadFreeBSD-src-e20227aeb23a1c3b5aa07638cf4e7c8c2772a2bc.zip
FreeBSD-src-e20227aeb23a1c3b5aa07638cf4e7c8c2772a2bc.tar.gz
Respect LC_CTYPE and LC_COLLATE environment variables, mainly for their
effects on regular expressions. The libc regex code does not handle equivalence classes well (for example), but we do our best.
-rw-r--r--usr.bin/csplit/csplit.111
-rw-r--r--usr.bin/csplit/csplit.c3
2 files changed, 14 insertions, 0 deletions
diff --git a/usr.bin/csplit/csplit.1 b/usr.bin/csplit/csplit.1
index 61526ea..84ca52c 100644
--- a/usr.bin/csplit/csplit.1
+++ b/usr.bin/csplit/csplit.1
@@ -115,6 +115,17 @@ After all the patterns have been processed, the remaining input data
.Pp
Requesting to split at a line before the current line number or past the
end of the file will result in an error.
+.Sh ENVIRONMENT
+The
+.Ev LANG ,
+.Ev LC_ALL ,
+.Ev LC_COLLATE
+and
+.Ev LC_CTYPE
+environment variables affect the execution of
+.Nm
+as described in
+.Xr environ 7 .
.Sh EXAMPLES
Split the
.Xr mdoc 7
diff --git a/usr.bin/csplit/csplit.c b/usr.bin/csplit/csplit.c
index f54a489..5513f7b 100644
--- a/usr.bin/csplit/csplit.c
+++ b/usr.bin/csplit/csplit.c
@@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
#include <err.h>
#include <errno.h>
#include <limits.h>
+#include <locale.h>
#include <regex.h>
#include <signal.h>
#include <stdint.h>
@@ -99,6 +100,8 @@ main(int argc, char *argv[])
char *ep, *p;
FILE *ofp;
+ setlocale(LC_ALL, "");
+
kflag = sflag = 0;
prefix = "xx";
sufflen = 2;
OpenPOWER on IntegriCloud