[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Feature Branch Windows Build Broken - lib/glob.c & WINDOWS32
From: |
Conrad T. Pino |
Subject: |
RE: Feature Branch Windows Build Broken - lib/glob.c & WINDOWS32 |
Date: |
Thu, 26 May 2005 04:00:03 -0700 |
Hi Derek,
> From: Derek Price
>
> >Compiling...
> >glob.c
> >h:\conrad\projects\cvs-1.12\lib\glob.c(535) : warning C4013: 'sysconf'
> undefined; assuming extern returning int
> >h:\conrad\projects\cvs-1.12\lib\glob.c(535) : error C2065:
> '_SC_LOGIN_NAME_MAX' : undeclared identifier
>
> I've checked in what I hope is a fix for this.
Yes, the Windows build completes. Can you explain what "home_dir" value
will be in the "WINDOWS32" undefined logic?
How about defining "WINDOWS32" and using the patch below?
> Is it too much to hope for that Windows has <dirent.h> and implements
> the readdir() family of functions and defining HAVE_DIRENT_H would be
> enough here?
Yes, that's entirely too much to hope for. The Windows build fakes an
"ndir.h" implementation in the "windows-NT" director and I committed a
patch to "lib/glob_.h" that supports the "ndir.h" flavor.
The #if logic was cut from "lib/glob.c" lines 53 through 71 with the
extras discarded. My patch is a quick hack. I would appreciate it if
you choose to make improvements.
> Cheers,
Ditto,
> Derek
Conrad
Index: lib/glob.c
===================================================================
RCS file: /cvs/ccvs/lib/glob.c,v
retrieving revision 1.15
diff -u -p -r1.15 glob.c
--- lib/glob.c 25 May 2005 20:23:38 -0000 1.15
+++ lib/glob.c 26 May 2005 10:57:36 -0000
@@ -524,8 +525,45 @@ glob (const char *pattern, int flags,
home_dir = "SYS:";
# else
# ifdef WINDOWS32
+ /* Windows doesn't set HOME, honor it if user sets it */
if (home_dir == NULL || home_dir[0] == '\0')
- home_dir = "c:/users/default"; /* poor default */
+ {
+ /* Windows sets USERPROFILE like UNIX sets HOME */
+ home_dir = getenv( "USERPROFILE" );
+ }
+ if (home_dir == NULL || home_dir[0] == '\0')
+ {
+ /* Windows sets APPDATA to "$USERPROFILE/Application Data" */
+ home_dir = getenv( "APPDATA" );
+ }
+ if (home_dir == NULL || home_dir[0] == '\0')
+ {
+ /* Windows sets ALLUSERSPROFILE to "$USERPROFILE/../All
Users" */
+ home_dir = getenv( "ALLUSERSPROFILE" );
+ }
+ if (home_dir == NULL || home_dir[0] == '\0')
+ {
+ /* Windows sets SystemRoot to installation value typically
+ C:/WinNT but frequently C:/Windows */
+ /* This may be a bad idea but it's an alternative to the root
*/
+ home_dir = getenv( "SystemRoot" );
+ }
+ if (home_dir == NULL || home_dir[0] == '\0')
+ {
+ /* "$SystemDrive/users" is Windows NT 4 specific
+
+ NEW INSTALLS of Windows 2000 and later use
+ "$SystemDrive/Documents and Settings"
+
+ UPGRADES use previous location
+
+ The default user profile can't be found with an
environment
+ variable. It's location is in the Windows
registry.
+
+ The SystemDrive environment variable is an
alternative.
+ */
+ home_dir = "c:/users/default"; /* poor default */
+ }
# else
if (home_dir == NULL || home_dir[0] == '\0')
{
- Feature Branch Windows Build Broken - lib/glob.c & WINDOWS32, Conrad T. Pino, 2005/05/25
- RE: Feature Branch Windows Build Broken - lib/glob.c & WINDOWS32, Conrad T. Pino, 2005/05/25
- Re: Feature Branch Windows Build Broken - lib/glob.c & WINDOWS32, Derek Price, 2005/05/25
- RE: Feature Branch Windows Build Broken - lib/glob.c & WINDOWS32,
Conrad T. Pino <=
- Re: Feature Branch Windows Build Broken - lib/glob.c & WINDOWS32, Derek Price, 2005/05/26
- RE: Feature Branch Windows Build Broken - lib/glob.c & WINDOWS32, Conrad T. Pino, 2005/05/28
- Re: Feature Branch Windows Build Broken - lib/glob.c & WINDOWS32, Derek Price, 2005/05/28
- RE: Feature Branch Windows Build Broken - lib/glob.c & WINDOWS32, Conrad T. Pino, 2005/05/30
- Re: Feature Branch Windows Build Broken - lib/glob.c & WINDOWS32, Derek Price, 2005/05/30
Re: Feature Branch Windows Build Broken - lib/glob.c & WINDOWS32, Derek Price, 2005/05/25