Commit 4bafa4e1 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz


* src/misc/ Check these environment variables.
* src/bin/man/ltlcross.x, NEWS: Document them.
parent 1bb5cbd9
......@@ -6,6 +6,10 @@ New in spot 1.1.4a (not relased)
* ltlcross has a new option --color to color its output. It is enabled
by default when the output is a terminal.
* Environment variables SPOT_TMPDIR and SPOT_TMPKEEP control where
temporary files are created and if they should be erased. Read
the man page of ltlcross for detail.
* Cleanup of exported symbols
All symbols in the library now have hidden visibility on ELF systems.
......@@ -35,6 +35,23 @@ potential problems, avoid the \fB\-\-csv\fR and \fB\-\-json\fR
options: ltlcross is faster when it does not have to compute these
These variables control in which directory temporary files (e.g.,
those who contain the input and output when interfacing with
translators) are created. \fBTMPDIR\fR is only read if
\fBSPOT_TMPDIR\fR does not exist. If none of these environment
variables exist, or if their value is empty, files are created in the
current directory.
When this variable is defined, temporary files are not removed.
This is mostly useful for debugging.
.BR randltl (1),
.BR genltl (1),
......@@ -30,20 +30,40 @@ namespace spot
std::list<temporary_file*> to_clean;
int create_temporary_file(const char* prefix,
const char* suffix,
char** name)
static const char*
const char* res = secure_getenv("SPOT_TMPDIR");
if (res)
return res;
return secure_getenv("TMPDIR");
static int
create_temporary_file(const char* prefix,
const char* suffix,
char** name)
throw(std::bad_alloc, std::runtime_error)
static const char* tmpdir = get_tmpdir();
static int tmpdirlen = tmpdir ? strlen(tmpdir) : 0;
size_t len = strlen(prefix);
size_t slen = 0;
if (suffix)
len += slen = strlen(suffix);
*name = static_cast<char*>(malloc(len + 6 + 1));
*name = static_cast<char*>(malloc(tmpdirlen + 1 + len + 6 + 1));
if (!name)
throw std::bad_alloc();
char* x = stpcpy(stpcpy(*name, prefix), "XXXXXX");
char* x = *name;
if (tmpdir)
x = stpcpy(x, tmpdir);
if (x[-1] != '/')
*x++ = '/';
x = stpcpy(x, prefix);
x = stpcpy(x, "XXXXXX");
int fd;
if (suffix)
......@@ -68,7 +88,9 @@ namespace spot
static bool must_unlink = !secure_getenv("SPOT_TMPKEEP");
if (must_unlink)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment