/************************************************************
** $Id: compat.c,v 1.3 2003/11/24 18:38:35 bcx Exp bcx $
**
** Copyright Bryan Costales and Perforce Software, Inc. 2003
**
** This code is "open source" as defined by version 1.9 of
** the Open Source Definition from:
**
** http://www.opensource.org/docs/definition.php.
**
** This file includes source for the routines missing on
** some versions of Unix.
**
*************************************************************/
# define EXTERN extern
# include "slow.h"
# ifndef HAVE_BASENAME
char *
basename(char *path)
{
char *cp;
if ((cp = strrchr(path, '/')) != NULL)
++cp;
else
cp = path;
return cp;
}
#endif
# ifndef HAVE_CUSERID
# include <pwd.h>
char *
cuserid(char *buf)
{
struct passwd *pw;
uid_t uid;
uid = geteuid();
pw = getpwuid(uid);
if (pw != NULL)
return pw->pw_name;
return NULL;
}
# endif
# ifndef HAVE_STRERROR
char *
strerror(int err)
{
static char buf[BUFSIZ];
if (err >= 0 && err < sys_nerr)
return (char *) sys_errlist[err];
(void) snprintf(buf, sizeof(buf), "Error %d", err);
return buf;
}
# endif
# ifndef HAVE_STRCHR
char *
strchr(char *str, int c)
{
char *cp;
if (str == NULL || *str == '\0')
return NULL;
for (cp = str; *cp != '\0'; ++cp)
if ((int)(*cp) == c)
return cp;
return NULL;
}
# endif
# ifndef HAVE_STRRCHR
char *
strrchr(char *str, int c)
{
char *cp;
if (str == NULL || *str == '\0')
return NULL;
cp = str + strlen(str);
for (; cp >= str; --cp)
if ((int)(*cp) == c)
return cp;
return NULL;
}
# endif
| # | Change | User | Description | Committed | |
|---|---|---|---|---|---|
| #3 | 3998 | bryan_costales |
Brought the whole distribution up to V0.9 Added a huge abount of documentation. Added slowedit find Created startup scripts to launch for testing Fixed numerous bugs. Fixed a few portablity issues. Installed hooks for whitelisting and IP aliases. |
||
| #2 | 3957 | bryan_costales |
Added rbl lookup support and testing for same. Folded in support for smfi_stop(). Added lots of slowedit commands Fixed a serious bug in MX lookups. Added to documentation. |
||
| #1 | 3890 | bryan_costales |
This is the 0.6 release. The following have been added with the uses indicated: Source files: edit.c -- the slowedit functions compat.c -- missing system files Autoconf: configure.ac, makefile.am config.h aclocal.m4 acinclude.m4 build/ Documents: doc/ -- html and man(1) documents Testing: tests/ -- regressive testing TODO: -- revised to show actual progress |