void initenviron()
{
	register int sysid, sysmax;
	register struct systab *sp;

	/* do this once for each connected system */
	for (sysid = 0, sysmax = symax(); sysid <= sysmax; sysid++)
		if ((sp = syfind(sysid)) != (struct systab *) 0)
			init1environ(sp);
}
Exemplo n.º 2
0
static void rescode_distribute()
{
	register int sysid, sysmax;
	FILE *fp;
	char line[LBUFLEN];
	char **lines = (char **) 0;
	int llines = 0, nlines = 0;
	register char *p, **lp;
	register struct systab *sp;
	int rc = 0;

	TRACE1(tet_Ttcc, 4, "rescode_distribute()");

	/* open the master results code file */
	if ((fp = fopen(rcftmp, "r")) == (FILE *) 0)
		fatal(errno, "can't open", rcftmp);

	/* read in all the lines */
	while (fgets(line, sizeof line, fp) != (char *) 0) {
		for (p = line; *p; p++)
			if (*p == '\n') {
				*p = '\0';
				break;
			}
		RBUFCHK((char **) &lines, &llines, (int) ((nlines + 1) * sizeof *lines));
		*(lines + nlines++) = rstrstore(line);
	}

	(void) fclose(fp);

	/* distribute the lines to each remote system */
	for (sysid = 1, sysmax = symax(); sysid <= sysmax; sysid++)
		if ((sp = syfind(sysid)) != (struct systab *) 0 &&
			rdist2(sp, lines, nlines) < 0)
				rc = -1;

	/* free storage allocated here */
	for (lp = lines; lp < lines + nlines; lp++) {
		TRACE2(tet_Tbuf, 6, "free rescode line = %s", tet_i2x(*lp));
		free(*lp);
		*lp = (char *) 0;
	}
	TRACE2(tet_Tbuf, 6, "free rescode list = %s", tet_i2x(lines));
	free((char *) lines);

	if (rc < 0)
		tcc_exit(1);
}
Exemplo n.º 3
0
void initrescode()
{
	struct systab *sp;

	TRACE1(tet_Ttcc, 4, "initrescode()");

	/* initialise the rescode table */
	irc2();
	if ((sp = syfind(0)) != (struct systab *) 0)
		sp->sy_rcfname = rcftmp;

#ifndef TET_LITE	/* -START-LITE-CUT- */
	/* propagate the rescode table to each remote system */
	if (symax() > 0)
		rescode_distribute();

	/* then send the file name to XRESD */
	if (tet_xdcodesfile(rcftmp) < 0)
		fatal(tet_xderrno,
			"can't send results code file name to XRESD",
			(char *) 0);
#endif /* !TET_LITE */	/* -END-LITE-CUT- */

}