r16049 - gnucash/trunk - Do not use langinfo to determine date format spec, but %x, %X or %c.

Andreas Köhler andi5 at cvs.gnucash.org
Sat May 5 17:02:56 EDT 2007


Author: andi5
Date: 2007-05-05 17:02:56 -0400 (Sat, 05 May 2007)
New Revision: 16049
Trac: http://svn.gnucash.org/trac/changeset/16049

Modified:
   gnucash/trunk/configure.in
   gnucash/trunk/lib/libqof/qof/gnc-date.c
   gnucash/trunk/macros/legacy_macros.m4
   gnucash/trunk/src/engine/FreqSpec.c
   gnucash/trunk/src/gnome/dialog-sx-editor.c
Log:
Do not use langinfo to determine date format spec, but %x, %X or %c.

Remove check for HAVE_LANGINFO_D_FMT.  Rather use standard strftime and
(standard?) strptime format specifiers %x (date), %X (time) and %c
(date&time, all in national representation).


Modified: gnucash/trunk/configure.in
===================================================================
--- gnucash/trunk/configure.in	2007-05-05 20:44:24 UTC (rev 16048)
+++ gnucash/trunk/configure.in	2007-05-05 21:02:56 UTC (rev 16049)
@@ -876,9 +876,6 @@
   AC_SUBST(DATADIRNAME)
 fi
 
-dnl check for nl_langinfo(D_FMT) which is missing on FreeBSD
-LANGINFO_D_FMT_CHECK
-
 dnl Enable locale-specific tax-related information in the accounts
 AC_ARG_ENABLE( locale-specific-tax,
   [  --enable-locale-specific-tax enable localized tax categories (experimental)],

Modified: gnucash/trunk/lib/libqof/qof/gnc-date.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/gnc-date.c	2007-05-05 20:44:24 UTC (rev 16048)
+++ gnucash/trunk/lib/libqof/qof/gnc-date.c	2007-05-05 21:02:56 UTC (rev 16049)
@@ -31,14 +31,6 @@
 /* to be renamed qofdate.c */
 #include <ctype.h>
 
-#ifdef HAVE_LANGINFO_H
-#define HAVE_LANGINFO_D_FMT 1
-#endif
-
-#ifdef HAVE_LANGINFO_D_FMT
-#include <langinfo.h>
-#endif
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -58,15 +50,9 @@
 
 #define NANOS_PER_SECOND 1000000000
 
-#ifdef HAVE_LANGINFO_D_FMT
-#  define GNC_D_FMT (nl_langinfo (D_FMT))
-#  define GNC_D_T_FMT (nl_langinfo (D_T_FMT))
-#  define GNC_T_FMT (nl_langinfo (T_FMT))
-#else
-#  define GNC_D_FMT "%Y-%m-%d"
-#  define GNC_D_T_FMT "%Y-%m-%d %r"
-#  define GNC_T_FMT "%r"
-#endif
+#define GNC_D_FMT "%x"
+#define GNC_D_T_FMT "%c"
+#define GNC_T_FMT "%X"
 
 
 /* This is now user configured through the gnome options system() */

Modified: gnucash/trunk/macros/legacy_macros.m4
===================================================================
--- gnucash/trunk/macros/legacy_macros.m4	2007-05-05 20:44:24 UTC (rev 16048)
+++ gnucash/trunk/macros/legacy_macros.m4	2007-05-05 21:02:56 UTC (rev 16049)
@@ -220,17 +220,3 @@
       [Define if scanf supports %I64d conversions.])
   fi
 ])
-
-AC_DEFUN([LANGINFO_D_FMT_CHECK],
-[
-  AC_CACHE_CHECK([for nl_langinfo and D_FMT], am_cv_langinfo_dfmt,
-    [AC_TRY_LINK([#include <langinfo.h>],
-      [char* cs = nl_langinfo(D_FMT);],
-      am_cv_langinfo_dfmt=yes,
-      am_cv_langinfo_dfmt=no)
-    ])
-  if test $am_cv_langinfo_dfmt = yes; then
-    AC_DEFINE(HAVE_LANGINFO_D_FMT, 1,
-      [Define if you have <langinfo.h> and nl_langinfo(D_FMT).])
-  fi
-])

Modified: gnucash/trunk/src/engine/FreqSpec.c
===================================================================
--- gnucash/trunk/src/engine/FreqSpec.c	2007-05-05 20:44:24 UTC (rev 16048)
+++ gnucash/trunk/src/engine/FreqSpec.c	2007-05-05 21:02:56 UTC (rev 16049)
@@ -81,23 +81,10 @@
 #include <string.h>
 #include <time.h>
 
-#ifdef HAVE_LANGINFO_D_FMT
-#include <langinfo.h>
-#endif
-
 #include "FreqSpecP.h"
 
 #undef G_LOG_DOMAIN
 #define G_LOG_DOMAIN "gnc.engine.freqspec"
-
-/* 
- *  FIXME: should be in a header file
- */
-#ifdef HAVE_LANGINFO_D_FMT
-#  define GNC_D_FMT (nl_langinfo (D_FMT))
-#else
-#  define GNC_D_FMT "%Y-%m-%d"
-#endif
  
 #define GDATE_STRING_SIZE 25
 #define GDATE_STRING_BUF_SIZE (GDATE_STRING_SIZE + 1)
@@ -745,8 +732,8 @@
       tmpStr = g_new0( char, GDATE_STRING_BUF_SIZE );
       /* this is now a GDate. */
       g_date_strftime( tmpStr, GDATE_STRING_SIZE,
-             GNC_D_FMT,
-             &fs->s.once.date );
+                       "%x",
+                       &fs->s.once.date );
       /* %s is the strftime-string of the one-time date. */
       snprintf( freqStrBuf, MAX_FREQ_STR_SIZE, _("Once: %s"), tmpStr );
       g_free( tmpStr );

Modified: gnucash/trunk/src/gnome/dialog-sx-editor.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-sx-editor.c	2007-05-05 20:44:24 UTC (rev 16048)
+++ gnucash/trunk/src/gnome/dialog-sx-editor.c	2007-05-05 21:02:56 UTC (rev 16049)
@@ -60,10 +60,6 @@
 #include "gnc-sx-instance-model.h"
 #include "dialog-sx-since-last-run.h"
 
-#ifdef HAVE_LANGINFO_D_FMT
-#include <langinfo.h>
-#endif
-
 #undef G_LOG_DOMAIN
 #define G_LOG_DOMAIN "gnc.gui.sx.editor"
 



More information about the gnucash-changes mailing list