#include "support/lyxlib.h"
#include "support/convert.h"
+#include "support/debug.h"
#include "support/filetools.h"
#include "support/Package.h"
-#include "debug.h"
-
#include <boost/scoped_array.hpp>
#include <cstdlib>
# include <unistd.h>
#endif
+#if defined(HAVE_MKSTEMP) && ! defined(HAVE_DECL_MKSTEMP)
+extern "C" int mkstemp(char *);
+#endif
+
#if !defined(HAVE_MKSTEMP) && defined(HAVE_MKTEMP)
# include <fcntl.h>
# ifdef HAVE_SYS_STAT_H
# endif
#endif
-using boost::scoped_array;
+using namespace std;
-using std::string;
-using std::endl;
+using boost::scoped_array;
namespace lyx {
namespace support {
FileName const tempName(FileName const & dir, string const & mask)
{
- string const tmpdir(dir.empty() ?
- package().temp_dir().absFilename() :
- dir.absFilename());
- string tmpfl(to_filesystem8bit(from_utf8(addName(tmpdir, mask))));
+ string const tmpdir = dir.empty()
+ ? package().temp_dir().absFilename() : dir.absFilename();
+ string tmpfl = to_filesystem8bit(from_utf8(addName(tmpdir, mask)));
#if defined (HAVE_GETPID)
tmpfl += convert<string>(getpid());
#elif defined (HAVE__GETPID)
#else
# error No x() function.
#endif
- LYXERR(Debug::FILES) << "Temporary file `" << t
- << "' created." << endl;
+ LYXERR(Debug::FILES, "Temporary file `" << t << "' created.");
return FileName(t);
- } else {
- LYXERR(Debug::FILES)
- << "LyX Error: Unable to create temporary file."
- << endl;
- return FileName();
}
+ LYXERR(Debug::FILES, "LyX Error: Unable to create temporary file.");
+ return FileName();
}
} // namespace support