From: Karel Zak Date: Mon, 15 Nov 2010 15:48:27 +0000 (+0100) Subject: agetty: use nl_langinfo() X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=efcf9a9d1e24789d83976e07c581b0be2f54340a;p=util-linux agetty: use nl_langinfo() Signed-off-by: Karel Zak --- diff --git a/login-utils/Makefile.am b/login-utils/Makefile.am index 9ebd0b7c..c5e3d52f 100644 --- a/login-utils/Makefile.am +++ b/login-utils/Makefile.am @@ -11,6 +11,10 @@ EXTRA_DIST = README.getty README.modems-with-agetty README.poeigl if BUILD_AGETTY sbin_PROGRAMS += agetty dist_man_MANS += agetty.8 +agetty_SOURCES = agetty.c +if !HAVE_LANGINFO +agetty_SOURCES += $(top_srcdir)/lib/langinfo.c +endif endif if BUILD_INIT diff --git a/login-utils/agetty.c b/login-utils/agetty.c index 9d463ce4..f048c3e4 100644 --- a/login-utils/agetty.c +++ b/login-utils/agetty.c @@ -910,12 +910,6 @@ do_prompt(op, tp) case 'd': case 't': { - /* TODO: use nl_langinfo() */ - char *weekday[] = { "Sun", "Mon", "Tue", "Wed", "Thu", - "Fri", "Sat" }; - char *month[] = { "Jan", "Feb", "Mar", "Apr", "May", - "Jun", "Jul", "Aug", "Sep", "Oct", - "Nov", "Dec" }; time_t now; struct tm *tm; @@ -924,14 +918,14 @@ do_prompt(op, tp) if (c == 'd') (void) printf ("%s %s %d %d", - weekday[tm->tm_wday], month[tm->tm_mon], - tm->tm_mday, + nl_langinfo(ABDAY_1 + tm->tm_wday), + nl_langinfo(ABMON_1 + tm->tm_mon), + tm->tm_mday, tm->tm_year < 70 ? tm->tm_year + 2000 : tm->tm_year + 1900); else (void) printf ("%02d:%02d:%02d", tm->tm_hour, tm->tm_min, tm->tm_sec); - break; }