]> err.no Git - util-linux/commitdiff
agetty: use nl_langinfo()
authorKarel Zak <kzak@redhat.com>
Mon, 15 Nov 2010 15:48:27 +0000 (16:48 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 15 Nov 2010 15:48:27 +0000 (16:48 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
login-utils/Makefile.am
login-utils/agetty.c

index 9ebd0b7cbb3f7459ba21170bb9cded48684e2a3a..c5e3d52f9038b20cd1a77966a49126dc8afea52d 100644 (file)
@@ -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
index 9d463ce40758bf36e8e93b06a1d2bbcc03269fd5..f048c3e48a2fd2efc1768820db27373615812bbf 100644 (file)
@@ -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;
                    }