/*
* This file is part of Deliantra, the Roguelike Realtime MMORPG.
*
* Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
* Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team
* Copyright (©) 1992,2007 Frank Tore Johansen
*
* Deliantra is free software: you can redistribute it and/or modify it under
* the terms of the Affero GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* 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 Affero GNU General Public License
* and the GNU General Public License along with this program. If not, see
* .
*
* The authors can be reached via e-mail to
*/
/* This file contains various functions that are not really unique for
* crossfire, but rather provides what should be standard functions
* for systems that do not have them. In this way, most of the
* nasty system dependent stuff is contained here, with the program
* calling these functions.
*/
/* Need to pull in the HAVE_... values somehow */
#include
#include
#include
#include
#include
#include
#include
#include
#include
/* Has to be after above includes so we don't redefine some values */
#include "global.h"
#define DIGIT(x) (isdigit(x) ? (x) - '0' : \
islower (x) ? (x) + 10 - 'a' : (x) + 10 - 'A')
#define MBASE ('z' - 'a' + 1 + 10)
char *
strcasestr_local (const char *s, const char *find)
{
char c, sc;
size_t len;
if ((c = *find++) != 0)
{
c = tolower (c);
len = strlen (find);
do
{
do
{
if ((sc = *s++) == 0)
return NULL;
}
while (tolower (sc) != c);
}
while (strncasecmp (s, find, len) != 0);
s--;
}
return (char *) s;
}
/**
* open_and_uncompress() first searches for the original filename. If it exist,
* then it opens it and returns the file-pointer.
*/
FILE *
open_and_uncompress (const char *name, int flag, int *compressed)
{
*compressed = 0;
return fopen (name, "r");
}
/*
* See open_and_uncompress().
*/
void
close_and_delete (FILE * fp, int compressed)
{
fclose (fp);
}