diff options
| -rw-r--r-- | usr.bin/locale/Makefile | 1 | ||||
| -rw-r--r-- | usr.bin/locale/locale.c | 12 |
2 files changed, 6 insertions, 7 deletions
diff --git a/usr.bin/locale/Makefile b/usr.bin/locale/Makefile index 539fc1fd7d8c..d7f67e1aca81 100644 --- a/usr.bin/locale/Makefile +++ b/usr.bin/locale/Makefile @@ -1,6 +1,7 @@ # $FreeBSD$ PROG = locale +CFLAGS += -I${.CURDIR}/../../lib/libc/locale WARNS ?= 1 .include <bsd.prog.mk> diff --git a/usr.bin/locale/locale.c b/usr.bin/locale/locale.c index 3a53ff81381e..c7ebdebf0f6f 100644 --- a/usr.bin/locale/locale.c +++ b/usr.bin/locale/locale.c @@ -40,12 +40,12 @@ #include <err.h> #include <locale.h> #include <langinfo.h> -#include <paths.h> /* for _PATH_LOCALE */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stringlist.h> #include <unistd.h> +#include "setlocale.h" /* Local prototypes */ void init_locales_list(void); @@ -320,7 +320,6 @@ init_locales_list(void) { DIR *dirp; struct dirent *dp; - const char *dirname; /* why call this function twice ? */ if (locales != NULL) @@ -332,14 +331,13 @@ init_locales_list(void) err(1, "could not allocate memory"); /* get actual locales directory name */ - dirname = getenv("PATH_LOCALE"); - if (dirname == NULL) - dirname = _PATH_LOCALE; + if (__detect_path_locale() != 0) + err(1, "unable to find locales storage"); /* open locales directory */ - dirp = opendir(dirname); + dirp = opendir(_PathLocale); if (dirp == NULL) - err(1, "could not open directory '%s'", dirname); + err(1, "could not open directory '%s'", _PathLocale); /* scan directory and store its contents except "." and ".." */ while ((dp = readdir(dirp)) != NULL) { |
