CLEANUP: Remove obsolete OS/arch code, assume modern POSIX, fix linker errors
authorRemco Rijnders <remmy@serenity-irc.net>
Sat, 7 Mar 2026 17:17:36 +0000 (12:17 -0500)
committerRemco Rijnders <remmy@serenity-irc.net>
Sat, 7 Mar 2026 17:17:36 +0000 (12:17 -0500)
Remove support for dead platforms (Apollo, ISC202, OSF/1, PCS/MUNIX,
Windows NT/95, DEC Alpha) and obsolete compatibility shims (K&R prototypes,
VOIDSIG, OPT_TYPE, valloc, sys_errlist, custom strtok/strerror/inet_netof).

Assume POSIX throughout: signals via sigaction, non-blocking via O_NONBLOCK,
standard headers (errno.h, unistd.h, stdlib.h, string.h, stdarg.h),
getrusage for resource stats, lrand48 for random numbers.

Fix pre-existing multiple-definition linker errors by changing bare global
declarations in headers (h.h, common.h) to extern and placing the actual
definitions in ircd.c.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
18 files changed:
include/class.h
include/common.h
include/config.h
include/dbuf.h
include/h.h
include/res.h
include/sock.h
include/sys.h
include/whowas.h
src/bsd.c
src/dbuf.c
src/ircd.c
src/res.c
src/s_bsd.c
src/s_debug.c
src/s_ping.c
src/s_serv.c
src/support.c

index 3adf622ff103cd628c666d65646a196a8243329a..5f6565fe112e63e928c232e55a0654b67770f102 100644 (file)
 #ifndef        __class_include__
 #define __class_include__
 
-#ifndef PROTO
-#if __STDC__
-#       define PROTO(x) x
-#else
-#       define PROTO(x) ()
-#endif
-#endif
-
 typedef struct Class {
        int     class;
        int     conFreq;
index c29c2ac0cdab20bda1edcc66aae041340226640c..21d2ad69a381932cfc8a0256ff1c99dbe400edb3 100644 (file)
 #include <time.h>
 #include "sys.h"
 
-#ifdef HAVE_PARAM_H
-#include <sys/param.h>
-#endif
-
-#ifndef PROTO
-#if __STDC__
-#      define PROTO(x) x
-#else
-#      define PROTO(x) ()
-#endif
-#endif
-
-#ifndef NULL
-#define NULL 0
-#endif
+#define PROTO(x) x
 
 #ifdef TRUE
 #undef TRUE
 extern int     match PROTO((char *, char *));
 extern  int    mycmp (char *, char *);
 
-#ifdef NEED_STRTOK
-extern char    *strtok PROTO((char *, char *));
-#endif
 #ifndef HAVE_STRTOKEN
 extern char    *strtoken PROTO((char **, char *, char *));
 #endif
-#ifndef HAVE_INET_ADDR
-extern unsigned long inet_addr PROTO((char *));
-#endif
-
-#if !defined(HAVE_INET_NTOA) || !defined(HAVE_INET_NETOF)
-#include <netinet/in.h>
-#endif
-
-#ifndef HAVE_INET_NTOA
-extern char *inet_ntoa PROTO((struct in_addr));
-#endif
-
-#ifndef HAVE_INET_NETOF
-extern int inet_netof PROTO((struct in_addr));
-#endif
 
-int global_count, max_global_count;
+extern int global_count, max_global_count;
 extern char *myctime PROTO((time_t));
 extern char *strtoken PROTO((char **, char *, char *));
 
@@ -166,6 +134,6 @@ extern int lu_noninv, lu_inv, lu_serv, lu_oper,
            lu_clu, lu_mlu, lu_cglobalu, lu_mglobalu;
            
 
-time_t now;
+extern time_t  now;
 
 #endif /* __common_include__ */
index 2bd1f29a7d4108903b3dbdb46781d66c26097033..c185042eaa3a38c3accc0753ebc22840290f00e1 100644 (file)
  
 #define MALLOC_FLAGS_EXTRA ""
 
-/* Many older Operating Systems are running with insecure TCP stacks.
- * This allows IP spoofing attacks, which are very difficult for
- * operators to track down and ban."
- *
- * If you have such an old OS you can enable it here but keep in mind that
- * this will be the least of your security problems. 
- *
- * Enable this option for any windows version older than 2000
- */
-
 #undef NOSPOOF
        
 
 #undef COMMENT_IS_FILE
 
 
-/* Do these work? I dunno... */
-
-/* #undef      PCS             *//* PCS Cadmus MUNIX, use with BSD flag! */
-
-/*
- * NOTE: On some systems, valloc() causes many problems.
- */
-#undef VALLOC                  /* Define this if you have valloc(3) */
-
-/*
- * read/write are restarted after signals defining this 1, gets
- * siginterrupt call compiled, which attempts to remove this
- * behaviour (apollo sr10.1/bsd4.3 needs this)
- */
-#ifdef APOLLO
-#define        RESTARTING_SYSTEMCALLS
-#endif
-
 /* #undef      DEBUGMODE       *//* define DEBUGMODE to enable debugging mode.*/
 //#define DEBUGMODE
 
  * 1 server = 1 connection, 1 user = 1 connection.
  * This should be at *least* 3: 1 listen port, 1 dns port + 1 client
  *
- * Note: this figure will be too high for most systems. If you get an 
+ * Note: this figure will be too high for most systems. If you get an
  * fd-related error on compile, change this to 256.
- *
- * Windows users: This should be a fairly high number.  Some operations
- * will slow down because of this, but it is _required_ because of the way
- * windows NT(and possibly 95) allocate fd handles. A good number is 16384.
  */
 #ifndef MAXCONNECTIONS
 #define MAXCONNECTIONS 1024
index 17acf8adca9e5b383b41de9bdae289a5ee653174..0aedc8c9353a9501c92fb991c73754626867f74c 100644 (file)
 #ifndef __dbuf_include__
 #define __dbuf_include__
 
-#ifndef PROTO
-#ifdef __STDC__
-#      define PROTO(x) x
-#else
-#      define PROTO(x) ()
-#endif /* __STDC__ */
-#endif /* ! PROTO */
-
 /*
 ** dbuf is a collection of functions which can be used to
 ** maintain a dynamic buffering of a byte stream.
index 58d76d92b89e26dfd757ba2abcb2243f24d04925..6c942ec44c01890e06ab4c47c75f0ace79ae0cef 100644 (file)
@@ -111,8 +111,8 @@ extern      int     initconf PROTO((int));
 extern void    add_temp_conf();
 extern void    inittoken PROTO(());
 extern  int     do_channel_synch(char *);
-int    synchmode;
-int    SVSNOOP;
+extern int     synchmode;
+extern int     SVSNOOP;
 extern void calc_mask(aClient *) ;
 char *return_host(aClient *, aClient *) ;
 char *return_oper_host(aClient *, aClient *) ;
@@ -323,6 +323,6 @@ extern void send_list(aClient *, int);
 extern void serv_info(aClient *, char *);    
 extern int str2array(char **, char *, char *);
 extern void CheckBandwidth(void);
-int max_connection_count, max_client_count;
-long max_sendqs,max_recvqs;
+extern int max_connection_count, max_client_count;
+extern long max_sendqs,max_recvqs;
 extern int find_services(void);
index 3d384fa74b7fce9fbde49a2272d5a7b84d26f263..85a5aa08b2c9dfb707144bff02e784db856a0e51 100644 (file)
@@ -30,11 +30,7 @@ typedef      struct  reslist {
        int     id;
        int     sent;   /* number of requests sent */
        int     srch;
-#ifdef  __alpha
-        u_int   ttl;                  /* time to live */
-#else
-        u_long  ttl;                  /* time to live */
-#endif
+        unsigned int ttl;             /* time to live */
        char    type;
        char    retries; /* retry counter */
        char    sends;  /* number of sends (>1 means resent) */
index dc0dbbf7165eb8597983240835e359fef75c1c7b..ad277e32517629075c0247bf5df33c70223da7f2 100644 (file)
  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-/*
- * Revision 1.1.1.1  1997/08/22 17:23:01  donwulff
- * Original import from the "deadlined" version.
- *
- * Revision 1.1.1.1  1996/11/18 07:53:41  explorer
- * ircd 4.3.3 -- about time
- *
- * Revision 1.1.1.1.4.1  1996/09/16 02:45:38  donwulff
- * *** empty log message ***
- *
- * Revision 6.1  1991/07/04  21:04:35  gruner
- * Revision 2.6.1 [released]
- *
- * Revision 6.0  1991/07/04  18:05:04  gruner
- * frozen beta revision 2.6.1
- *
- */
-
-#ifndef FD_ZERO
-#define FD_ZERO(set)      (((set)->fds_bits[0]) = 0)
-#define FD_SET(s1, set)   (((set)->fds_bits[0]) |= 1 << (s1))
-#define FD_ISSET(s1, set) (((set)->fds_bits[0]) & (1 << (s1)))
-#define FD_SETSIZE        30
-#endif
+#include <sys/select.h>
index 3fc2ff44ca3dbfaa76540f120484ae9eb40b3881..6d9133f97cecd364c673eb32a0b8ca45b423ed93 100644 (file)
  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#ifdef ISC202
-#include <net/errno.h>
-#else
-#include <sys/errno.h>
-#endif
+#include <errno.h>
 
 #include "setup.h"
 #include <stdio.h>
 #include <sys/types.h>
 #include <sys/param.h>
-
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
-#ifdef HAVE_STDLIB_H
 #include <stdlib.h>
-#endif
-
-#ifdef HAVE_STRINGS_H
 #include <strings.h>
-#endif
-
-#ifdef HAVE_STRING_H
-# include <string.h>
-#endif
-
-
-#ifndef HAVE_STRCASECMP
-#define        strcasecmp      mycmp
-#endif
-#ifndef HAVE_INDEX
-#define   index   strchr
-#define   rindex  strrchr
-#endif
-
-#ifndef HAVE_BZERO
-#define bzero(a,b)      memset(a,0,b)
-#define bcopy(a,b,c)    memcpy(b,a,c)
-#define bcmp    memcmp
-#endif
-
-#ifdef HAVE_GETRUSAGE_2
-#  define GETRUSAGE_2
-#else
-#  ifdef HAVE_TIMES_2
-#    define TIMES_2
-#   endif              /* HAVE_TIMES_2 */
-#endif                         /* GETRUSAGE_2 */
-
-#ifdef HAVE_POSIX_NBLOCK
-#  define NBLOCK_POSIX
-#else           /* HAVE_POSIX_NBLOCK */
-#  ifdef HAVE_BSD_NBLOCK 
-#    define NBLOCK_BSD
-#  else 
-#    define NBLOCK_SYSV
-#  endif               /* HAVE_BSD_NBLOCK */
-#endif                 /* HAVE_POSIX_NBLOCK */
-
-#ifdef HAVE_POSIX_SIGNALS
-#  define POSIX_SIGNALS
-#else
-#  ifdef HAVE_BSD_SIGNALS
-#    define BSD_RELIABLE_SIGNALS
-#  else
-#    define SYSV_UNRELIABLE_SIGNALS
-#  endif               /* HAVE_BSD_SIGNALS */
-#endif                 /* HAVE_POSIX_SIGNALS */
-
+#include <string.h>
 #include <sys/time.h>
+#include <stdarg.h>
+
+#define NBLOCK_POSIX
+#define POSIX_SIGNALS
 
 #if !defined(DEBUGMODE)
 #  define MyFree(x)    if ((x) != NULL) free(x)
 #define        free(x)         MyFree(x)
 #endif
 
-#define VOIDSIG void   /* whether signal() returns int of void */
-
-#define OPT_TYPE void  /* opt type for get/setsockopt */
-
-#ifdef  __osf__
-#  define OSF
-/* OSF defines BSD to be its version of BSD */
-#  undef BSD
-#  include <sys/param.h>
-#  ifndef BSD
-#    define BSD
-#  endif
-#endif
-
-#define dn_skipname  __dn_skipname
-
-extern VOIDSIG dummy();
+extern void    dummy();
 
 #ifndef u_char
 typedef        unsigned char   u_char;
@@ -119,9 +48,6 @@ typedef      unsigned long   u_long;
 typedef        unsigned int    u_int;
 #endif
 
-#ifdef USE_VARARGS
-#include <varargs.h>
-#endif
 #define MOTD MPATH
 #define LUSERS LUPATH
 #define OMOTD OMPATH
@@ -150,7 +76,7 @@ extern  void    debug();
  */
 
 #define MAXCLIENTS      (MAXCONNECTIONS-4)
-   
+
 #if defined(CLIENT_FLOOD)
 #  if   (CLIENT_FLOOD > 8000)
 #    define CLIENT_FLOOD 8000
index d0dbb7a520db7b430a4e0c607b77c7b11ccacf26..7c3059f7996aef1cbca7ea6fd1249796099d4318 100644 (file)
 #ifndef        __whowas_include__
 #define __whowas_include__
 
-#ifndef PROTO
-#if __STDC__
-#      define PROTO(x) x
-#else
-#      define PROTO(x) ()
-#endif /* __STDC__ */
-#endif /* ! PROTO */
-
 /*
 ** WHOWAS structure moved here from whowas.c
 */
index 199164883239c2580e7df8050b109686bd005b87..c6ee06960d948a0075e95ad4c5fd57498472005a 100644 (file)
--- a/src/bsd.c
+++ b/src/bsd.c
 #include <signal.h>
 #include <sys/socket.h>
 
-extern int errno;  /* ...seems that errno.h doesn't define this everywhere */
-#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__linux__) && !defined(__Darwin__)
-extern char *sys_errlist[];
-#endif
+extern int errno;
 
 #ifdef DEBUGMODE
 int writecalls = 0, writeb[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
 #endif
-VOIDSIG dummy ()
+void dummy ()
 {
-#ifndef HAVE_RELIABLE_SIGNALS
-    (void) signal (SIGALRM, dummy);
-    (void) signal (SIGPIPE, dummy);
-#ifdef SIGWINCH
-    (void) signal (SIGWINCH, dummy);
-#endif
-#else
-#ifdef POSIX_SIGNALS
     struct sigaction act;
 
     act.sa_handler = dummy;
@@ -61,8 +50,6 @@ VOIDSIG dummy ()
 #ifdef SIGWINCH
     (void) sigaction (SIGWINCH, &act, (struct sigaction *) NULL);
 #endif
-#endif
-#endif
 }
 
 
@@ -115,7 +102,6 @@ int deliver_it (cptr, str, len)
        ** all is Ok, if the 'write' just returns '0' instead of an
        ** error and errno=EWOULDBLOCK.
        **
-       ** ...now, would this work on VMS too? --msa
      */
     if (retval < 0 && (errno == EWOULDBLOCK || errno == EAGAIN ||
                       errno == ENOBUFS)) {
index cc6ee8b5925e75ad7bbc6cd593b751ecae2a67a7..12cf5159fa1626619b87faaf622d401638b36809 100644 (file)
 #include "sys.h"
 #include "h.h"
 
-#if !defined(VALLOC) && !defined(valloc)
-#define        valloc malloc
-#endif
-
 int dbufalloc = 0, dbufblocks = 0;
 static dbufbuf *freelist = NULL;
 
@@ -50,12 +46,7 @@ static dbufbuf *freelist = NULL;
  */
 static dbufbuf *dbuf_alloc ()
 {
-#if defined(VALLOC) && !defined(DEBUGMODE)
-    dbufbuf *dbptr, *db2ptr;
-    int num;
-#else
     dbufbuf *dbptr;
-#endif
 
     dbufalloc++;
     if ((dbptr = freelist)) {
@@ -66,32 +57,8 @@ static dbufbuf *dbuf_alloc ()
        dbufalloc--;
        return NULL;
     }
-#if defined(VALLOC) && !defined(DEBUGMODE)
-#if defined(_SC_PAGESIZE)
-    num = sysconf (_SC_PAGESIZE) / sizeof (dbufbuf);
-#else
-    num = getpagesize () / sizeof (dbufbuf);
-#endif
-    if (num < 0)
-       num = 1;
-
-    dbufblocks += num;
-
-    dbptr = (dbufbuf *) valloc (num * sizeof (dbufbuf));
-    if (!dbptr)
-       return (dbufbuf *) NULL;
-
-    num--;
-    for (db2ptr = dbptr; num; num--) {
-       db2ptr = (dbufbuf *) ((char *) db2ptr + sizeof (dbufbuf));
-       db2ptr->next = freelist;
-       freelist = db2ptr;
-    }
-    return dbptr;
-#else
     dbufblocks++;
     return (dbufbuf *) MyMalloc (sizeof (dbufbuf));
-#endif
 }
 
 /*
index 683f0dc27ac220cc61e6ce87900dfa1fb2396c06..432b0ae37730afd793013337fbd9d276e5f4d6a6 100644 (file)
@@ -42,6 +42,13 @@ char *malloc_options = "h" MALLOC_FLAGS_EXTRA;
 uint32_t NOSPOOF_SEED01, NOSPOOF_SEED02;
 #endif /* NOSPOOF */
 
+int global_count, max_global_count;
+time_t now;
+int synchmode;
+int SVSNOOP;
+int max_connection_count, max_client_count;
+long max_sendqs, max_recvqs;
+
 int R_do_dns, R_fin_dns, R_fin_dnsc, R_fail_dns, R_do_id, R_fin_id, R_fail_id;
 
 char REPORT_DO_DNS[128], REPORT_FIN_DNS[128], REPORT_FIN_DNSC[128],
@@ -52,7 +59,7 @@ aClient me;      /* That's me */
 aClient *client = &me; /* Pointer to beginning of Client list */
 
 void server_reboot (char *);
-void restart PROTO ((char *));
+void restart (char *);
 static void open_debugfile (), setup_signals ();
 void check_lusers (void);
 
@@ -84,32 +91,8 @@ char clonekillhost[100];
 int client_count = 0;  /* I guess -SJW */
 
 time_t NOW;
-#if    defined(PROFIL)
-extern etext ();
 
-VOIDSIG s_monitor ()
-{
-    static int mon = 0;
-#ifdef POSIX_SIGNALS
-    struct sigaction act;
-#endif
-
-    (void) moncontrol (mon);
-    mon = 1 - mon;
-#ifdef POSIX_SIGNALS
-    act.sa_handler = s_rehash;
-    act.sa_flags = 0;
-    (void) sigemptyset (&act.sa_mask);
-    (void) sigaddset (&act.sa_mask, SIGUSR1);
-    (void) sigaction (SIGUSR1, &act, NULL);
-#else
-    (void) signal (SIGUSR1, s_monitor);
-#endif
-}
-
-#endif
-
-VOIDSIG s_die ()
+void s_die ()
 {
 
     int fd;
@@ -128,21 +111,16 @@ VOIDSIG s_die ()
     exit (-1);
 }
 
-static VOIDSIG s_rehash ()
+static void s_rehash ()
 {
-#ifdef POSIX_SIGNALS
     struct sigaction act;
-#endif
+
     dorehash = 1;
-#ifdef POSIX_SIGNALS
     act.sa_handler = s_rehash;
     act.sa_flags = 0;
     (void) sigemptyset (&act.sa_mask);
     (void) sigaddset (&act.sa_mask, SIGHUP);
     (void) sigaction (SIGHUP, &act, NULL);
-#else
-    (void) signal (SIGHUP, s_rehash);  /* sysV -argv */
-#endif
 }
 
 void restart (mesg)
@@ -154,7 +132,7 @@ void restart (mesg)
     server_reboot (mesg);
 }
 
-VOIDSIG s_restart ()
+void s_restart ()
 {
     static int restarting = 0;
 
@@ -453,11 +431,6 @@ int main (argc, argv)
     sbrk0 = (char *) sbrk ((size_t) 0);
     uid = getuid ();
     euid = geteuid ();
-#ifdef PROFIL
-    (void) monstartup (0, etext);
-    (void) moncontrol (1);
-    (void) signal (SIGUSR1, s_monitor);
-#endif /* PROFIL */
 
     client_count = 0;
     global_count = 0;
@@ -858,7 +831,6 @@ static void open_debugfile ()
 
 static void setup_signals ()
 {
-#ifdef POSIX_SIGNALS
     struct sigaction act;
 
     act.sa_handler = SIG_IGN;
@@ -869,7 +841,7 @@ static void setup_signals ()
 #ifdef SIGWINCH
     (void) sigaddset (&act.sa_mask, SIGWINCH);
     (void) sigaction (SIGWINCH, &act, NULL);
-#endif /* SIGWINCH */
+#endif
     (void) sigaction (SIGPIPE, &act, NULL);
     act.sa_handler = dummy;
     (void) sigaction (SIGALRM, &act, NULL);
@@ -883,33 +855,6 @@ static void setup_signals ()
     act.sa_handler = s_die;
     (void) sigaddset (&act.sa_mask, SIGTERM);
     (void) sigaction (SIGTERM, &act, NULL);
-
-#else /* POSIX_SIGNALS */
-#ifndef        HAVE_RELIABLE_SIGNALS
-    (void) signal (SIGPIPE, dummy);
-#ifdef SIGWINCH
-    (void) signal (SIGWINCH, dummy);
-#endif
-#else
-#ifdef SIGWINCH
-    (void) signal (SIGWINCH, SIG_IGN);
-#endif
-    (void) signal (SIGPIPE, SIG_IGN);
-#endif
-    (void) signal (SIGALRM, dummy);
-    (void) signal (SIGHUP, s_rehash);
-    (void) signal (SIGTERM, s_die);
-    (void) signal (SIGINT, s_restart);
-#endif /* POSIX_SIGNALS */
-
-#ifdef RESTARTING_SYSTEMCALLS
-    /*
-       ** At least on Apollo sr10.1 it seems continuing system calls
-       ** after signal is the default. The following 'siginterrupt'
-       ** should change that default to interrupting calls.
-     */
-    (void) siginterrupt (SIGALRM, 1);
-#endif
 }
 
 
index 373360795e96970a16d7d7a96897c465cdea7ea8..ed46dc98ac5b90e10c31a073698075a4a3192572 100644 (file)
--- a/src/res.c
+++ b/src/res.c
@@ -81,9 +81,7 @@ int init_resolver (op)
 {
     int ret = 0;
 
-#ifdef HAVE_LRAND48
     srand48 (time (NULL));
-#endif
     if (op & RES_INITLIST) {
        bzero ((char *) &reinfo, sizeof (reinfo));
        first = last = NULL;
@@ -411,18 +409,8 @@ static int query_name (char *name, int class, int type, ResRQ *rptr)
        return r;
     }
     hptr = (HEADER *) buf;
-#ifdef HAVE_LRAND48
     do {
        hptr->id = htons (ntohs (hptr->id) + k + lrand48 () & 0xffff);
-#else
-    (void) gettimeofday (&tv, NULL);
-    do {
-       /* htons/ntohs can be assembler macros, which cannot
-          be nested. Thus two lines.   -Vesa           */
-       u_short nstmp =
-           ntohs (hptr->id) + k + (u_short) (tv.tv_usec & 0xffff);
-       hptr->id = htons (nstmp);
-#endif /* HAVE_LRAND48 */
        k++;
     }
     while (find_id (ntohs (hptr->id)));
index 43fd29dcebda61f17e38a130fa0db2b9c80129ba..85ee7f8deed6cb1f6ea64f8bac0acf3b14dec9c2 100644 (file)
@@ -138,7 +138,7 @@ void report_error (text, cptr)
 #ifdef SO_ERROR
     if (cptr && !IsMe (cptr) && cptr->fd >= 0)
        if (!getsockopt
-           (cptr->fd, SOL_SOCKET, SO_ERROR, (OPT_TYPE *) & err, &len))
+           (cptr->fd, SOL_SOCKET, SO_ERROR, (void *) & err, &len))
            if (err)
                errtmp = err;
 #endif
@@ -860,13 +860,13 @@ static void set_sock_opts (fd, cptr)
 #ifdef SO_REUSEADDR
     opt = 1;
     if (setsockopt
-       (fd, SOL_SOCKET, SO_REUSEADDR, (OPT_TYPE *) & opt, sizeof (opt)) < 0)
+       (fd, SOL_SOCKET, SO_REUSEADDR, (void *) & opt, sizeof (opt)) < 0)
        report_error ("setsockopt(SO_REUSEADDR) %s:%s", cptr);
 #endif
 #if defined(SO_USELOOPBACK)
     opt = 1;
     if (setsockopt
-       (fd, SOL_SOCKET, SO_USELOOPBACK, (OPT_TYPE *) & opt,
+       (fd, SOL_SOCKET, SO_USELOOPBACK, (void *) & opt,
         sizeof (opt)) < 0)
        report_error ("setsockopt(SO_USELOOPBACK) %s:%s", cptr);
 #endif
@@ -880,14 +880,14 @@ static void set_sock_opts (fd, cptr)
     else
        opt = 4096;
     if (setsockopt
-       (fd, SOL_SOCKET, SO_RCVBUF, (OPT_TYPE *) & opt, sizeof (opt))
+       (fd, SOL_SOCKET, SO_RCVBUF, (void *) & opt, sizeof (opt))
        < 0)
        report_error ("setsockopt(SO_RCVBUF) %s:%s", cptr);
 #endif
 #ifdef SO_SNDBUF
     opt = 8192;
     if (setsockopt
-       (fd, SOL_SOCKET, SO_SNDBUF, (OPT_TYPE *) & opt, sizeof (opt))
+       (fd, SOL_SOCKET, SO_SNDBUF, (void *) & opt, sizeof (opt))
        < 0)
        report_error ("setsockopt(SO_SNDBUF) %s:%s", cptr);
 #endif
@@ -896,7 +896,7 @@ static void set_sock_opts (fd, cptr)
        char *s = readbuf, *t = readbuf + sizeof (readbuf) / 2;
 
        opt = sizeof (readbuf) / 8;
-       if (getsockopt (fd, IPPROTO_IP, IP_OPTIONS, (OPT_TYPE *) t, &opt) < 0)
+       if (getsockopt (fd, IPPROTO_IP, IP_OPTIONS, (void *) t, &opt) < 0)
            report_error ("getsockopt(IP_OPTIONS) %s:%s", cptr);
        else if (opt > 0 && opt != sizeof (readbuf) / 8) {
            for (*readbuf = '\0'; opt > 0; opt--, s += 3)
@@ -905,7 +905,7 @@ static void set_sock_opts (fd, cptr)
            sendto_ops ("Connection %s using IP opts: (%s)",
                        get_client_name (cptr, TRUE), readbuf);
        }
-       if (setsockopt (fd, IPPROTO_IP, IP_OPTIONS, (OPT_TYPE *) NULL, 0) < 0)
+       if (setsockopt (fd, IPPROTO_IP, IP_OPTIONS, (void *) NULL, 0) < 0)
            report_error ("setsockopt(IP_OPTIONS) %s:%s", cptr);
     }
 #endif
@@ -919,7 +919,7 @@ int get_sockerr (cptr)
 #ifdef SO_ERROR
     if (cptr->fd >= 0)
        if (!getsockopt
-           (cptr->fd, SOL_SOCKET, SO_ERROR, (OPT_TYPE *) & err, &len))
+           (cptr->fd, SOL_SOCKET, SO_ERROR, (void *) & err, &len))
            if (err)
                errtmp = err;
 #endif
@@ -940,30 +940,12 @@ void set_non_blocking (fd, cptr)
 {
     int res, nonb = 0;
 
-    /*
-       ** NOTE: consult ALL your relevant manual pages *BEFORE* changing
-       **    these ioctl's.  There are quite a few variations on them,
-       **    as can be seen by the PCS one.  They are *NOT* all the same.
-       **    Heed this well. - Avalon.
-     */
-#ifdef NBLOCK_POSIX
     nonb |= O_NONBLOCK;
-#endif
-#ifdef NBLOCK_BSD
-    nonb |= O_NDELAY;
-#endif
-#ifdef NBLOCK_SYSV
-    /* This portion of code might also apply to NeXT.  -LynX */
-    res = 1;
 
-    if (ioctl (fd, FIONBIO, &res) < 0)
-       report_error ("ioctl(fd,FIONBIO) failed for %s:%s", cptr);
-#else
     if ((res = fcntl (fd, F_GETFL, 0)) == -1)
        report_error ("fcntl(fd, F_GETFL) failed for %s:%s", cptr);
     else if (fcntl (fd, F_SETFL, res | nonb) == -1)
        report_error ("fcntl(fd, F_SETL, nonb) failed for %s:%s", cptr);
-#endif
     return;
 }
 
@@ -1681,7 +1663,7 @@ int setup_ping ()
        return -1;
     }
     if (setsockopt (udpfd, SOL_SOCKET, SO_REUSEADDR,
-                   (OPT_TYPE *) & on, sizeof (on)) == -1) {
+                   (void *) & on, sizeof (on)) == -1) {
 #ifdef USE_SYSLOG
        syslog (LOG_ERR, "setsockopt udp fd %d : %m", udpfd);
 #endif
index 072a9afc2e4f54c582c612549aa7253f2e9e9a69..45ad583c5798a4efc26abf872d256ca8a3a23f17 100644 (file)
@@ -50,9 +50,6 @@ char serveropts[] = {
 #ifdef NOSPOOF
     'n',
 #endif
-#ifdef VALLOC
-    'V',
-#endif
 #ifdef USE_SYSLOG
     'Y',
 #endif
@@ -69,13 +66,7 @@ char serveropts[] = {
 #include "hash.h"
 #include <sys/file.h>
 #include <sys/param.h>
-#ifdef GETRUSAGE_2
 #include <sys/resource.h>
-#else
-#ifdef TIMES_2
-#include <sys/times.h>
-#endif
-#endif
 #include "h.h"
 
 #ifndef ssize_t
@@ -115,8 +106,6 @@ void send_usage (cptr, nick)
      aClient *cptr;
      char *nick;
 {
-
-#ifdef GETRUSAGE_2
     struct rusage rus;
     time_t secs, rup;
 #ifdef hz
@@ -130,11 +119,8 @@ void send_usage (cptr, nick)
 #endif
 
     if (getrusage (RUSAGE_SELF, &rus) == -1) {
-#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__linux__) && !defined(__Darwin__)
-       extern char *sys_errlist[];
-#endif
-       sendto_one (cptr, ":%s NOTICE %s :Getruseage error: %s.",
-                   me.name, nick, sys_errlist[errno]);
+       sendto_one (cptr, ":%s NOTICE %s :Getrusage error: %s.",
+                   me.name, nick, strerror (errno));
        return;
     }
     secs = rus.ru_utime.tv_sec + rus.ru_stime.tv_sec;
@@ -162,36 +148,6 @@ void send_usage (cptr, nick)
     sendto_one (cptr, ":%s %d %s :Signals %d Context Vol. %d Invol %d",
                me.name, RPL_STATSDEBUG, nick, rus.ru_nsignals, rus.ru_nvcsw,
                rus.ru_nivcsw);
-#else
-#ifdef TIMES_2
-    struct tms tmsbuf;
-    time_t secs, mins;
-    int hzz = 1, ticpermin;
-    int umin, smin, usec, ssec;
-
-    ticpermin = hzz * 60;
-
-    umin = tmsbuf.tms_utime / ticpermin;
-    usec = (tmsbuf.tms_utime % ticpermin) / (float) hzz;
-    smin = tmsbuf.tms_stime / ticpermin;
-    ssec = (tmsbuf.tms_stime % ticpermin) / (float) hzz;
-    secs = usec + ssec;
-    mins = (secs / 60) + umin + smin;
-    secs %= hzz;
-
-    if (times (&tmsbuf) == -1) {
-       sendto_one (cptr, ":%s %d %s :times(2) error: %s.",
-                   me.name, RPL_STATSDEBUG, nick, strerror (errno));
-       return;
-    }
-    secs = tmsbuf.tms_utime + tmsbuf.tms_stime;
-
-    sendto_one (cptr,
-               ":%s %d %s :CPU Secs %d:%d User %d:%d System %d:%d",
-               me.name, RPL_STATSDEBUG, nick, mins, secs, umin, usec,
-               smin, ssec);
-#endif
-#endif
     sendto_one (cptr, ":%s %d %s :Reads %d Writes %d",
                me.name, RPL_STATSDEBUG, nick, readcalls, writecalls);
     sendto_one (cptr, ":%s %d %s :DBUF alloc %d blocks %d",
index c32adfec733520d70f5b9b931dc0d377caac729c..08968c9a1f8d7c5e6fc70e2f88dc863c23f42c23 100644 (file)
@@ -381,9 +381,9 @@ int m_uping (cptr, sptr, parc, parv)
      */
     opt = 2048;
     if (setsockopt
-       (fd, SOL_SOCKET, SO_SNDBUF, (OPT_TYPE *) & opt, sizeof (opt))
+       (fd, SOL_SOCKET, SO_SNDBUF, (void *) & opt, sizeof (opt))
        < 0
-       || setsockopt (fd, SOL_SOCKET, SO_RCVBUF, (OPT_TYPE *) & opt,
+       || setsockopt (fd, SOL_SOCKET, SO_RCVBUF, (void *) & opt,
                       sizeof (opt)) < 0) {
        int err = errno;
        sendto_ops ("m_uping: setsockopt SO_SNDBUF|SO_RCVBUF: %s",
index 3dc9eed50360bc430d82069a3f808ac0ef437dfd..15cea35aad98d93d1d54e79def4eba6fac95f955 100644 (file)
@@ -38,7 +38,7 @@
 static void report_jinx (aClient * sptr);
 
 static char buf[BUFSIZE];
-VOIDSIG s_die ();
+void s_die ();
 /* I guess we can move this to somewhere else ... */
 
 /*
index 5cd31270617748c83e7e59b6f6cac6808a712e74..3755850a6a2f8029f91eff27d5da4b197aaa2380 100644 (file)
@@ -66,48 +66,6 @@ char *strtoken (save, str, fs)
 }
 #endif /* HAVE_STRTOKEN */
 
-#ifdef NEED_STRTOK
-/*
-   ** NOT encouraged to use!
- */
-
-char *strtok (str, fs)
-     char *str, *fs;
-{
-    static char *pos;
-
-    return strtoken (&pos, str, fs);
-}
-
-#endif /* NEED_STRTOK */
-
-#ifdef NEED_STRERROR
-/*
-   **   strerror - return an appropriate system error string to a given errno
-   **
-   **          argv 11/90
- */
-
-char *strerror (err_no)
-     int err_no;
-{
-    extern char *sys_errlist[];        /* Sigh... hopefully on all systems */
-    extern int sys_nerr;
-
-    static char buff[40];
-    char *errp;
-
-    errp = (err_no > sys_nerr ? (char *) NULL : sys_errlist[err_no]);
-
-    if (errp == (char *) NULL) {
-       errp = buff;
-       (void) sprintf (errp, "Unknown Error %d", err_no);
-    }
-    return errp;
-}
-
-#endif /* NEED_STRERROR */
-
 /*
    **   inetntoa  --    changed name to remove collision possibility and
    **           so behaviour is guaranteed to take a pointer arg.
@@ -130,27 +88,6 @@ char *inetntoa (in)
     return buf;
 }
 
-#ifndef HAVE_INET_NETOF
-/*
-   **   inet_netof --   return the net portion of an internet number
-   **           argv 11/90
- */
-
-int inet_netof (in)
-     struct in_addr in;
-{
-    int addr = in.s_net;
-
-    if (addr & 0x80 == 0)
-       return ((int) in.s_net);
-
-    if (addr & 0x40 == 0)
-       return ((int) in.s_net * 256 + in.s_host);
-
-    return ((int) in.s_net * 256 + in.s_host * 256 + in.s_lh);
-}
-
-#endif /* HAVE_INET_NETOF */
 
 
 #ifdef DEBUGMODE