Makefile | 3 +++ src/nnn.c | 8 ++++++++ diff --git a/Makefile b/Makefile index b55e15f3fe7a10ea0940313cd07bc8fed97a042e..a8675733f36ed81f2ebd4ee964fd0b5a096a0bad 100644 --- a/Makefile +++ b/Makefile @@ -42,6 +42,9 @@ norl: $(SRC) $(CC) -DNORL $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $(BIN) $^ $(LDLIBS) +nolocale: $(SRC) + $(CC) -DNORL -DNOLOCALE $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $(BIN) $^ $(LDLIBS) + install: all $(INSTALL) -m 0755 -d $(DESTDIR)$(PREFIX)/bin $(INSTALL) -m 0755 $(BIN) $(DESTDIR)$(PREFIX)/bin diff --git a/src/nnn.c b/src/nnn.c index fbc05a15c626a0bff59f5291dd55d790f9d5f019..e3e2e76c3db250bda843df697a8ccf7da206c4dd 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -74,7 +74,9 @@ #include #ifdef __gnu_hurd__ #define PATH_MAX 4096 #endif +#ifndef NOLOCALE #include +#endif #include #ifndef NORL #include @@ -1349,7 +1351,11 @@ return -1; } /* Handle 1. all non-numeric and 2. both same numeric value cases */ +#ifndef NOLOCALE return strcoll(s1, s2); +#else + return strcasecmp(s1, s2); +#endif } /* @@ -4960,8 +4966,10 @@ xerror(); return _FAILURE; } +#ifndef NOLOCALE /* Set locale */ setlocale(LC_ALL, ""); +#endif #ifndef NORL #if RL_READLINE_VERSION >= 0x0603