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

Re: Xchat ?



Physicman wrote:

The current patch uses _GNU_SOURCE which isn't apparently such a good
idea. So, Alfred suggested to use autoconf to find out if
get_current_dir_name() is available and use that in the #ifdef instead
of _GNU_SOURCE.

Best regards,

Chris

Chris,

How about this: ??

diff -urp xchat-2.4.1.org/configure.in xchat-2.4.1/configure.in
--- xchat-2.4.1.org/configure.in    2005-02-18 15:47:17.000000000 -0500
+++ xchat-2.4.1/configure.in    2005-02-18 15:44:16.000000000 -0500
@@ -590,6 +590,9 @@ AC_CHECK_FUNCS(snprintf)
AC_CHECK_FUNCS(vsnprintf)
AC_CHECK_FUNCS(memrchr)

+dnl Check for get_current_dir_name for GNU System
+AC_CHECK_FUNCS(get_current_dir_name)
+
AC_CHECK_FUNC(gethostbyname, ,
    AC_CHECK_LIB(resolv, gethostbyname, ,
        AC_CHECK_LIB(nsl, gethostbyname)))
diff -urp xchat-2.4.1.org/plugins/python/python.c xchat-2.4.1/plugins/python/python.c --- xchat-2.4.1.org/plugins/python/python.c 2005-02-18 15:47:43.000000000 -0500 +++ xchat-2.4.1/plugins/python/python.c 2005-02-18 15:45:52.000000000 -0500
@@ -58,6 +58,7 @@
#include <sys/types.h>
#include <dirent.h>

+#include "config.h"
#include "xchat-plugin.h"
#include "Python.h"
#include "structmember.h"
@@ -327,12 +328,18 @@ Util_BuildList(char *word[])
static void
Util_Autoload()
{
-    char oldcwd[PATH_MAX];
+    #ifdef HAVE_GET_CURRENT_DIR_NAME
+      char *oldcwd = get_current_dir_name ();
+    #else
+      char oldcwd[PATH_MAX];
+    #endif
    const char *dir_name;
    struct dirent *ent;
    DIR *dir;
-    if (getcwd(oldcwd, PATH_MAX) == NULL)
+    #ifndef HAVE_GET_CURRENT_DIR_NAME
+      if (getcwd(oldcwd, PATH_MAX) == NULL)
        return;
+    #endif
    /* we need local filesystem encoding for chdir, opendir etc */
    dir_name = xchat_get_info(ph, "xchatdirfs");
    /* fallback for pre-2.0.9 xchat */
@@ -350,6 +357,9 @@ Util_Autoload()
    }
    closedir(dir);
    chdir(oldcwd);
+    #ifdef HAVE_GET_CURRENT_DIR_NAME
+      free(oldcwd);
+    #endif
}

static char *




--
Barry deFreese
Debian 3.0r1 "Woody"
GNU/Hurd
Registered Linux "Newbie" #302256 - Hurd H4XX0r wannabe

"Programming today is a race between software engineers striving
to build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots. So far, the Universe is
winning." Rich Cook.





Reply to: