Hi, i initially thought touch(1) might be tricky because it is concerned with times, but it turned out is does almost all of the parsing by hand, supporting only specific numeric formats and nothing like month names.
It does use strptime(3), but only for %F and %T neither of which is locale-dependent. Careful line-by-line review of the code turned up nothing that might use the locale, not even LC_TIME. OK for Jan Stary's patch? Ingo Index: touch.c =================================================================== RCS file: /cvs/src/usr.bin/touch/touch.c,v retrieving revision 1.25 diff -u -p -r1.25 touch.c --- touch.c 9 Oct 2015 01:37:09 -0000 1.25 +++ touch.c 28 Oct 2016 09:28:29 -0000 @@ -41,7 +41,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <locale.h> #include <time.h> #include <unistd.h> @@ -49,7 +48,7 @@ void stime_arg1(char *, struct timespec void stime_arg2(char *, int, struct timespec *); void stime_argd(char *, struct timespec *); void stime_file(char *, struct timespec *); -__dead void usage(void); +static void __dead usage(void); int main(int argc, char *argv[]) @@ -58,8 +57,6 @@ main(int argc, char *argv[]) int aflag, cflag, mflag, ch, fd, len, rval, timeset; char *p; - (void)setlocale(LC_ALL, ""); - if (pledge("stdio rpath wpath cpath fattr", NULL) == -1) err(1, "pledge"); @@ -145,7 +142,7 @@ main(int argc, char *argv[]) warn("%s", *argv); } } - exit(rval); + return rval; } #define ATOI2(s) ((s) += 2, ((s)[-2] - '0') * 10 + ((s)[-1] - '0')) @@ -324,7 +321,7 @@ terr: errx(1, tsp[1] = tsp[0]; } -__dead void +static void __dead usage(void) { (void)fprintf(stderr,