Metropoli BBS
VIEWER: aplrun.c MODE: TEXT (ASCII)
/*Copyright (C) 1992, 1996 by Thomas Glen Smith.  All Rights Reserved.*/
/* aplrun APL2 V1.0.0 **************************************************
* Called from aplwksp to do )RUN.                                      *
***********************************************************************/
#define INCLUDES APLCB+APLMEM+STDIO
#include "includes.h"
void aplrun(rite,cp,cpend)
Aplcb rite; /* aplcb for command text */
char *cp; /* Pointer to char immediately after right parenthesis */
char *cpend; /* Pointer to end of command text */
{
	Aplfopn; Lifo;
	extern int aplerr;
	typedef struct aplfpq *Aplfpq;
	struct aplfpq {
		Aplfpq fpnxt;	/* next on stack */
		FILE *aplfp;
	};
	extern Aplfpq aplfphd; /* top of input stack */
	Aplfpq top;
	FILE *fp;

	if (NULL == (fp = aplfopn(cp,cpend,"r")))
		return; /* Couldn't open input file. */
	if (NULL != (top = malloc(sizeof(struct aplfpq)))) {
		top = lifo(&aplfphd,top); /* place on stack */
		top->aplfp = fp; /* put file ptr in stack */
	}
	else fclose(fp); /* out of storage - close file */
#if APL_DOS
	errno = 0; /* clear any error for open/close */
#endif
}
[ RETURN TO DIRECTORY ]