/[LeafOK_CVS]/pvpgn-1.7.4/src/bnetd/support.c
ViewVC logotype

Contents of /pvpgn-1.7.4/src/bnetd/support.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (vendor branch)
Tue Jun 6 03:41:37 2006 UTC (19 years, 9 months ago) by sysadm
Branch: GNU, MAIN
CVS Tags: pvpgn_1-7-4-0_MIL, arelease, HEAD
Changes since 1.1: +0 -0 lines
Content type: text/x-csrc
Error occurred while calculating annotation data.
no message

1 /*
2 * Copyright (C) 2004 Lector
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19 #include "common/setup_before.h"
20 #include <stdio.h>
21 #ifdef HAVE_STDDEF_H
22 # include <stddef.h>
23 #else
24 # ifndef NULL
25 # define NULL ((void *)0)
26 # endif
27 #endif
28 #ifdef STDC_HEADERS
29 # include <stdlib.h>
30 #else
31 # ifdef HAVE_MALLOC_H
32 # include <malloc.h>
33 # endif
34 #endif
35 #ifdef HAVE_STRING_H
36 # include <string.h>
37 #else
38 # ifdef HAVE_STRINGS_H
39 # include <strings.h>
40 # endif
41 #endif
42 #include <errno.h>
43 #ifdef HAVE_UNISTD_H
44 #include <unistd.h>
45 #endif
46 #include "compat/access.h"
47 #include "compat/strerror.h"
48 #include "common/eventlog.h"
49 #include "common/xalloc.h"
50 #include "support.h"
51 #include "prefs.h"
52 #include "common/util.h"
53 #include "common/setup_after.h"
54
55 extern int support_check_files(char const * supportfile)
56 {
57
58 FILE *fp;
59 char *buff;
60 unsigned int line;
61 int filedirlen;
62 char * namebuff;
63
64 if (!(supportfile))
65 {
66 eventlog(eventlog_level_error,__FUNCTION__,"got NULL supportfile");
67 return -1;
68 }
69
70 if (!(fp = fopen(supportfile,"r")))
71 {
72 eventlog(eventlog_level_error,__FUNCTION__,"could not open file \"%s\" for reading (fopen: %s)",supportfile,pstrerror(errno));
73 eventlog(eventlog_level_error,__FUNCTION__,"can't guarantee that everything will run smooth");
74 return 0;
75 }
76
77 filedirlen = strlen(prefs_get_filedir());
78
79 for (line=1; (buff = file_get_line(fp)); line++)
80 {
81 if (buff[0]=='#' || buff[0]=='\0')
82 {
83 continue;
84 }
85
86 namebuff = xmalloc(filedirlen + 1 + strlen(buff) + 1);
87 sprintf(namebuff,"%s/%s",prefs_get_filedir(),buff);
88
89 if (access(namebuff, F_OK) < 0)
90 {
91 eventlog(eventlog_level_fatal,__FUNCTION__,"necessary file \"%s\" missing",namebuff);
92 xfree((void *)namebuff);
93 fclose(fp);
94 return -1;
95 }
96
97 xfree((void *)namebuff);
98 }
99
100 file_get_line(NULL); // clear file_get_line buffer
101 fclose(fp);
102
103 return 0;
104 }

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1