]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
xgetcwd: Port to native Windows.
authorBruno Haible <bruno@clisp.org>
Wed, 21 Aug 2024 07:18:22 +0000 (09:18 +0200)
committerBruno Haible <bruno@clisp.org>
Wed, 21 Aug 2024 07:18:22 +0000 (09:18 +0200)
Use a variant of the gnulib module 'xgetcwd' instead of our own (older) one.

* gnulib-local/lib/xgetcwd.h: Remove file.
* gnulib-local/lib/xgetcwd.c: Remove file.
* gnulib-local/modules/xgetcwd: Remove file.
* gnulib-local/modules/xgetcwd.diff: New file.
* gnulib-local/Makefile.am (EXTRA_DIST): Update.

gnulib-local/Makefile.am
gnulib-local/lib/xgetcwd.c [deleted file]
gnulib-local/lib/xgetcwd.h [deleted file]
gnulib-local/modules/xgetcwd [deleted file]
gnulib-local/modules/xgetcwd.diff [new file with mode: 0644]

index 3ed2f77bf2c795c4e2b200350f88a3ccba586a97..89cfc7787e44a80f71a38f7f6e6b6ffb6163ea62 100644 (file)
@@ -1,5 +1,5 @@
 ## Makefile for the gnulib-local directory of GNU gettext
-## Copyright (C) 2006-2008, 2010-2012, 2014-2023 Free Software Foundation, Inc.
+## Copyright (C) 2006-2024 Free Software Foundation, Inc.
 ##
 ## This program is free software: you can redistribute it and/or modify
 ## it under the terms of the GNU General Public License as published by
@@ -146,8 +146,6 @@ lib/regex_internal.h.diff \
 lib/unistd.in.h.diff \
 lib/xerror.c \
 lib/xerror.h \
-lib/xgetcwd.c \
-lib/xgetcwd.h \
 m4/backupfile.m4 \
 m4/java.m4 \
 m4/libxml.m4 \
@@ -163,7 +161,7 @@ modules/libxml \
 modules/markup \
 modules/mem-hash-map \
 modules/xerror \
-modules/xgetcwd
+modules/xgetcwd.diff
 
 # Extra files to be installed.
 
diff --git a/gnulib-local/lib/xgetcwd.c b/gnulib-local/lib/xgetcwd.c
deleted file mode 100644 (file)
index ff37e7b..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/* xgetcwd.c -- return current directory with unlimited length
-   Copyright (C) 1992, 1996, 2000, 2003, 2005-2006, 2011, 2020 Free
-   Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
-
-/* Written by David MacKenzie <djm@gnu.ai.mit.edu>.  */
-
-#include <config.h>
-
-/* Specification.  */
-#include "xgetcwd.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include "pathmax.h"
-
-/* In this file, PATH_MAX is the size of an initial memory allocation.  */
-#ifndef PATH_MAX
-# define PATH_MAX 8192
-#endif
-
-#if HAVE_GETCWD
-# ifdef VMS
-   /* We want the directory in Unix syntax, not in VMS syntax.  */
-#  define getcwd(Buf, Max) (getcwd) (Buf, Max, 0)
-# else
-char *getcwd ();
-# endif
-#else
-char *getwd ();
-# define getcwd(Buf, Max) getwd (Buf)
-#endif
-
-#include "xalloc.h"
-
-/* Return the current directory, newly allocated, arbitrarily long.
-   Return NULL and set errno on error. */
-
-char *
-xgetcwd (void)
-{
-  char *ret;
-  unsigned path_max;
-  char buf[1024];
-
-  errno = 0;
-  ret = getcwd (buf, sizeof (buf));
-  if (ret != NULL)
-    return xstrdup (buf);
-  if (errno != ERANGE)
-    return NULL;
-
-  path_max = (unsigned) PATH_MAX;
-  path_max += 2;                /* The getcwd docs say to do this. */
-
-  for (;;)
-    {
-      char *cwd = XNMALLOC (path_max, char);
-
-      errno = 0;
-      ret = getcwd (cwd, path_max);
-      if (ret != NULL)
-        return ret;
-      if (errno != ERANGE)
-        {
-          int save_errno = errno;
-          free (cwd);
-          errno = save_errno;
-          return NULL;
-        }
-
-      free (cwd);
-
-      path_max += path_max / 16;
-      path_max += 32;
-    }
-}
diff --git a/gnulib-local/lib/xgetcwd.h b/gnulib-local/lib/xgetcwd.h
deleted file mode 100644 (file)
index ec6b999..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/* xgetcwd -- return current directory with unlimited length
-   Copyright (C) 1995, 2001-2002 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
-
-/* Wrapper function with error checking for standard function.  */
-extern char *xgetcwd (void);
diff --git a/gnulib-local/modules/xgetcwd b/gnulib-local/modules/xgetcwd
deleted file mode 100644 (file)
index 583480e..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-Description:
-
-Files:
-lib/xgetcwd.h
-lib/xgetcwd.c
-
-Depends-on:
-xalloc
-unistd
-
-configure.ac:
-
-Makefile.am:
-lib_SOURCES += xgetcwd.h xgetcwd.c
-
-Include:
-"xgetcwd.h"
-
-License:
-GPL
-
-Maintainer:
-Bruno Haible
-
diff --git a/gnulib-local/modules/xgetcwd.diff b/gnulib-local/modules/xgetcwd.diff
new file mode 100644 (file)
index 0000000..6b69a67
--- /dev/null
@@ -0,0 +1,11 @@
+--- modules/xgetcwd    2024-07-15 14:00:18.948308439 +0200
++++ modules/xgetcwd    2024-08-21 04:04:32.517733443 +0200
+@@ -7,7 +7,7 @@
+ m4/xgetcwd.m4
+ Depends-on:
+-getcwd
++getcwd-lgpl
+ xalloc
+ configure.ac: