compat.c revision 34a5434f96aadb7c783f92e5be432a375e04299a
/*
compat.c : Compatibility functions for OSes not having them
Copyright (c) 2002 Timo Sirainen
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "lib.h"
#include <stdio.h>
#include <ctype.h>
#include <unistd.h>
#include <syslog.h>
#ifndef INADDR_NONE
# define INADDR_NONE INADDR_BROADCAST
#endif
#ifndef HAVE_MEMMOVE
{
/* dest = 1234, src=234 */
while (size > 0) {
size--;
}
/* dest = 234, src=123 */
while (size > 0) {
size--;
}
}
return dest;
}
#endif
#if !defined (HAVE_STRCASECMP) && !defined (HAVE_STRICMP)
{
}
}
{
}
}
#endif
#ifndef HAVE_INET_ATON
{
if (addr == INADDR_NONE)
return 0;
return 1;
}
#endif
#ifndef HAVE_VSYSLOG
{
const char *str;
char buf[1024];
#ifdef HAVE_VSNPRINTF
int ret;
#else
} else {
/* this may not be safe but not choice really.. */
}
#endif
}
#endif
#ifndef HAVE_GETPAGESIZE
int my_getpagesize(void)
{
#ifdef _SC_PAGESIZE
return sysconf(_SC_PAGESIZE);
#else
return 4096;
#endif
}
#endif
#ifndef HAVE_WRITEV
{
written = 0;
if (ret < 0)
return -1;
break;
}
if (written > SSIZE_T_MAX) {
return -1;
}
}
#endif