ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/porting.C
Revision: 1.23
Committed: Wed Nov 4 00:02:48 2009 UTC (14 years, 6 months ago) by root
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.22: +0 -0 lines
State: FILE REMOVED
Log Message:
agpl reorganisation

File Contents

# User Rev Content
1 elmex 1.1 /*
2 root 1.19 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 pippijn 1.13 *
4 root 1.20 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 root 1.17 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team
6     * Copyright (©) 1992,2007 Frank Tore Johansen
7 pippijn 1.13 *
8 root 1.22 * Deliantra is free software: you can redistribute it and/or modify it under
9     * the terms of the Affero GNU General Public License as published by the
10     * Free Software Foundation, either version 3 of the License, or (at your
11     * option) any later version.
12 pippijn 1.13 *
13 root 1.18 * This program is distributed in the hope that it will be useful,
14     * but WITHOUT ANY WARRANTY; without even the implied warranty of
15     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16     * GNU General Public License for more details.
17 pippijn 1.13 *
18 root 1.22 * You should have received a copy of the Affero GNU General Public License
19     * and the GNU General Public License along with this program. If not, see
20     * <http://www.gnu.org/licenses/>.
21 root 1.17 *
22 root 1.19 * The authors can be reached via e-mail to <support@deliantra.net>
23 pippijn 1.13 */
24 elmex 1.1
25     /* This file contains various functions that are not really unique for
26     * crossfire, but rather provides what should be standard functions
27     * for systems that do not have them. In this way, most of the
28     * nasty system dependent stuff is contained here, with the program
29     * calling these functions.
30     */
31    
32    
33 root 1.10 /* Need to pull in the HAVE_... values somehow */
34 elmex 1.1
35 root 1.10 #include <autoconf.h>
36 elmex 1.1
37 root 1.10 #include <cstdio>
38     #include <cstdlib>
39     #include <cstdarg>
40 root 1.5
41 root 1.10 #include <cctype>
42 elmex 1.1
43 root 1.10 #include <sys/stat.h>
44     #include <sys/wait.h>
45 elmex 1.1
46 root 1.10 #include <sys/param.h>
47 elmex 1.1
48 root 1.10 #include <unistd.h>
49 root 1.5
50 elmex 1.1 /* Has to be after above includes so we don't redefine some values */
51     #include "global.h"
52    
53     #define DIGIT(x) (isdigit(x) ? (x) - '0' : \
54     islower (x) ? (x) + 10 - 'a' : (x) + 10 - 'A')
55     #define MBASE ('z' - 'a' + 1 + 10)
56    
57 root 1.4 char *
58     strcasestr_local (const char *s, const char *find)
59 elmex 1.1 {
60 root 1.4 char c, sc;
61     size_t len;
62 elmex 1.1
63 root 1.4 if ((c = *find++) != 0)
64     {
65     c = tolower (c);
66     len = strlen (find);
67     do
68 root 1.5 {
69     do
70     {
71     if ((sc = *s++) == 0)
72     return NULL;
73     }
74     while (tolower (sc) != c);
75     }
76 root 1.4 while (strncasecmp (s, find, len) != 0);
77     s--;
78     }
79     return (char *) s;
80 elmex 1.1 }
81    
82     /**
83     * open_and_uncompress() first searches for the original filename. If it exist,
84     * then it opens it and returns the file-pointer.
85     */
86 root 1.4 FILE *
87     open_and_uncompress (const char *name, int flag, int *compressed)
88     {
89     *compressed = 0;
90     return fopen (name, "r");
91 elmex 1.1 }
92    
93     /*
94     * See open_and_uncompress().
95     */
96    
97 root 1.4 void
98 root 1.5 close_and_delete (FILE * fp, int compressed)
99 root 1.4 {
100     fclose (fp);
101 elmex 1.1 }
102