- Removed HAVE_STRTOUL
This commit is contained in:
parent
ddb665a543
commit
c0f2c3968e
5 changed files with 1 additions and 120 deletions
|
@ -185,7 +185,6 @@ check_function_exists(stricmp HAVE_STRICMP)
|
|||
check_function_exists(strncasecmp HAVE_STRNCASECMP)
|
||||
check_function_exists(strnicmp HAVE_STRNICMP)
|
||||
check_function_exists(strsep HAVE_STRSEP)
|
||||
check_function_exists(strtoul HAVE_STRTOUL)
|
||||
check_function_exists(uname HAVE_UNAME)
|
||||
check_function_exists(wait HAVE_WAIT)
|
||||
check_function_exists(waitpid HAVE_WAITPID)
|
||||
|
|
|
@ -92,7 +92,6 @@
|
|||
#cmakedefine HAVE_STRNCASECMP
|
||||
#cmakedefine HAVE_STRNICMP
|
||||
#cmakedefine HAVE_STRSEP
|
||||
#cmakedefine HAVE_STRTOUL
|
||||
#cmakedefine HAVE_UNAME
|
||||
#cmakedefine HAVE_WAIT
|
||||
#cmakedefine HAVE_WAITPID
|
||||
|
|
|
@ -5,4 +5,4 @@ add_library(compat
|
|||
rename.h send.h socket.h statmacros.h
|
||||
stdfileno.h strcasecmp.cpp strcasecmp.h strdup.cpp strdup.h
|
||||
strerror.cpp strerror.h strncasecmp.cpp strncasecmp.h strsep.cpp
|
||||
strsep.h strtoul.cpp strtoul.h termios.h uint.h uname.cpp uname.h)
|
||||
strsep.h termios.h uint.h uname.cpp uname.h)
|
|
@ -1,85 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 1999 Ross Combs (rocombs@cs.nmsu.edu)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* 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 GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include "common/setup_before.h"
|
||||
#ifndef HAVE_STRTOUL
|
||||
|
||||
#include <ctype.h>
|
||||
#include "strtoul.h"
|
||||
#include "common/setup_after.h"
|
||||
|
||||
|
||||
namespace pvpgn
|
||||
{
|
||||
|
||||
extern unsigned long strtoul(char const * str, char * * endptr, int base)
|
||||
{
|
||||
unsigned long val;
|
||||
char symbolval;
|
||||
char * pos;
|
||||
|
||||
if (!str)
|
||||
return 0; /* EINVAL */
|
||||
|
||||
for (pos = (char *)str; *pos == ' ' || *pos == '\t'; pos++);
|
||||
if (*pos == '-' || *pos == '+')
|
||||
pos++;
|
||||
if ((base == 0 || base == 16) && *pos == '0' && (*(pos + 1) == 'x' || *(pos + 1) == 'X'))
|
||||
{
|
||||
base = 16;
|
||||
pos += 2; /* skip 0x prefix */
|
||||
}
|
||||
else if ((base == 0 || base == 8) && *pos == '0')
|
||||
{
|
||||
base = 8;
|
||||
pos += 1;
|
||||
}
|
||||
else if (base == 0)
|
||||
{
|
||||
base = 10;
|
||||
}
|
||||
|
||||
if (base<2 || base>16) /* sorry, not complete emulation (should do up to 36) */
|
||||
return 0; /* EINVAL */
|
||||
|
||||
val = 0;
|
||||
for (; *pos != '\0'; pos++)
|
||||
{
|
||||
val *= base;
|
||||
|
||||
if (isxdigit(*pos))
|
||||
{
|
||||
symbolval = isdigit(*pos) ? *pos - '0' : tolower(*pos) - 'a' + 10;
|
||||
if (base > symbolval)
|
||||
val += symbolval;
|
||||
else
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (endptr)
|
||||
*endptr = (void *)pos; /* avoid warning */
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#else
|
||||
typedef int filenotempty; /* make ISO standard happy */
|
||||
#endif
|
|
@ -1,32 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 1999 Ross Combs (rocombs@cs.nmsu.edu)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* 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 GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#ifndef INCLUDED_STRTOUL_PROTOS
|
||||
#define INCLUDED_STRTOUL_PROTOS
|
||||
|
||||
#ifndef HAVE_STRTOUL
|
||||
|
||||
namespace pvpgn
|
||||
{
|
||||
|
||||
extern unsigned long strtoul(char const * str, char * * endptr, int base);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue