ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/porting.C
Revision: 1.21
Committed: Mon Sep 29 08:52:35 2008 UTC (15 years, 7 months ago) by root
Content type: text/plain
Branch: MAIN
CVS Tags: rel-2_80, rel-2_72, rel-2_73, rel-2_76, rel-2_77, rel-2_74, rel-2_75, rel-2_78, rel-2_79
Changes since 1.20: +0 -97 lines
Log Message:
stripped cruft from porting.C

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