summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/tet3/inc/apilib.h2
-rw-r--r--src/tet3/tcm/dtcm.c2
-rw-r--r--src/tet3/tcm/ictp.c38
3 files changed, 35 insertions, 7 deletions
diff --git a/src/tet3/inc/apilib.h b/src/tet3/inc/apilib.h
index c5c6c59e..1724dc07 100644
--- a/src/tet3/inc/apilib.h
+++ b/src/tet3/inc/apilib.h
@@ -122,7 +122,7 @@ TET_IMPORT_FUNC(void, tet_tpstart, PROTOLIST((int, int, int)));
#ifdef TET_LITE /* -LITE-CUT-LINE- */
extern char *tet_get_code PROTOLIST((int, int *));
- TET_IMPORT_FUNC(void, tet_openres, PROTOLIST((void)));
+ TET_IMPORT_FUNC(void, tet_openres, PROTOLIST((char *)));
#else /* -START-LITE-CUT- */
extern void tet_disconnect PROTOLIST((void));
TET_IMPORT_FUNC(void, tet_init_synreq, PROTOLIST((void)));
diff --git a/src/tet3/tcm/dtcm.c b/src/tet3/tcm/dtcm.c
index 0ce9380d..5ccbc7f9 100644
--- a/src/tet3/tcm/dtcm.c
+++ b/src/tet3/tcm/dtcm.c
@@ -293,7 +293,7 @@ char **argv;
#ifdef TET_LITE
/* open execution results file (do early, so tet_error() can use it) */
- tet_openres();
+ tet_openres(argv[0]);
#endif /* TET_LITE */
/* initialise the server and transport stuff */
diff --git a/src/tet3/tcm/ictp.c b/src/tet3/tcm/ictp.c
index ec9737e1..0cf0b5fe 100644
--- a/src/tet3/tcm/ictp.c
+++ b/src/tet3/tcm/ictp.c
@@ -792,13 +792,41 @@ static int ismaster()
** tet_openres() - open the tet_xres file in TETware-Lite
*/
-TET_IMPORT void tet_openres()
+TET_IMPORT void tet_openres(progname)
+char *progname;
{
char cwdbuf[MAXPATH];
static char resvar[] = "TET_RESFILE";
- static char resname[] = "tet_xres";
+ char *resname;
static char tmpvar[] = "TET_TMPRESFILE";
- static char tmpname[] = "tet_res.tmp";
+ char *tmpname;
+
+ /* set results filename from the program name */
+ if (progname) {
+ /* results file is prog.log */
+ resname = malloc(strlen(tet_basename(progname)) + 5);
+ if (!resname)
+ fatal(errno, "can't allocate resname in tet_openres()",
+ NULL);
+ sprintf(resname, "%s.log", tet_basename(progname));
+
+ /* temporary results file is prog.log.tmp */
+ tmpname = malloc(strlen(resname) + 5);
+ if (!tmpname)
+ fatal(errno, "can't allocate tmpname in tet_openres()",
+ NULL);
+ sprintf(tmpname, "%s.tmp", resname);
+ }
+ else {
+ resname = strdup("tet_xres");
+ if (!resname)
+ fatal(errno, "can't allocate resname in tet_openres()",
+ NULL);
+ tmpname = strdup("tet_res.tmp");
+ if (!tmpname)
+ fatal(errno, "can't allocate tmpname in tet_openres()",
+ NULL);
+ }
/* set full path name of execution results file and temp results
file, in a form convenient for placing in the environment */
@@ -806,13 +834,13 @@ TET_IMPORT void tet_openres()
if (GETCWD(cwdbuf, (size_t)MAXPATH) == NULL)
fatal(errno, "getcwd() failed", (char *) 0);
- resenv = malloc(strlen(cwdbuf)+sizeof(resvar)+sizeof(resname)+4);
+ resenv = malloc(strlen(cwdbuf)+sizeof(resvar)+strlen(resname)+5);
if (resenv == NULL)
fatal(errno, "can't allocate resenv in tet_openres()",
(char *) 0);
TRACE2(tet_Tbuf, 6, "allocate resenv = %s", tet_i2x(resenv));
- tmpresenv = malloc(strlen(cwdbuf)+sizeof(tmpvar)+sizeof(tmpname)+4);
+ tmpresenv = malloc(strlen(cwdbuf)+sizeof(tmpvar)+strlen(tmpname)+5);
if (tmpresenv == NULL)
fatal(errno, "can't allocate tmpresenv in tet_openres()",
(char *) 0);