 /*K  * This module replaces the standard library "fopen(name, mode)" to include   * some Decus C mode functions: #  *	r	Identical to standard function 8  *	w	Creates the file using attributes "rat=CR, rfm=VAR"+  *		so files "look like" standard vax files #  *	a	Identical to standard function 5  *	rn	Identical to standard function fopen(name, "r") 5  *	wn	Identical to standard function fopen(name, "w") 3  * This module compiles, but it hasn't been tested.   */    #include <stdio.h>   FILE * fopen(name, mode)   char		*name;		/* File name				*/  char		*mode;		/* Open mode				*/ /*  * Open the file  */  { # 	int	nonewlines = (mode[1] == 'n');    	switch (mode[0]) { 
 	case	'r':% 		return(fdopen(open(name, 0), "r"));   
 	case	'a':& 		return(fdopen(open(name, 1), mode));  
 	case	'w': 		return((nonewlines)   			? fdopen(creat(name, 0), "w")5 			: fdopen(creat(name, 0, "rat=cr", "rfm=var"), "w")  		); 	}0 	fprintf(stderr, "illegal mode \"%s\"\n", mode);	 	exit(2);  }   