diff options
author | rsb <none@none> | 2006-05-11 09:17:51 -0700 |
---|---|---|
committer | rsb <none@none> | 2006-05-11 09:17:51 -0700 |
commit | 13c7b6ac430bc41eee84ba0b625cf5fde3241b10 (patch) | |
tree | afb2f97940499d2e8eddaa080086ebd676e114d8 /usr/src | |
parent | c311de31b53b476c8f42e0788052a0ac5807d93d (diff) | |
download | illumos-joyent-13c7b6ac430bc41eee84ba0b625cf5fde3241b10.tar.gz |
6391960 fsstat: incomplete i18n
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/cmd/Makefile | 1 | ||||
-rw-r--r-- | usr/src/cmd/stat/fsstat/fsstat.c | 23 |
2 files changed, 20 insertions, 4 deletions
diff --git a/usr/src/cmd/Makefile b/usr/src/cmd/Makefile index 6c39c9b938..0e4a192222 100644 --- a/usr/src/cmd/Makefile +++ b/usr/src/cmd/Makefile @@ -623,6 +623,7 @@ MSGSUBDIRS= \ sort \ split \ ssh \ + stat \ strings \ su \ sum \ diff --git a/usr/src/cmd/stat/fsstat/fsstat.c b/usr/src/cmd/stat/fsstat/fsstat.c index b8896d2675..b4dee43ebc 100644 --- a/usr/src/cmd/stat/fsstat/fsstat.c +++ b/usr/src/cmd/stat/fsstat/fsstat.c @@ -34,6 +34,7 @@ #include <limits.h> #include <sys/types.h> #include <time.h> +#include <langinfo.h> #include <sys/time.h> #include <sys/uio.h> #include <sys/vnode.h> @@ -46,6 +47,7 @@ #include <poll.h> #include <ctype.h> #include <libintl.h> +#include <locale.h> /* * For now, parsable output is turned off. Once we gather feedback and @@ -826,16 +828,23 @@ void print_time(int type) { time_t t; + static char *fmt = NULL; /* Time format */ + + /* We only need to retrieve this once per invocation */ + if (fmt == NULL) { + fmt = nl_langinfo(_DATE_FMT); + } if (time(&t) != -1) { if (type == UDATE) { (void) printf("%ld\n", t); } else if (type == DDATE) { - char *dstr; + char dstr[64]; + int len; - dstr = ctime(&t); - if (dstr) { - (void) printf("%s", dstr); + len = strftime(dstr, sizeof (dstr), fmt, localtime(&t)); + if (len > 0) { + (void) printf("%s\n", dstr); } } } @@ -883,6 +892,12 @@ main(int argc, char *argv[]) extern int optind; + (void) setlocale(LC_ALL, ""); +#if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */ +#define TEXT_DOMAIN "SYS_TEST" /* Use this only if it weren't */ +#endif + (void) textdomain(TEXT_DOMAIN); + cmdname = argv[0]; while ((c = getopt(argc, argv, OPTIONS)) != EOF) { switch (c) { |