summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile28
-rw-r--r--src/compat.c143
-rwxr-xr-xsrc/core/configure9
-rw-r--r--src/datafiles.c2
-rw-r--r--src/main.c10
-rwxr-xr-xsrc/modules/configure9
-rw-r--r--src/nickserv.c6
-rwxr-xr-xsrc/protocol/configure9
8 files changed, 45 insertions, 171 deletions
diff --git a/src/Makefile b/src/Makefile
index 53153daf7..ea4b572c2 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -36,7 +36,7 @@ distclean: spotless
distclean_modules: clean_modules spotless
services: $(OBJS) mod_version
- $(CC) $(CFLAGS) $(OBJS) $(ANOPELIBS) $(MLIBS) -o $@ $(LDFLAGS)
+ @../run-cc.pl $(CC) $(CFLAGS) $(OBJS) $(ANOPELIBS) $(MLIBS) -o $@ $(LDFLAGS)
$(OBJS): Makefile
actions.o: actions.c $(INCLUDES)
@@ -80,35 +80,39 @@ mysql.o: mysql.c $(INCLUDES)
rdb.o: rdb.c $(INCLUDES)
mod_version: mod_version.c $(INCLUDES)
- $(CC) $(CDEFS) $(CFLAGS) $(MODULEFLAGS) -I../include/ -c mod_version.c
-
+ @../run-cc.pl $(CC) $(CDEFS) $(CFLAGS) $(MODULEFLAGS) -I../include/ -c mod_version.c
modules: DUMMY
- (cd modules ; ./configure ; ${MAKE} ${MAKEARGS} all)
+ @modules/configure modules
+ @${MAKE} -C modules ${MAKEARGS} all
protocols: DUMMY
- (cd protocol ; ./configure ; ${MAKE} ${MAKEARGS} all)
+ @protocol/configure protocol
+ @${MAKE} -C protocol ${MAKEARGS} all
+
core: DUMMY
- (cd core ; ./configure ; ${MAKE} ${MAKEARGS} all)
+ @core/configure core
+ @${MAKE} -C core ${MAKEARGS} all
clean: clean_modules clean_protocols clean_core
rm -f *.o services a.out
+
clean_modules:
@touch modules/Makefile.inc # Horribly ugly...
- (cd modules ; ${MAKE} clean)
+ @${MAKE} -C modules clean
clean_protocols:
@touch protocol/Makefile.inc
- (cd protocol ; ${MAKE} clean)
+ @${MAKE} -C protocol clean
clean_core:
@touch core/Makefile.inc
- (cd core ; ${MAKE} clean)
+ @${MAKE} -C core clean
spotless:
- (cd modules ; ${MAKE} distclean)
- (cd protocol ; ${MAKE} distclean)
- (cd core ; ${MAKE} distclean)
+ @${MAKE} -C modules distclean
+ @${MAKE} -C protocol distclean
+ @${MAKE} -C core distclean
install: services
test -d ${BINDEST} || mkdir ${BINDEST}
diff --git a/src/compat.c b/src/compat.c
index 0478e4ee6..7b7947c1c 100644
--- a/src/compat.c
+++ b/src/compat.c
@@ -16,38 +16,6 @@
/*************************************************************************/
-#if !HAVE_SNPRINTF
-
-/* [v]snprintf: Like [v]sprintf, but don't write more than len bytes
- * (including null terminator). Return the number of bytes
- * written.
- */
-
-#if BAD_SNPRINTF
-int vsnprintf(char *buf, size_t len, const char *fmt, va_list args)
-{
- if (len <= 0)
- return 0;
- *buf = 0;
- vsnprintf(buf, len, fmt, args);
- buf[len - 1] = 0;
- return strlen(buf);
-}
-#endif /* BAD_SNPRINTF */
-
-int snprintf(char *buf, size_t len, const char *fmt, ...)
-{
- va_list args;
-
- va_start(args, fmt);
- return vsnprintf(buf, len, fmt, args);
- va_end(args);
-}
-
-#endif /* !HAVE_SNPRINTF */
-
-/*************************************************************************/
-
#if !HAVE_STRICMP && !HAVE_STRCASECMP
/* stricmp, strnicmp: Case-insensitive versions of strcmp() and
@@ -113,114 +81,3 @@ size_t strspn(const char *s, const char *accept)
#endif
/*************************************************************************/
-
-#if !HAVE_STRERROR
-# if HAVE_SYS_ERRLIST
-extern char *sys_errlist[];
-# endif
-
-char *strerror(int errnum)
-{
-# if HAVE_SYS_ERRLIST
- return sys_errlist[errnum];
-# else
- static char buf[20];
- snprintf(buf, sizeof(buf), "Error %d", errnum);
- return buf;
-# endif
-}
-#endif
-
-/*************************************************************************/
-
-#if !HAVE_STRSIGNAL
-/* Windows only supports 6 signals:
- * SIGINT, SIGILL, SIGABRT, SIGFPE, SIGSEGV, SIGTERM
- * -- codemastr
- */
-char *strsignal(int signum)
-{
- static char buf[32];
- switch (signum) {
-#ifndef _WIN32
- case SIGHUP:
- strscpy(buf, "Hangup", sizeof(buf));
- break;
-#endif
- case SIGINT:
- strscpy(buf, "Interrupt", sizeof(buf));
- break;
-#ifndef _WIN32
- case SIGQUIT:
- strscpy(buf, "Quit", sizeof(buf));
- break;
-#endif
-#ifdef SIGILL
- case SIGILL:
- strscpy(buf, "Illegal instruction", sizeof(buf));
- break;
-#endif
-#ifdef SIGABRT
- case SIGABRT:
- strscpy(buf, "Abort", sizeof(buf));
- break;
-#endif
-#if defined(SIGIOT) && (!defined(SIGABRT) || SIGIOT != SIGABRT)
- case SIGIOT:
- strscpy(buf, "IOT trap", sizeof(buf));
- break;
-#endif
-#ifdef SIGBUS
- case SIGBUS:
- strscpy(buf, "Bus error", sizeof(buf));
- break;
-#endif
- case SIGFPE:
- strscpy(buf, "Floating point exception", sizeof(buf));
- break;
-#ifndef _WIN32
- case SIGKILL:
- strscpy(buf, "Killed", sizeof(buf));
- break;
- case SIGUSR1:
- strscpy(buf, "User signal 1", sizeof(buf));
- break;
-#endif
- case SIGSEGV:
- strscpy(buf, "Segmentation fault", sizeof(buf));
- break;
-#ifndef _WIN32
- case SIGUSR2:
- strscpy(buf, "User signal 2", sizeof(buf));
- break;
- case SIGPIPE:
- strscpy(buf, "Broken pipe", sizeof(buf));
- break;
- case SIGALRM:
- strscpy(buf, "Alarm clock", sizeof(buf));
- break;
-#endif
- case SIGTERM:
- strscpy(buf, "Terminated", sizeof(buf));
- break;
-#ifndef _WIN32
- case SIGSTOP:
- strscpy(buf, "Suspended (signal)", sizeof(buf));
- break;
- case SIGTSTP:
- strscpy(buf, "Suspended", sizeof(buf));
- break;
- case SIGIO:
- strscpy(buf, "I/O error", sizeof(buf));
- break;
-#endif
- default:
- snprintf(buf, sizeof(buf), "Signal %d\n", signum);
- break;
- }
- return buf;
-}
-#endif
-
-
-/*************************************************************************/
diff --git a/src/core/configure b/src/core/configure
index 68d2b7713..92efecd41 100755
--- a/src/core/configure
+++ b/src/core/configure
@@ -1,5 +1,11 @@
#!/bin/sh
+oldpath=`pwd`
+
+if [ $1 ]; then
+ cd $1
+fi
+
echo2 () {
$ECHO2 "$*$ECHO2SUF" # these are defined later
}
@@ -49,5 +55,6 @@ do
fi
done
-exit 0
+cd $oldpath
+exit 0
diff --git a/src/datafiles.c b/src/datafiles.c
index fd1b05f94..10008952e 100644
--- a/src/datafiles.c
+++ b/src/datafiles.c
@@ -329,7 +329,7 @@ void restore_db(dbFILE * f)
}
if (!ok && f->backupfp) {
char buf[1024];
- int i;
+ unsigned int i;
ok = 1;
if (fseek(f->fp, 0, SEEK_SET) < 0)
ok = 0;
diff --git a/src/main.c b/src/main.c
index 7e33c3de8..60a9ce8bf 100644
--- a/src/main.c
+++ b/src/main.c
@@ -461,8 +461,8 @@ void sighandler(int signum)
default:
snprintf(buf, sizeof(buf), "waiting=%d", waiting);
}
- ircdproto->SendGlobops(NULL, "PANIC! %s (%s)", buf, strsignal(signum));
- alog("PANIC! %s (%s)", buf, strsignal(signum));
+ ircdproto->SendGlobops(NULL, "PANIC! %s (caught signal %d)", buf, signum);
+ alog("PANIC! %s (caught signal %d)", buf, signum);
modules_unload_all(false, true);
}
}
@@ -474,13 +474,7 @@ void sighandler(int signum)
!(quitmsg = (const char *)calloc(BUFSIZE, 1))) {
quitmsg = "Out of memory!";
} else {
-
- // Yes, this isn't the "nicest" of ideas, but we know it's safe, if bad practice. -- w00t
-#if HAVE_STRSIGNAL
- snprintf((char *)quitmsg, BUFSIZE, "Services terminating: %s", strsignal(signum));
-#else
snprintf((char *)quitmsg, BUFSIZE, "Services terminating on signal %d", signum);
-#endif
}
if (signum == SIGSEGV) {
diff --git a/src/modules/configure b/src/modules/configure
index cf2158d66..53a745592 100755
--- a/src/modules/configure
+++ b/src/modules/configure
@@ -1,5 +1,11 @@
#!/bin/sh
+oldpath=`pwd`
+
+if [ $1 ]; then
+ cd $1
+fi
+
echo2 () {
$ECHO2 "$*$ECHO2SUF" # these are defined later
}
@@ -54,5 +60,6 @@ do
fi
done
-exit 0
+cd $oldpath
+exit 0
diff --git a/src/nickserv.c b/src/nickserv.c
index e4a48bd56..8eea4c695 100644
--- a/src/nickserv.c
+++ b/src/nickserv.c
@@ -492,10 +492,8 @@ void load_ns_dbase(void)
if (ver < 14) {
SAFE(read_string(&pass, f));
if (pass) {
- len = strlen(pass);
- enc_encrypt(pass, len, nc->pass, PASSMAX);
- memset(pass, 0, len);
- free(pass);
+ memset(nc->pass, 0, PASSMAX);
+ memcpy(nc->pass, pass, strlen(pass));
} else
memset(nc->pass, 0, PASSMAX);
} else
diff --git a/src/protocol/configure b/src/protocol/configure
index 68d2b7713..92efecd41 100755
--- a/src/protocol/configure
+++ b/src/protocol/configure
@@ -1,5 +1,11 @@
#!/bin/sh
+oldpath=`pwd`
+
+if [ $1 ]; then
+ cd $1
+fi
+
echo2 () {
$ECHO2 "$*$ECHO2SUF" # these are defined later
}
@@ -49,5 +55,6 @@ do
fi
done
-exit 0
+cd $oldpath
+exit 0