From: Bruno Haible Date: Wed, 21 Aug 2024 07:18:22 +0000 (+0200) Subject: xgetcwd: Port to native Windows. X-Git-Tag: v0.23~153 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9bc864c8a5126fbe8a4ac2c06c39e4b5f7b9b110;p=thirdparty%2Fgettext.git xgetcwd: Port to native Windows. 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. --- diff --git a/gnulib-local/Makefile.am b/gnulib-local/Makefile.am index 3ed2f77bf..89cfc7787 100644 --- a/gnulib-local/Makefile.am +++ b/gnulib-local/Makefile.am @@ -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 index ff37e7bb7..000000000 --- a/gnulib-local/lib/xgetcwd.c +++ /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 . */ - -/* Written by David MacKenzie . */ - -#include - -/* Specification. */ -#include "xgetcwd.h" - -#include -#include -#include -#include -#include - -#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 index ec6b99952..000000000 --- a/gnulib-local/lib/xgetcwd.h +++ /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 . */ - -/* 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 index 583480e70..000000000 --- a/gnulib-local/modules/xgetcwd +++ /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 index 000000000..6b69a6779 --- /dev/null +++ b/gnulib-local/modules/xgetcwd.diff @@ -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: