diff options
author | Dan Nicholson <dbn.lists@gmail.com> | 2009-05-09 15:40:33 -0700 |
---|---|---|
committer | Dan Nicholson <dbn.lists@gmail.com> | 2009-05-09 16:37:18 -0700 |
commit | f0e53ca2e5d245d4355a7c0ee1faab383fe659e7 (patch) | |
tree | bc7e636f2ee740fabfa8bd6f5764bdcf9a20e074 /src | |
parent | 31598cf27650a3c44109e33cbe6dea6441dffbc1 (diff) |
tcc: Don't require a journal or a results directory
When the user passes an empty string for the journal argument (-j) or
the results directory argument (-i), don't create them. This allows tcc
to be run in more of a single shot mode since the logging is still done
in the tet_xres file.
The fullpath() code has been modified to use the current directory when
the argument is NULL since it is sometimes called with the results
directory name.
Diffstat (limited to 'src')
-rw-r--r-- | src/tet3/tcc/journal.c | 10 | ||||
-rw-r--r-- | src/tet3/tcc/resdir.c | 9 | ||||
-rw-r--r-- | src/tet3/tcc/tcc.c | 3 | ||||
-rw-r--r-- | src/tet3/tcc/utils.c | 10 |
4 files changed, 30 insertions, 2 deletions
diff --git a/src/tet3/tcc/journal.c b/src/tet3/tcc/journal.c index 0bddb168..92a75cab 100644 --- a/src/tet3/tcc/journal.c +++ b/src/tet3/tcc/journal.c @@ -143,6 +143,13 @@ char *jopt, *cwd; TRACE3(tet_Ttcc, 2, "jnl_init(): jopt = \"%s\", cwd = \"%s\"", jopt ? jopt : "", cwd); + /* Empty string means no journal file */ + if (jopt && !*jopt) { + jfp = NULL; + jfname = NULL; + return; + } + /* determine the name of the journal file */ if (jopt && *jopt) fullpath(cwd, jopt, fname, sizeof fname, 0); @@ -934,6 +941,9 @@ FILE *fp; int len0, len1, len2, s2max; char msg[TET_JNL_LEN]; + if (!fp) + return; + if (!s1) s1 = nullstr; if (!s2) diff --git a/src/tet3/tcc/resdir.c b/src/tet3/tcc/resdir.c index c7942b66..c744b484 100644 --- a/src/tet3/tcc/resdir.c +++ b/src/tet3/tcc/resdir.c @@ -73,6 +73,12 @@ char *iopt, *cwd; char resroot[MAXPATH], resdir[MAXPATH]; int n, rc; + /* Empty string means no results directory. */ + if (iopt && !*iopt) { + results_dir = NULL; + return; + } + /* ** determine the name of the results directory ** @@ -108,7 +114,8 @@ char *iopt, *cwd; char *resdirname() { - ASSERT(results_dir && isabspathloc(results_dir)); + if (results_dir) + ASSERT(isabspathloc(results_dir)); return(results_dir); } diff --git a/src/tet3/tcc/tcc.c b/src/tet3/tcc/tcc.c index 5b07457e..a3071c36 100644 --- a/src/tet3/tcc/tcc.c +++ b/src/tet3/tcc/tcc.c @@ -484,7 +484,8 @@ char **argv; /* open the journal file and write the start messages to it */ jnl_init(jopt, cwd); - (void) printf("%s: journal file is %s\n", tet_progname, jnl_jfname()); + if (jnl_jfname()) + printf("%s: journal file is %s\n", tet_progname, jnl_jfname()); (void) fflush(stdout); jnl_tcc_start(argcsave, argvsave); jnl_uname(); diff --git a/src/tet3/tcc/utils.c b/src/tet3/tcc/utils.c index 7555b193..b984e2d2 100644 --- a/src/tet3/tcc/utils.c +++ b/src/tet3/tcc/utils.c @@ -47,6 +47,7 @@ MODIFICATIONS: #include <time.h> #include <ctype.h> #include <string.h> +#include <errno.h> #include "dtmac.h" #include "error.h" #include "globals.h" @@ -224,6 +225,15 @@ int pathlen, remote; ASSERT(file && *file); + /* Use the current directory if none specified */ + if (!dir) { + char cwd[MAXPATH]; + + errno = 0; + if (!GETCWD(cwd, MAXPATH)) + fatal(errno, "getcwd() failed", NULL); + dir = cwd; + } if ( (remote && !isabspathrem(file)) || |