1 /*
2 * ffproxy (c) 2002, 2003 Niklas Olmes <niklas@noxa.de>
3 * http://faith.eu.org
4 *
5 * $Id: file.c,v 2.1 2004/12/31 08:59:15 niklas Exp $
6 *
7 * This program is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License as published by the Free
9 * Software Foundation; either version 2 of the License, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * this program; if not, write to the Free Software Foundation, Inc., 675
19 * Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22 #include <stdio.h>
23
24 #include "configure.h"
25 #ifdef HAVE_FCNTL_H
26 # include <fcntl.h>
27 #endif
28
29 #include "print.h"
30 #include "file.h"
31
32 int
my_open(const char * path)33 my_open(const char *path)
34 {
35 int f;
36
37 if ((f = open(path, O_RDONLY, 0)) < 0)
38 fatal("unable to open file %s", path);
39
40 return f;
41 }
42
43 FILE *
my_fopen(const char * path)44 my_fopen(const char *path)
45 {
46 FILE *fp;
47
48 if ((fp = fopen(path, "r")) == NULL)
49 fatal("unable to open file %s", path);
50
51 return fp;
52 }
53