]> git.pond.sub.org Git - empserver/commitdiff
(copy, atopi, same): Remove, use strcpy(), atoi(), strcmp(). Callers
authorMarkus Armbruster <armbru@pond.sub.org>
Thu, 8 Jan 2004 10:20:44 +0000 (10:20 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Thu, 8 Jan 2004 10:20:44 +0000 (10:20 +0000)
changed.  Remove empty source files.

include/misc.h
include/prototypes.h
src/client/misc.h
src/lib/commands/chan.c
src/lib/commands/offe.c
src/lib/gen/Makefile
src/lib/gen/atopi.c [deleted file]
src/lib/gen/copy.c
src/lib/gen/same.c [deleted file]
src/lib/gen/vsprintf.c [deleted file]
src/lib/player/empdis.c

index 032eb45ea381c5de1feb6bd7c9a5bdd86bb3f331..b6fb7000ebc2596fa074e4413358ea1124225f5e 100644 (file)
@@ -149,7 +149,6 @@ extern long random();
 double dmax _PROTO((double n1, double n2));
 double dmin _PROTO((double n1, double n2));
 
-extern s_char *copy _PROTO((s_char *s1, s_char *s2));
 extern s_char *numstr _PROTO((s_char buf[], int n));
 extern s_char *esplur _PROTO((int n));
 extern s_char *splur _PROTO((int n));
index 9c3a86d58da19ec5fb5e3a704eaf4500e519bc4e..cbd7ef39f00ee324f2dc32a421f5e00dd80fe7c4 100644 (file)
@@ -410,11 +410,9 @@ extern int emp_config(char *file);
 extern void print_config(FILE * fp);
 
 extern int atoip(s_char **);
-extern int atopi(s_char *);
 extern int roll(int);
 extern int roundavg(double);
 extern int chance(double);
-extern s_char *copy(register s_char *, register s_char *);
 extern void disassoc(void);
 extern int getfdtablesize(void);
 extern void setfdtablesize(int, int);
@@ -447,7 +445,6 @@ extern s_char *iesplur(int);
 extern s_char *plur(int, s_char *, s_char *);
 extern int ldround(double, int);
 extern int roundintby(int, int);
-extern int same(register s_char *, register s_char *);
 extern int scthash(register int, register int, int);
 #ifdef NOSTRDUP
 extern char *strdup(char *x);
index fac701776f5ea9568e45a725a10702091e8b5e7d..e54dc81ef3447dbe4b97308de14d9049651c51b9 100644 (file)
@@ -102,7 +102,6 @@ extern double dmax();
 extern double dmin();
 
 extern s_char *fmt();
-extern s_char *copy();
 extern s_char *numstr();
 extern s_char *esplur();
 extern s_char *splur();
index b9d610809c126ddc90969c5697dd5ca839484716..cc6744edbf0148febef7fca503c0f114647e6380 100644 (file)
@@ -90,7 +90,7 @@ chan(void)
            return RET_SYN;
        p[sizeof(us->nat_cnam) - 1] = 0;
        for (cn = 0; NULL != (natp = getnatp(cn)); cn++) {
-           if (same(p, natp->nat_cnam)) {
+           if (!strcmp(p, natp->nat_cnam)) {
                pr("Country #%d is already called `%s'!\n", cn, p);
                return RET_FAIL;
            }
index 72e0291c53101403bef927b99883a084d09a71da..12c6f5ec4801911ffea45e935f34ee2cc7e52adc 100644 (file)
@@ -128,8 +128,8 @@ do_treaty(void)
     cp = getstring("Proposed treaty duration? (days) ", buf);
     if (cp == 0)
        return RET_FAIL;
-    j = atopi(cp);
-    if (j == 0) {
+    j = atoi(cp);
+    if (j <= 0) {
        pr("Bad treaty duration.\n");
        return RET_SYN;
     }
index cb972b407d52a6ba53e5da9910b0cc5c3dc610f0..443935a67d48f785d14790d0ceb649f7f9b7544f 100644 (file)
@@ -35,17 +35,17 @@ include ../../make.defs
 LIB = $(SRCDIR)/lib/libgen.a
 NTLIB = $(SRCDIR)\lib\libgen.lib
 
-OBJS =  atoip.o atopi.o bit.o chance.o copy.o disassoc.o dtable.o \
+OBJS =  atoip.o bit.o chance.o copy.o disassoc.o dtable.o \
        emp_config.o getstarg.o getstring.o hpux.o inet.o io.o \
        io_mask.o ioqueue.o lock.o mapdist.o minmax.o numstr.o onearg.o \
-       parse.o plur.o queue.o round.o same.o scthash.o \
-       strdup.o vsprintf.o
+       parse.o plur.o queue.o round.o scthash.o \
+       strdup.o
 
-NTOBJS = atoip.obj atopi.obj bit.obj chance.obj copy.obj disassoc.obj \
-       dtable.obj emp_config.obj getstarg.obj getstring.obj hpux.obj \
+NTOBJS = atoip.obj bit.obj chance.obj copy.obj disassoc.obj dtable.obj \
+       emp_config.obj getstarg.obj getstring.obj hpux.obj \
        inet.obj io.obj io_mask.obj ioqueue.obj lock.obj mapdist.obj minmax.obj \
-       numstr.obj onearg.obj parse.obj plur.obj queue.obj round.obj same.obj \
-       scthash.obj strdup.obj vsprintf.obj
+       numstr.obj onearg.obj parse.obj plur.obj queue.obj round.obj \
+       scthash.obj strdup.obj
 
 all: $(LIB)
 
diff --git a/src/lib/gen/atopi.c b/src/lib/gen/atopi.c
deleted file mode 100644 (file)
index d3d8be4..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak,
- *                           Ken Stevens, Steve McClure
- *
- *  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 2 of the License, 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- *  ---
- *
- *  See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
- *  related information and legal notices. It is expected that any future
- *  projects/authors will amend these files as needed.
- *
- *  ---
- *
- *  atopi.c: Return positive integer from string.
- * 
- *  Known contributors to this file:
- *     
- */
-
-#include "gen.h"
-
-/*
- * atopi.c
- *
- * from PSL Empire, 1985
- */
-
-int
-atopi(s_char *p)
-{
-    register int r11;
-
-    if (p) {
-       r11 = atoi(p);
-       if (r11 < 0)
-           r11 = -r11;
-       return r11;
-    } else {
-       return (0);
-    }
-}
index e49450ecba7404054af679a22f185703952cef21..38c1f1fffd6d0ecd3b0dd21a8a66d795c2b52a2c 100644 (file)
 #include "gen.h"
 #include "optlist.h"
 
-s_char *
-copy(register s_char *s1, register s_char *s2)
-{
-    while ((*s2++ = *s1++) != 0) ;
-    return s2 - 1;
-}
-
 #ifdef hpux
 #include <memory.h>
 
diff --git a/src/lib/gen/same.c b/src/lib/gen/same.c
deleted file mode 100644 (file)
index 3db1b4b..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak,
- *                           Ken Stevens, Steve McClure
- *
- *  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 2 of the License, 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- *  ---
- *
- *  See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
- *  related information and legal notices. It is expected that any future
- *  projects/authors will amend these files as needed.
- *
- *  ---
- *
- *  same.c: Return true if strings are the same
- * 
- *  Known contributors to this file:
- *     
- */
-
-#include "misc.h"
-#include "gen.h"
-
-int
-same(register s_char *s1, register s_char *s2)
-{
-    while (*s1 == *s2++) {
-       if (*s1++ == 0)
-           return 1;
-    }
-    return 0;
-}
diff --git a/src/lib/gen/vsprintf.c b/src/lib/gen/vsprintf.c
deleted file mode 100644 (file)
index b7f7a0f..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-#if !defined(_WIN32)
-#ifndef __STDC__
-
-/* Portable vsprintf  by Robert A. Larson <blarson@skat.usc.edu> */
-
-/* Copyright 1989 Robert A. Larson.
- * Distribution in any form is allowed as long as the author
- * retains credit, changes are noted by their author and the
- * copyright message remains intact.  This program comes as-is
- * with no warentee of fitness for any purpouse.
- *
- * Thanks to Doug Gwen, Chris Torek, and others who helped clarify
- * the ansi printf specs.
- *
- * Please send any bug fixes and improvments to blarson@skat.usc.edu .
- * The use of goto is NOT a bug.
- */
-
-/* Feb 7, 1989         blarson         First usenet release */
-
-/* This code implements the vsprintf function, without relying on
- * the existance of _doprint or other system specific code.
- *
- * Define NOVOID if void * is not a supported type.
- *
- * Two compile options are available for efficency:
- *     INTSPRINTF      should be defined if sprintf is int and returns
- *                     the number of chacters formated.
- *     LONGINT         should be defined if sizeof(long) == sizeof(int)
- *
- *     They only make the code smaller and faster, they need not be
- *     defined.
- *
- * UNSIGNEDSPECIAL should be defined if unsigned is treated differently
- * than int in argument passing.  If this is definded, and LONGINT is not,
- * the compiler must support the type unsingned long.
- *
- * Most quirks and bugs of the available sprintf fuction are duplicated,
- * however * in the width and precision fields will work correctly
- * even if sprintf does not support this, as will the n format.
- *
- * Bad format strings, or those with very long width and precision
- * fields (including expanded * fields) will cause undesired results.
- */
-#include "misc.h"
-#include "gen.h"
-
-#ifdef OSK                     /* os9/68k can take advantage of both */
-#define LONGINT
-#define INTSPRINTF
-#endif
-
-#define NOVOID
-
-/* This must be a typedef not a #define! */
-#ifdef NOVOID
-typedef s_char *pointer;
-#else
-typedef void *pointer;
-#endif
-
-#ifdef INTSPRINTF
-#define Sprintf(string,format,arg)     (sprintf((string),(format),(arg)))
-#else
-#define Sprintf(string,format,arg)     (\
-       sprintf((string),(format),(arg)),\
-       strlen(string)\
-)
-#endif
-
-#include <stdarg.h>
-
-typedef int *intp;
-
-int
-vsprintf(dest, format, args)
-s_char *dest;
-register s_char *format;
-va_list args;
-{
-    register s_char *dp = dest;
-    register s_char c;
-    register s_char *tp;
-    s_char tempfmt[64];
-#ifndef LONGINT
-    int longflag;
-#endif
-
-    tempfmt[0] = '%';
-    while (c = *format++) {
-       if (c == '%') {
-           tp = &tempfmt[1];
-#ifndef LONGINT
-           longflag = 0;
-#endif
-         continue_format:
-           switch (c = *format++) {
-           case 's':
-               *tp++ = c;
-               *tp = '\0';
-               dp += Sprintf(dp, tempfmt, va_arg(args, s_char *));
-               break;
-           case 'u':
-           case 'x':
-           case 'o':
-           case 'X':
-#ifdef UNSIGNEDSPECIAL
-               *tp++ = c;
-               *tp = '\0';
-#ifndef LONGINT
-               if (longflag)
-                   dp +=
-                       Sprintf(dp, tempfmt, va_arg(args, unsigned long));
-               else
-#endif
-                   dp += Sprintf(dp, tempfmt, va_arg(args, unsigned));
-               break;
-#endif
-           case 'd':
-           case 'c':
-           case 'i':
-               *tp++ = c;
-               *tp = '\0';
-#ifndef LONGINT
-               if (longflag)
-                   dp += Sprintf(dp, tempfmt, va_arg(args, long));
-               else
-#endif
-                   dp += Sprintf(dp, tempfmt, va_arg(args, int));
-               break;
-           case 'f':
-           case 'e':
-           case 'E':
-           case 'g':
-           case 'G':
-               *tp++ = c;
-               *tp = '\0';
-               dp += Sprintf(dp, tempfmt, va_arg(args, double));
-               break;
-           case 'p':
-               *tp++ = c;
-               *tp = '\0';
-               dp += Sprintf(dp, tempfmt, va_arg(args, pointer));
-               break;
-           case '-':
-           case '+':
-           case '0':
-           case '1':
-           case '2':
-           case '3':
-           case '4':
-           case '5':
-           case '6':
-           case '7':
-           case '8':
-           case '9':
-           case '.':
-           case ' ':
-           case '#':
-           case 'h':
-               *tp++ = c;
-               goto continue_format;
-           case 'l':
-#ifndef LONGINT
-               longflag = 1;
-               *tp++ = c;
-#endif
-               goto continue_format;
-           case '*':
-               tp += Sprintf(tp, "%d", va_arg(args, int));
-               goto continue_format;
-           case 'n':
-               *va_arg(args, intp) = dp - dest;
-               break;
-           case '%':
-           default:
-               *dp++ = c;
-               break;
-           }
-       } else
-           *dp++ = c;
-    }
-    *dp = '\0';
-    return dp - dest;
-}
-
-#endif /* __STDC__ */
-#endif
index 5c9da90b8a267782c5ebd6023163c9f91fa0b30c..858dc9382a29d4ccacf49177954f503cb044565c 100644 (file)
@@ -84,7 +84,7 @@ getcommand(s_char *combufp)
        player_commands_index = 0;
     sprintf(player_commands[player_commands_index], "%3d %3d %s",
            player_commands_index, player->cnum, buf);
-    copy(buf, combufp);
+    strcpy(combufp, buf);
     return (strlen(combufp));
 }