home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
misc
/
volume8
/
libhoward
/
part08
/
mfopen.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-10-01
|
2KB
|
72 lines
/*
* mfopen - try to open file and report errors with malf
*/
#ifndef lint
static char _cpyrgt[] = "Copyright 1989 Howard Lee Gayle";
#endif lint
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 1,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <stdio.h>
#include <howard/port.h>
#include <howard/version.h>
MODVER ("@(#)$Header: mfopen.c,v 1.5 89/08/13 15:07:38 howard Exp $");
#include <howard/malf.h>
#include <howard/registers.i>
PUBLIC streamT mfopen (n, m)
bStrT n; /* File name.*/
bStrT m; /* Mode string.*/
/* Function:
* Attempt to open the file. On error call malf1().
* Algorithm:
* Call fopen().
* Returns:
* On success, the streamT for the opened file. No return on error.
* Notes:
*
*/
{
R1 streamT s = fopen (S(n), S(m)); /* Stream.*/
if (NULSTRM == s) malf1 ("%s: Can not open mode %s", n, m);
return (s);
}
#ifdef TEST
#include <howard/usage.h>
MAINVER ("@(#)$Header: mfopen.c,v 1.5 89/08/13 15:07:38 howard Exp $");
USAGE ("filename mode");
PUBLIC int main (argc, argv)
int argc; /* Number of arguments.*/
bStrT *argv; /* Points to array of argument strings.*/
{
if (3 != argc) usage();
(void) mfopen (argv[1], argv[2]);
exit (SUCCESS);
#ifdef lint
return (SUCCESS);
#endif
}
#endif