From: Remco Rijnders Date: Sat, 20 Apr 2013 10:02:20 +0000 (+0200) Subject: Removal of m4 code, cleanup of obsolete comments X-Git-Url: http://git.serene-ircd.net/?a=commitdiff_plain;h=80fc330b6aa09545198bdc2f5c9a62e6b01679ce;p=serene-ircd.git Removal of m4 code, cleanup of obsolete comments --- diff --git a/include/config.h b/include/config.h index 24bf776..2bd1f29 100644 --- a/include/config.h +++ b/include/config.h @@ -330,13 +330,6 @@ */ #undef CMDLINE_CONFIG /* allow conf-file to be specified on command line */ -/* - * To use m4 as a preprocessor on the ircd.conf file, define M4_PREPROC. - * The server will then call m4 each time it reads the ircd.conf file, - * reading m4 output as the server's ircd.conf file. - */ -#undef M4_PREPROC - /* * If you wish to have the server send 'vital' messages about server * through syslog, define USE_SYSLOG. Only system errors and events critical diff --git a/src/buildm4 b/src/buildm4 deleted file mode 100755 index 5fd2a89..0000000 --- a/src/buildm4 +++ /dev/null @@ -1,88 +0,0 @@ -#!/bin/sh - -# DALnet RCS/CVS identification: -# $Id: buildm4,v 1.1.1.1 2001/10/22 19:27:09 remmy Exp $ - -# IRC - Internet Relay Chat, ircd/buildm4 -# Copyright (C) 1993 Darren Reed -# -# 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 1, 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., 675 Mass Ave, Cambridge, MA 02139, USA. - -# -# If only this was a perl script...*sigh* -# -IRCDDIR=$1 -M4=$IRCDDIR/ircd.m4 -/bin/rm -f $M4 -egrep "^#def[^P]*PATCHLEVEL" ../include/patchlevel.h | \ -sed -e 's/[^\"]*\"\([^\"]*\)\"/define(VERSION,\1)/' >>$M4 -DEBUG=`egrep "^#define[ ]*DEBUGMODE" ../include/config.h` -if [ -n "$DEBUG" ] ; then - echo "define(DEBUGMODE,1)" >>$M4 -else - echo "undefine(DEBUGMODE)" >>$M4 -fi -echo -n "define(HOSTNAME," >> $M4 -echo "`hostname`" | sed -e 's/\([a-zA-Z0-9\-]*\).*/\1)/' >> $M4 -echo "define(USER,$USER)" >>$M4 -echo -n 'define(PORT,' >>$M4 -PORT=`egrep '^#define[ ]*PORT[ ]*[0-9]*' ../include/config.h` -echo "$PORT" | sed -e 's/[^0-9]*\([0-9]*\).*/\1)/' >> $M4 -echo -n 'define(PFREQ,' >>$M4 -PING=`egrep '^#define[ ]*PINGFREQUENCY[ ]*[0-9]*' ../include/config.h` -echo "$PING" | sed -e 's/[^0-9]*\([0-9]*\).*/\1)/' >> $M4 -echo -n 'define(CFREQ,' >>$M4 -CONT=`egrep '^#define[ ]*CONNECTFREQUENCY[ ]*[0-9]*' ../include/config.h` -echo "$CONT" | sed -e 's/[^0-9]*\([0-9]*\).*/\1)/' >> $M4 -echo -n "define(MAXSENDQ," >>$M4 -MAXQ=`egrep '^#define[ ]*MAXSENDQLENGTH[ ]*[0-9]*' ../include/config.h` -echo "$MAXQ" | sed -e 's/[^0-9]*\([0-9]*\).*/\1)/' >> $M4 -echo -n "define(MAXLINKS," >>$M4 -MAXL=`egrep '^#define[ ]*MAXIMUM_LINKS[ ]*[0-9]* | head -1' \ -../include/config.h` -echo "$MAXL" | sed -e 's/[^0-9]*\([0-9]*\).*/\1)/' >> $M4 -DOM=`egrep '^domain' /etc/resolv.conf | \ -sed -e 's/^domain[ ]*\([a-zA-Z\-\.0-9]*\).*/\1/'` -echo "define(DOMAIN,$DOM)" >> $M4 - -cat >>$M4 <<_EOF_ -define(CL,\`ifelse(len(\$1),0,0,\$1)') -define(HOST,\$1) -define(HOSTM,\$1) -define(ID,*@\$1) -define(PASS,\$1) -define(PING,\`ifelse(len(\$1),0,PFREQ,\$1)') -define(APORT,\`ifelse(len(\$1),0,PORT,\$1)') -define(FREQ,\`ifelse(len(\$1),0,CFREQ,\$1)') -define(SENDQ,\`ifelse(len(\$1),0,MAXSENDQ,\$1)') -define(MAX,\`ifelse(len(\$1),0,MAXLINKS,\$1)') -define(CPORT,\$1) -define(SERV,\$1) -define(ADMIN,A:\$1:\$2:\$3:\$4:\$5) -define(ALLOW,N:\`HOST(\$1)':\`PASS(\$2)':\`SERV(\$3)':\`HOSTM(\$4)':\`CL(\$5)') -define(BAN,K:\$1:\$2:\$3) -define(CLASS,Y:\$1:\`PING(\$2)':\$3:\`MAX(\$4)':\`SENDQ(\$5)') -define(CLIENT,I:\`HOST(\$1)':\`PASS(\$2)':\`ifelse(len(HOST(\$3)),0,\$1,\$3)':\ -\`APORT(\$4)':\`CL(\$5)') -define(CONNECT,C:\`HOST(\$1)':\`PASS(\$2)':\`SERV(\$3)':\ -\`CPORT(\$4)':\`CL(\$5)') -define(ME,M:\$1:\$2:\$3:\$4:\$5) -define(HUB,H:\`ifelse(len(\$2),0,*,\$2)':*:\$1) -define(LEAF,L:\`ifelse(len(\$2),0,*,\$2)':*:\$1:1) -define(SERVER,\` -CONNECT(\$1,\$2,\$3,\$5,\$6) -ALLOW(\$1,\$2,\$3,\$4,\$6) -') -_EOF_ diff --git a/src/chkconf.c b/src/chkconf.c index 52af651..09ba13e 100644 --- a/src/chkconf.c +++ b/src/chkconf.c @@ -24,17 +24,6 @@ #include #include #include -#ifdef __hpux -#include "inet.h" -#endif -#ifdef PCS -#include -#endif - -#ifdef DYNIXPTX -#include -#include -#endif #undef free #define MyMalloc(x) malloc(x) @@ -82,41 +71,11 @@ int main (argc, argv) * openconf * * returns -1 on any error or else the fd opened from which to read the - * configuration file from. This may either be th4 file direct or one end - * of a pipe from m4. + * configuration file from. */ static int openconf () { -#ifdef M4_PREPROC - int pi[2]; - - if (pipe (pi) == -1) - return -1; - switch (fork ()) { - case -1: - return -1; - case 0: - (void) close (pi[0]); - if (pi[1] != 1) { - (void) dup2 (pi[1], 1); - (void) close (pi[1]); - } - (void) dup2 (1, 2); - /* - * m4 maybe anywhere, use execvp to find it. Any error - * goes out with report_error. Could be dangerous, - * two servers running with the same fd's >:-) -avalon - */ - (void) execlp ("m4", "m4", "ircd.m4", configfile, 0); - perror ("m4"); - exit (-1); - default: - (void) close (pi[1]); - return pi[0]; - } -#else return open (configfile, O_RDONLY); -#endif } static int oper_access[] = { @@ -143,6 +102,7 @@ static int oper_access[] = { OFLAG_ZLINE, 'z', 0, 0 }; + /* ** initconf() ** Read configuration file. @@ -150,7 +110,6 @@ static int oper_access[] = { ** returns -1, if file cannot be opened ** 0, if file opened */ - static aConfItem *initconf (opt) int opt; { @@ -163,9 +122,6 @@ static aConfItem *initconf (opt) (void) fprintf (stderr, "\nOpening %s as ircd configuration file\n\n", configfile); if ((fd = openconf ()) == -1) { -#ifdef M4_PREPROC - (void) wait (0); -#endif return NULL; } lineno = 0; @@ -495,9 +451,6 @@ static aConfItem *initconf (opt) } printf ("\n"); (void) close (fd); -#ifdef M4_PREPROC - (void) wait (0); -#endif return ctop; } diff --git a/src/s_conf.c b/src/s_conf.c index 4509ccc..4992786 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -625,7 +625,6 @@ aConfItem *find_conf_entry (aconf, mask) * return 1 is zline exists, 0 if it doesn't * -david kopstain */ - int ZLineExists (char *name) { aConfItem *aconf; @@ -658,20 +657,11 @@ aConfItem *find_temp_conf_entry (aconf, mask) continue; if (!(bconf->status & mask) || (bconf->port != aconf->port)) continue; -/* if (!bconf->tempconf) continue; */ if ((BadPtr (bconf->host) && !BadPtr (aconf->host)) || (BadPtr (aconf->host) && !BadPtr (bconf->host))) continue; if (!BadPtr (bconf->host) && mycmp (bconf->host, aconf->host)) continue; - -/* if ((BadPtr(bconf->passwd) && !BadPtr(aconf->passwd)) || - (BadPtr(aconf->passwd) && !BadPtr(bconf->passwd))) - continue; - if (!BadPtr(bconf->passwd) && - mycmp(bconf->passwd, aconf->passwd)) - continue; */ - if ((BadPtr (bconf->name) && !BadPtr (aconf->name)) || (BadPtr (aconf->name) && !BadPtr (bconf->name))) continue; @@ -731,17 +721,6 @@ int m_svsnoop (cptr, sptr, parc, parv) } if (parv[2][0] == '+') { sendto_ops ("This server is now placed in SVSNOOP mode."); - - /* This stuff is broken anyway - let's just try a different and very simple approach. - * if SVSNOOP == 1, you cant use m_oper...should do the trick I think. - * see m_oper for the rest of the revamp. -GZ - * - * - * for (aconf = conf; aconf; aconf = aconf->next) { - * if (aconf->status & CONF_OPERATOR || aconf->status & CONF_LOCOP) - * aconf->status = CONF_ILLEGAL; - * } - */ SVSNOOP = 1; } else { @@ -771,11 +750,6 @@ int rehash (cptr, sptr, sig) if (sig == 1 && SVSNOOP == 0) { sendto_ops ("Got signal SIGHUP, reloading ircd conf. file"); -#ifdef ULTRIX - if (fork () > 0) - exit (0); - write_pidfile (); -#endif } for (i = 0; i <= highest_fd; i++) if ((acptr = local[i]) && !IsMe (acptr)) @@ -869,44 +843,11 @@ int rehash (cptr, sptr, sig) * openconf * * returns -1 on any error or else the fd opened from which to read the - * configuration file from. This may either be th4 file direct or one end - * of a pipe from m4. + * configuration file from. */ int openconf () { -#ifdef M4_PREPROC - int pi[2], i; - - if (pipe (pi) == -1) - return -1; - switch (fork ()) { - case -1: - return -1; - case 0: - (void) close (pi[0]); - if (pi[1] != 1) { - (void) dup2 (pi[1], 1); - (void) close (pi[1]); - } - (void) dup2 (1, 2); - for (i = 3; i < MAXCONNECTIONS; i++) - if (local[i]) - (void) close (i); - /* - * m4 maybe anywhere, use execvp to find it. Any error - * goes out with report_error. Could be dangerous, - * two servers running with the same fd's >:-) -avalon - */ - (void) execlp ("m4", "m4", "ircd.m4", configfile, 0); - report_error ("Error executing m4 %s:%s", &me); - exit (-1); - default: - (void) close (pi[1]); - return pi[0]; - } -#else return open (configfile, O_RDONLY); -#endif } extern char *getfield (); @@ -942,7 +883,6 @@ static int oper_access[] = { ** returns -1, if file cannot be opened ** 0, if file opened */ - #define MAXCONFLINKS 150 int initconf (opt) @@ -966,9 +906,6 @@ int initconf (opt) Debug ((DEBUG_DEBUG, "initconf(): ircd.conf = %s", configfile)); if ((fd = openconf ()) == -1) { -#ifdef M4_PREPROC - (void) wait (0); -#endif return -1; } (void) dgets (-1, NULL, 0); /* make sure buffer is at empty pos */ @@ -1033,7 +970,7 @@ int initconf (opt) ccount++; aconf->status = CONF_CONNECT_SERVER; break; - case 'e': + case 'e': case 'E': /* Blocking of DCC transfers -GZ */ aconf->status = CONF_DCCBLOCK; break; @@ -1286,9 +1223,6 @@ int initconf (opt) free_conf (aconf); (void) dgets (-1, NULL, 0); /* make sure buffer is at empty pos */ (void) close (fd); -#ifdef M4_PREPROC - (void) wait (0); -#endif check_class (); nextping = nextconnect = time (NULL); return 0; @@ -1503,10 +1437,6 @@ int m_killcomment (sptr, parv, filename) struct stat sb; struct tm *tm; - /* - * stop NFS hangs...most systems should be able to open a file in - * 3 seconds. -avalon (curtesy of wumpus) - */ fd = open (filename, O_RDONLY); if (fd == -1) { sendto_one (sptr, err_str (ERR_NOMOTD), me.name, parv); @@ -1523,9 +1453,6 @@ int m_killcomment (sptr, parv, filename) *tmp = '\0'; if ((tmp = (char *) index (line, '\r'))) *tmp = '\0'; - /* sendto_one(sptr, - ":%s %d %s : %s.", - me.name, ERR_YOUREBANNEDCREEP, parv,line); */ sendto_one (sptr, rpl_str (RPL_MOTD), me.name, parv, line); } sendto_one (sptr, @@ -1864,9 +1791,7 @@ int m_kline (cptr, sptr, parc, parv) parv[0]); return 0; } -/* This patch allows opers to quote kline by address as well as nick - * --Russell - */ + if ((hosttemp = (char *) strchr (parv[1], '@'))) { temp = 0; while (temp <= 20) @@ -1912,8 +1837,6 @@ int m_kline (cptr, sptr, parc, parv) return 0; } /* Add some wildcards */ - - strcpy (uhost, host); if (isdigit (host[strlen (host) - 1])) { if (sscanf (host, "%d.%d.%d.%*d", &ip1, &ip2, &ip3)) @@ -1937,7 +1860,6 @@ int m_kline (cptr, sptr, parc, parv) * parv[0] = sender prefix * parv[1] = userhost */ - int m_unkline (cptr, sptr, parc, parv) aClient *cptr, *sptr; int parc; @@ -2004,7 +1926,6 @@ int m_unkline (cptr, sptr, parc, parv) * parv[1] = host * parv[2] = reason */ - int m_zline (cptr, sptr, parc, parv) aClient *cptr, *sptr; int parc; @@ -2183,7 +2104,6 @@ int m_zline (cptr, sptr, parc, parv) * parv[0] = sender prefix * parv[1] = host */ - int m_unzline (cptr, sptr, parc, parv) aClient *cptr, *sptr; int parc; @@ -2191,10 +2111,6 @@ int m_unzline (cptr, sptr, parc, parv) { char userhost[512 + 2] = "", *in; int result = 0, uline = 0, akill = 0; -/* Compiler says these are unused - aConfItem *aconf, *tmp; - aConfItem dummy; - */ char *mask, *server = NULL; uline = IsULine (cptr, sptr) ? 1 : 0; @@ -2321,7 +2237,6 @@ int m_unzline (cptr, sptr, parc, parv) * FALSE == mask is not ok * UNSURE == [unused] something went wrong */ - int advanced_check (char *userhost, int ipstat) { register int retval = TRUE; diff --git a/src/s_debug.c b/src/s_debug.c index fe61b13..5494f28 100644 --- a/src/s_debug.c +++ b/src/s_debug.c @@ -41,9 +41,6 @@ char serveropts[] = { #ifndef NO_DEFAULT_INVISIBLE 'I', #endif -#ifdef M4_PREPROC - 'm', -#endif #ifdef IDLE_FROM_MSG 'M', #endif