From df111dde6ea37525b407e0f833d46fbb0acb6fac Mon Sep 17 00:00:00 2001 From: "Tim J. Robbins" Date: Thu, 30 May 2002 11:43:20 +0000 Subject: [PATCH] Sort entries by locale collating order when -x is specified. --- usr.bin/ctags/ctags.c | 6 ++++++ usr.bin/ctags/tree.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/usr.bin/ctags/ctags.c b/usr.bin/ctags/ctags.c index 04ac8ac4f289..08de5aaac7c3 100644 --- a/usr.bin/ctags/ctags.c +++ b/usr.bin/ctags/ctags.c @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -97,6 +98,8 @@ main(argc, argv) int ch; /* getopts char */ char *cmd; + setlocale(LC_ALL, ""); + aflag = uflag = NO; tflag = YES; while ((ch = getopt(argc, argv, "BFTadf:tuwvx")) != -1) @@ -142,6 +145,9 @@ main(argc, argv) if (!argc) usage(); + if (!xflag) + setlocale(LC_COLLATE, "C"); + init(); for (exit_val = step = 0; step < argc; ++step) diff --git a/usr.bin/ctags/tree.c b/usr.bin/ctags/tree.c index 9dc20218925a..77a57787665c 100644 --- a/usr.bin/ctags/tree.c +++ b/usr.bin/ctags/tree.c @@ -104,7 +104,7 @@ add_node(node, cur_node) { int dif; - dif = strcmp(node->entry, cur_node->entry); + dif = strcoll(node->entry, cur_node->entry); if (!dif) { if (node->file == cur_node->file) { if (!wflag)