svn commit: r334744 - in head: . tools/build/mk usr.bin/grep usr.bin/grep/nls
Baptiste Daroussin
bapt at FreeBSD.org
Wed Jun 6 23:12:37 UTC 2018
Author: bapt
Date: Wed Jun 6 23:12:35 2018
New Revision: 334744
URL: https://svnweb.freebsd.org/changeset/base/334744
Log:
Remove NLS support from BSD grep
GNU grep as in actually in base does not have any translations support
compiled in, so no functionnality loss.
We do support 193 locales in base, we will never catch up on that number of
translation with bsd grep.
Removing NLS support make bsd grep consistent with the other binaries in base
which are not translated, and also reduce a little bit the code.
Reviewed by: kevans
Approved by: kevans
Discussed with: kevans @BSDCan
Differential Revision: https://reviews.freebsd.org/D15682
Deleted:
head/usr.bin/grep/nls/
Modified:
head/ObsoleteFiles.inc
head/tools/build/mk/OptionalObsoleteFiles.inc
head/usr.bin/grep/Makefile
head/usr.bin/grep/grep.c
head/usr.bin/grep/grep.h
head/usr.bin/grep/util.c
Modified: head/ObsoleteFiles.inc
==============================================================================
--- head/ObsoleteFiles.inc Wed Jun 6 22:34:20 2018 (r334743)
+++ head/ObsoleteFiles.inc Wed Jun 6 23:12:35 2018 (r334744)
@@ -38,6 +38,17 @@
# xargs -n1 | sort | uniq -d;
# done
+# 20180607: remove nls support from grep
+OLD_FILES+=usr/share/nls/pt_BR.ISO8859-1/grep.cat
+OLD_FILES+=usr/share/nls/hu_HU.ISO8859-2/grep.cat
+OLD_FILES+=usr/share/nls/ja_JP.SJIS/grep.cat
+OLD_FILES+=usr/share/nls/ja_JP.eucJP/grep.cat
+OLD_FILES+=usr/share/nls/gl_ES.ISO8859-1/grep.cat
+OLD_FILES+=usr/share/nls/zh_CN.UTF-8/grep.cat
+OLD_FILES+=usr/share/nls/es_ES.ISO8859-1/grep.cat
+OLD_FILES+=usr/share/nls/ru_RU.KOI8-R/grep.cat
+OLD_FILES+=usr/share/nls/uk_UA.UTF-8/grep.cat
+OLD_FILES+=usr/share/nls/ja_JP.UTF-8/grep.cat
# 20180517: retire vxge
OLD_FILES+=usr/share/man/man4/if_vxge.4.gz
OLD_FILES+=usr/share/man/man4/vxge.4.gz
Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==============================================================================
--- head/tools/build/mk/OptionalObsoleteFiles.inc Wed Jun 6 22:34:20 2018 (r334743)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc Wed Jun 6 23:12:35 2018 (r334744)
@@ -6277,7 +6277,6 @@ OLD_FILES+=usr/share/nls/el_GR.ISO8859-7/tcsh.cat
OLD_FILES+=usr/share/nls/el_GR.UTF-8/tcsh.cat
OLD_FILES+=usr/share/nls/en_US.ISO8859-1/ee.cat
OLD_FILES+=usr/share/nls/en_US.ISO8859-15/ee.cat
-OLD_FILES+=usr/share/nls/es_ES.ISO8859-1/grep.cat
OLD_FILES+=usr/share/nls/es_ES.ISO8859-1/libc.cat
OLD_FILES+=usr/share/nls/es_ES.ISO8859-1/tcsh.cat
OLD_FILES+=usr/share/nls/es_ES.ISO8859-15/tcsh.cat
@@ -6309,10 +6308,8 @@ OLD_FILES+=usr/share/nls/fr_FR.ISO8859-1/tcsh.cat
OLD_FILES+=usr/share/nls/fr_FR.ISO8859-15/ee.cat
OLD_FILES+=usr/share/nls/fr_FR.ISO8859-15/tcsh.cat
OLD_FILES+=usr/share/nls/fr_FR.UTF-8/tcsh.cat
-OLD_FILES+=usr/share/nls/gl_ES.ISO8859-1/grep.cat
OLD_FILES+=usr/share/nls/gl_ES.ISO8859-1/libc.cat
OLD_FILES+=usr/share/nls/hu_HU.ISO8859-2/ee.cat
-OLD_FILES+=usr/share/nls/hu_HU.ISO8859-2/grep.cat
OLD_FILES+=usr/share/nls/hu_HU.ISO8859-2/libc.cat
OLD_FILES+=usr/share/nls/hu_HU.ISO8859-2/sort.cat
OLD_FILES+=usr/share/nls/it_CH.ISO8859-1/tcsh.cat
@@ -6322,12 +6319,9 @@ OLD_FILES+=usr/share/nls/it_IT.ISO8859-1/tcsh.cat
OLD_FILES+=usr/share/nls/it_IT.ISO8859-15/libc.cat
OLD_FILES+=usr/share/nls/it_IT.ISO8859-15/tcsh.cat
OLD_FILES+=usr/share/nls/it_IT.UTF-8/tcsh.cat
-OLD_FILES+=usr/share/nls/ja_JP.SJIS/grep.cat
OLD_FILES+=usr/share/nls/ja_JP.SJIS/tcsh.cat
-OLD_FILES+=usr/share/nls/ja_JP.UTF-8/grep.cat
OLD_FILES+=usr/share/nls/ja_JP.UTF-8/libc.cat
OLD_FILES+=usr/share/nls/ja_JP.UTF-8/tcsh.cat
-OLD_FILES+=usr/share/nls/ja_JP.eucJP/grep.cat
OLD_FILES+=usr/share/nls/ja_JP.eucJP/libc.cat
OLD_FILES+=usr/share/nls/ja_JP.eucJP/tcsh.cat
OLD_FILES+=usr/share/nls/ko_KR.UTF-8/libc.cat
@@ -6338,14 +6332,12 @@ OLD_FILES+=usr/share/nls/no_NO.ISO8859-1/libc.cat
OLD_FILES+=usr/share/nls/pl_PL.ISO8859-2/ee.cat
OLD_FILES+=usr/share/nls/pl_PL.ISO8859-2/libc.cat
OLD_FILES+=usr/share/nls/pt_BR.ISO8859-1/ee.cat
-OLD_FILES+=usr/share/nls/pt_BR.ISO8859-1/grep.cat
OLD_FILES+=usr/share/nls/pt_BR.ISO8859-1/libc.cat
OLD_FILES+=usr/share/nls/pt_PT.ISO8859-1/ee.cat
OLD_FILES+=usr/share/nls/ru_RU.CP1251/tcsh.cat
OLD_FILES+=usr/share/nls/ru_RU.CP866/tcsh.cat
OLD_FILES+=usr/share/nls/ru_RU.ISO8859-5/tcsh.cat
OLD_FILES+=usr/share/nls/ru_RU.KOI8-R/ee.cat
-OLD_FILES+=usr/share/nls/ru_RU.KOI8-R/grep.cat
OLD_FILES+=usr/share/nls/ru_RU.KOI8-R/libc.cat
OLD_FILES+=usr/share/nls/ru_RU.KOI8-R/tcsh.cat
OLD_FILES+=usr/share/nls/ru_RU.UTF-8/tcsh.cat
@@ -6354,12 +6346,10 @@ OLD_FILES+=usr/share/nls/sv_SE.ISO8859-1/libc.cat
OLD_FILES+=usr/share/nls/uk_UA.ISO8859-5/tcsh.cat
OLD_FILES+=usr/share/nls/uk_UA.KOI8-U/ee.cat
OLD_FILES+=usr/share/nls/uk_UA.KOI8-U/tcsh.cat
-OLD_FILES+=usr/share/nls/uk_UA.UTF-8/grep.cat
OLD_FILES+=usr/share/nls/uk_UA.UTF-8/libc.cat
OLD_FILES+=usr/share/nls/uk_UA.UTF-8/tcsh.cat
OLD_FILES+=usr/share/nls/zh_CN.GB18030/libc.cat
OLD_FILES+=usr/share/nls/zh_CN.GB2312/libc.cat
-OLD_FILES+=usr/share/nls/zh_CN.UTF-8/grep.cat
OLD_FILES+=usr/share/nls/zh_CN.UTF-8/libc.cat
OLD_FILES+=usr/tests/bin/sh/builtins/locale1.0
.endif
Modified: head/usr.bin/grep/Makefile
==============================================================================
--- head/usr.bin/grep/Makefile Wed Jun 6 22:34:20 2018 (r334743)
+++ head/usr.bin/grep/Makefile Wed Jun 6 23:12:35 2018 (r334744)
@@ -65,12 +65,6 @@ CFLAGS+= -I${SYSROOT:U${DESTDIR}}/usr/include/gnu -DWI
LIBADD+= gnuregex
.endif
-.if ${MK_NLS} != "no"
-.include "${.CURDIR}/nls/Makefile.inc"
-.else
-CFLAGS+= -DWITHOUT_NLS
-.endif
-
HAS_TESTS=
SUBDIR.${MK_TESTS}+= tests
Modified: head/usr.bin/grep/grep.c
==============================================================================
--- head/usr.bin/grep/grep.c Wed Jun 6 22:34:20 2018 (r334743)
+++ head/usr.bin/grep/grep.c Wed Jun 6 23:12:35 2018 (r334744)
@@ -53,15 +53,6 @@ __FBSDID("$FreeBSD$");
#include "grep.h"
-#ifndef WITHOUT_NLS
-#include <nl_types.h>
-nl_catd catalog;
-#endif
-
-/*
- * Default messags to use when NLS is disabled or no catalogue
- * is found.
- */
const char *errstr[] = {
"",
/* 1*/ "(standard input)",
@@ -162,10 +153,10 @@ bool file_err; /* file reading error */
static void
usage(void)
{
- fprintf(stderr, getstr(3), getprogname());
- fprintf(stderr, "%s", getstr(4));
- fprintf(stderr, "%s", getstr(5));
- fprintf(stderr, "%s", getstr(6));
+ fprintf(stderr, errstr[3], getprogname());
+ fprintf(stderr, "%s", errstr[4]);
+ fprintf(stderr, "%s", errstr[5]);
+ fprintf(stderr, "%s", errstr[6]);
exit(2);
}
@@ -351,10 +342,6 @@ main(int argc, char *argv[])
setlocale(LC_ALL, "");
-#ifndef WITHOUT_NLS
- catalog = catopen("grep", NL_CAT_LOCALE);
-#endif
-
/* Check what is the program name of the binary. In this
way we can have all the funcionalities in one binary
without the need of scripting and using ugly hacks. */
@@ -470,7 +457,7 @@ main(int argc, char *argv[])
else if (strcasecmp(optarg, "read") == 0)
devbehave = DEV_READ;
else
- errx(2, getstr(2), "--devices");
+ errx(2, errstr[2], "--devices");
break;
case 'd':
if (strcasecmp("recurse", optarg) == 0) {
@@ -481,7 +468,7 @@ main(int argc, char *argv[])
else if (strcasecmp("read", optarg) == 0)
dirbehave = DIR_READ;
else
- errx(2, getstr(2), "--directories");
+ errx(2, errstr[2], "--directories");
break;
case 'E':
grepbehave = GREP_EXTENDED;
@@ -577,9 +564,9 @@ main(int argc, char *argv[])
break;
case 'V':
#ifdef WITH_GNU
- printf(getstr(9), getprogname(), VERSION);
+ printf(errstr[9], getprogname(), VERSION);
#else
- printf(getstr(8), getprogname(), VERSION);
+ printf(errstr[8], getprogname(), VERSION);
#endif
exit(0);
case 'v':
@@ -604,7 +591,7 @@ main(int argc, char *argv[])
else if (strcasecmp("text", optarg) == 0)
binbehave = BINFILE_TEXT;
else
- errx(2, getstr(2), "--binary-files");
+ errx(2, errstr[2], "--binary-files");
break;
case COLOR_OPT:
color = NULL;
@@ -624,7 +611,7 @@ main(int argc, char *argv[])
} else if (strcasecmp("never", optarg) != 0 &&
strcasecmp("none", optarg) != 0 &&
strcasecmp("no", optarg) != 0)
- errx(2, getstr(2), "--color");
+ errx(2, errstr[2], "--color");
cflags &= ~REG_NOSUB;
break;
case LABEL_OPT:
@@ -745,10 +732,6 @@ main(int argc, char *argv[])
continue;
c+= procfile(*aargv);
}
-
-#ifndef WITHOUT_NLS
- catclose(catalog);
-#endif
/* Find out the correct return value according to the
results and the command line option. */
Modified: head/usr.bin/grep/grep.h
==============================================================================
--- head/usr.bin/grep/grep.h Wed Jun 6 22:34:20 2018 (r334743)
+++ head/usr.bin/grep/grep.h Wed Jun 6 23:12:35 2018 (r334744)
@@ -38,15 +38,6 @@
#include <stdio.h>
#include <zlib.h>
-#ifdef WITHOUT_NLS
-#define getstr(n) errstr[n]
-#else
-#include <nl_types.h>
-
-extern nl_catd catalog;
-#define getstr(n) catgets(catalog, 1, n, errstr[n])
-#endif
-
extern const char *errstr[];
#define VERSION "2.6.0-FreeBSD"
Modified: head/usr.bin/grep/util.c
==============================================================================
--- head/usr.bin/grep/util.c Wed Jun 6 22:34:20 2018 (r334743)
+++ head/usr.bin/grep/util.c Wed Jun 6 23:12:35 2018 (r334744)
@@ -299,7 +299,7 @@ procfile(const char *fn)
int c, t;
if (strcmp(fn, "-") == 0) {
- fn = label != NULL ? label : getstr(1);
+ fn = label != NULL ? label : errstr[1];
f = grep_open(NULL);
} else {
if (stat(fn, &sb) == 0) {
@@ -386,7 +386,7 @@ procfile(const char *fn)
printf("%s%c", fn, nullflag ? 0 : '\n');
if (c && !cflag && !lflag && !Lflag &&
binbehave == BINFILE_BIN && f->binary && !qflag)
- printf(getstr(7), fn);
+ printf(errstr[7], fn);
free(pc.ln.file);
free(f);
More information about the svn-src-all
mailing list