summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/tet3/tcc/journal.c10
-rw-r--r--src/tet3/tcc/resdir.c9
-rw-r--r--src/tet3/tcc/tcc.c3
-rw-r--r--src/tet3/tcc/utils.c10
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)) ||