/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1998
* Sleepycat Software. All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "config.h"
#ifndef lint
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
#include <errno.h>
#include <stdlib.h>
#endif
#include "db_int.h"
#include "common_ext.h"
#ifdef macintosh
#include <TFileSpec.h>
#endif
/*
* __os_tmpdir --
* Set the temporary directory path.
*
* The order of items in the list structure and the order of checks in
* the environment are documented.
*
* PUBLIC: int __os_tmpdir __P((DB_ENV *, u_int32_t));
*/
int
{
/*
* !!!
* Don't change this to:
*
* static const char * const list[]
*
* because it creates a text relocation in position independent code.
*/
static const char * list[] = {
"/temp", /* Windows. */
"/tmp",
"C:/temp", /* Windows. */
"C:/tmp", /* Windows. */
};
const char * const *lp, *p;
/* Use the environment if it's permitted and initialized. */
p = NULL;
#ifdef HAVE_GETEUID
if (LF_ISSET(DB_USE_ENVIRON) ||
#else
if (LF_ISSET(DB_USE_ENVIRON))
#endif
{
return (EINVAL);
}
/* Windows */
return (EINVAL);
}
/* Windows */
return (EINVAL);
}
/* Macintosh */
if (p == NULL &&
"illegal TempFolder environment variable");
return (EINVAL);
}
}
#ifdef macintosh
/* Get the path to the temporary folder. */
if (p == NULL) {
kOnSystemDisk, 0, &spec))
}
#endif
/* Step through the list looking for a possibility. */
if (p == NULL)
break;
if (p == NULL)
return (0);
}