franz/lam8.c
/*
 *	(fileopen  filename mode)
 * open a file for read, write, or append the arguments can be either
 * strings or atoms.
 */
(fileopen  filename mode)
open a file for read, write, or append the arguments can be either
strings or atoms.
( fileopen filename mode ) open a file for read write or append the arguments can be either strings or atoms .
lispval
Lfileopen()
{
	FILE *port;
	register lispval name;
	register lispval mode;
	register char *namech;
	register char *modech;
	chkarg(2,"fileopen");
	name = lbot->val;
	mode = lbot[1].val;
	namech = (char *) verify(name,"fileopen:args must be atoms or strings");
	modech = (char *) verify(mode,"fileopen:args must be atoms or strings");
	while (modech[0] != 'r' && modech[0] != 'w' && modech[0] != 'a')
	{
		mode = errorh(Vermisc,"Modes are only r, w, a.",nil,TRUE,31);
		modech = (char *) verify(mode,"fileopen:args must be atoms or strings");
	}
	while ((port = fopen(namech, modech)) == NULL)
	{
	    name = errorh1(Vermisc,"Unable to open file.",nil,TRUE,31,name);
	    namech = (char *) verify(name,"fileopen:args must be atoms or strings");
	}
	ioname[PN(port)] = (lispval) inewstr(namech);	
	return(P(port));
}
lispval Lfileopen ( ) { FILE * port ; register lispval name ; register lispval mode ; register char * namech ; register char * modech ; chkarg ( 2 , " " ) ; name = lbot -> val ; mode = lbot [ 1 ] . val ; namech = ( char * ) verify ( name , " " ) ; modech = ( char * ) verify ( mode , " " ) ; while ( modech [ 0 ] != ' ' && modech [ 0 ] != ' ' && modech [ 0 ] != ' ' ) { mode = errorh ( Vermisc , " " , nil , TRUE , 31 ) ; modech = ( char * ) verify ( mode , " " ) ; } while ( ( port = fopen ( namech , modech ) ) == NULL ) { name = errorh1 ( Vermisc , " " , nil , TRUE , 31 , name ) ; namech = ( char * ) verify ( name , " " ) ; } ioname [ PN ( port ) ] = ( lispval ) inewstr ( namech ) ; return ( P ( port ) ) ; }
(fileopen  filename mode)
 open a file for read, write, or append the arguments can be either
 strings or atoms.
( fileopen filename mode ) open a file for read write or append the arguments can be either strings or atoms .
/* xports is a FILE *, cc complains about adding pointers */ /* remember name */