Category : Files from Magazines
Archive   : CUJ9201.ZIP
Filename : 1001018A

 
Output of file : 1001018A contained in archive : CUJ9201.ZIP
Listing 6 -- the file xfoprep.c


/* _Foprep function */
#include "xstdio.h"

/* open a stream */
FILE *_Foprep(const char *name, const char *mods,
FILE *str)
{ /* make str safe for fclose, macros */
str->_Handle = -1;
str->_Tmpnam = NULL;
str->_Buf = NULL;
str->_Next = &str->_Cbuf;
str->_Rend = &str->_Cbuf;
str->_Wend = &str->_Cbuf;
str->_Nback = 0;
str->_Mode = (str->_Mode & _MALFIL)
| (*mods == 'r' ? _MOPENR
: *mods == 'w' ? _MCREAT|_MOPENW|_MTRUNC
: *mods == 'a' ? _MCREAT|_MOPENW|_MOPENA
: 0);
if ((str->_Mode & (_MOPENR|_MOPENW)) == 0)
{ /* bad mods */
fclose(str);
return (NULL);
}
while (*++mods== 'b' || *mods == '+')
if (*mods == 'b')
if (str->_Mode & _MBIN)
break;
else
str->_Mode |= _MBIN;
else
if ((str->_Mode & (_MOPENR|_MOPENW))
== (_MOPENR|_MOPENW))
break;
else
str->_Mode |= _MOPENR|_MOPENW;
str->_Handle = _Fopen(name, str->_Mode, mods);
if (str->_Handle < 0)
{ /* open failed */
fclose(str);
return (NULL);
}
return (str);
}





  3 Responses to “Category : Files from Magazines
Archive   : CUJ9201.ZIP
Filename : 1001018A

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/