[PATCH 4/4] agetty: use nl_langinfo()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Karel Zak <kzak@xxxxxxxxxx>
---
 login-utils/Makefile.am |    4 ++++
 login-utils/agetty.c    |   12 +++---------
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/login-utils/Makefile.am b/login-utils/Makefile.am
index 9ebd0b7..c5e3d52 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 9d463ce..f048c3e 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;
 		    }
 
-- 
1.7.3.1

--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux