curl-library
Re: create-dirs on win32
Date: Tue, 7 Jan 2003 10:41:46 +0100 (MET)
On Mon, 6 Jan 2003, matthew b wrote:
> Here's a diff for a real quick modification to create-dirs so it works on
> win32. It also fixes a general 'uninitialized memory' bug. I didn't check
> to see if the malloc succeeds, it looks like that's only done
> inconsistently. I also didn't make any attempt at picking which error
> happened to display to the user. I haven't tested the error condition at
> all, just the simple test below.
So mkdir() is not available in Windows?
Could you then please rewrite your patch to instead make a function that
looks and works like the unix version? Like this:
(and add #define HAVE_MKDIR in the src/config-win32.h first)
#ifndef HAVE_MKDIR
#ifdef WIN32
int mkdir(const char *pathname, mode_t mode)
{
int result;
(void)mode; /* unused */
result = CreateDirectory(pathname, NULL);
/* mkdir returns 0 for success, opposite of CreateDirectory() */
return result?0:-1;
}
#else
/* system without mkdir and we have no implementation */
int mkdir(const char *pathname, mode_t mode)
{
(void)mode; /* unused */
(void)pathname; /* unused */
return -1;
#endif
#endif
It'll make the code in the function create_dir_hierarchy() look a lot nicer!
-- Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs. ------------------------------------------------------- This SF.NET email is sponsored by: SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! http://www.vasoftware.comReceived on 2003-01-07