[PATCH] cal: fix langinfo build break

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

 



From: Davidlohr Bueso <dave@xxxxxxx>
cal: fix langinfo build break

When HAVE_LANGINFO_H is not defined we break the compilation in cal.c

  CC     cal.o
cal.c: In function âheaders_initâ:
cal.c:432: error: â_time_infoâ undeclared (first use in this function)
cal.c:432: error: (Each undeclared identifier is reported only once
cal.c:432: error: for each function it appears in.)
make: *** [cal.o] Error 1

The '_time_info' structure is no where to be found other than in headers_init():

dave@cowboy:~/projects/util-linux-ng$ git grep _time_info
misc-utils/cal.c:# define weekday(wd)   _time_info->abbrev_wkday[wd]
misc-utils/cal.c:     full_month[i] = _time_info->full_month[i];

So replace it with weekday and month fixed arrays.

Signed-off-by: Davidlohr Bueso <dave@xxxxxxx>
---
 misc-utils/cal.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/misc-utils/cal.c b/misc-utils/cal.c
index 4d46c1b..e69f188 100644
--- a/misc-utils/cal.c
+++ b/misc-utils/cal.c
@@ -412,7 +412,14 @@ void headers_init(void)
 #ifdef HAVE_LANGINFO_H
 # define weekday(wd)	nl_langinfo(ABDAY_1+wd)
 #else
-# define weekday(wd)	_time_info->abbrev_wkday[wd]
+  char *weekday[] = { "Sun", "Mon", "Tue", "Wed", "Thu",
+		      "Fri", "Sat" };
+  
+  char *month[] = { "January", "Febuary", "March", "April", "May",
+		    "June", "July", "August", "September", "October",
+		     "November", "December" };
+# define weekday(wd)	weekday[wd]
+
 #endif
 
   for(i = 0 ; i < 7 ; i++ ) {
@@ -440,7 +447,7 @@ void headers_init(void)
 #ifdef HAVE_LANGINFO_H
      full_month[i] = nl_langinfo(MON_1+i);
 #else
-     full_month[i] = _time_info->full_month[i];
+     full_month[i] = month[i];
 #endif
   }
 }
-- 
1.7.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