]> git.pond.sub.org Git - empserver/commitdiff
(sendcmd): Change argument cmd to string. Callers changed.
authorMarkus Armbruster <armbru@pond.sub.org>
Thu, 26 May 2005 13:18:58 +0000 (13:18 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Thu, 26 May 2005 13:18:58 +0000 (13:18 +0000)
(fnlist, fn, USER, COUN, QUIT, PASS, PLAY, LIST, CMD, CTLD, KILL):
Unused, remove.

include/proto.h
src/client/Makefile
src/client/Makefile.standalone
src/client/expect.c
src/client/fnlist.h [deleted file]
src/client/globals.c [deleted file]
src/client/login.c
src/client/misc.h
src/client/proto.h

index f4fca5c14ea445e6e8d46d1a19bcf3db03a7bafa..59f37468f70bf0807b1c9bf69e2e70b57644a5c2 100644 (file)
 
 #define CLIENTPROTO    2       /* if new things are added, bump this */
 
-#define        USER            0
-#define        COUN            1
-#define        QUIT            2
-#define        PASS            3
-#define        PLAY            4
-#define        LIST            5
-#define        CMD             6
-#define        CTLD            7
-#define KILL           8
-
 #define        C_CMDOK         0x0
 #define        C_DATA          0x1
 #define        C_INIT          0x2
index c33c127062a44f51bd587a86116fbbf7e6af2d77..9621f2fc9fb5e791e33fc3fba4539b81a1839795 100644 (file)
@@ -32,13 +32,13 @@ include ../../build.conf
 include ../make.src
 include ../make.defs
 
-CFILES = expect.c globals.c handle.c host.c \
+CFILES = expect.c handle.c host.c \
        ioqueue.c ipglob.c login.c main.c queue.c saveargv.c \
        servcmd.c serverio.c tags.c termio.c termlib.c
-OFILES = expect.o globals.o handle.o host.o \
+OFILES = expect.o handle.o host.o \
        ioqueue.o ipglob.o login.o main.o queue.o saveargv.o \
        servcmd.o serverio.o tags.o termio.o termlib.o
-OBJFILES = expect.obj globals.obj handle.obj host.obj \
+OBJFILES = expect.obj handle.obj host.obj \
        ioqueue.obj ipglob.obj login.obj main.obj queue.obj saveargv.obj \
        servcmd.obj serverio.obj tags.obj termio.obj termlib.obj
 
index 8ad519c213d3298067b7e580ebd586755f11d81a..bb9971afb096147dfe0ddbf98eafdd839cc5e99d 100644 (file)
 # (standalone mode)
 #
 
-CFILES = expect.c globals.c handle.c host.c \
+CFILES = expect.c handle.c host.c \
        ioqueue.c ipglob.c login.c main.c queue.c saveargv.c \
        servcmd.c serverio.c tags.c termio.c termlib.c
-OFILES = expect.o globals.o handle.o host.o \
+OFILES = expect.o handle.o host.o \
        ioqueue.o ipglob.o login.o main.o queue.o saveargv.o \
        servcmd.o serverio.o tags.o termio.o termlib.o
-OBJFILES = expect.obj globals.obj handle.obj host.obj \
+OBJFILES = expect.obj handle.obj host.obj \
        ioqueue.obj ipglob.obj login.obj main.obj queue.obj saveargv.obj \
        servcmd.obj serverio.obj tags.obj termio.obj termlib.obj
 
@@ -69,8 +69,7 @@ clean:
        -(del /q $(OBJFILES))
        -(del /q empire.exe)
 
-expect.o: misc.h fnlist.h
-globals.o: misc.h fnlist.h proto.h
+expect.o: misc.h
 handle.o: misc.h
 host.o: misc.h
 ioqueue.o: misc.h queue.h ioqueue.h
index cc51a966d8e067cc96c7c802ec823ed77d2bf4f3..6a82a8da306c60ab952cb90bca5b79da1233b6bd 100644 (file)
@@ -32,7 +32,6 @@
  */
 
 #include "misc.h"
-#include "fnlist.h"
 
 #include <stdio.h>
 #include <string.h>
@@ -140,13 +139,13 @@ expect(int s, int match, char *buf)
 }
 
 void
-sendcmd(int s, int cmd, char *arg)
+sendcmd(int s, char *cmd, char *arg)
 {
     char buf[128];
     int cc;
     int len;
 
-    (void)sprintf(buf, "%s %s\n", fnlist[cmd].name, arg != NULL ? arg : "");
+    (void)sprintf(buf, "%s %s\n", cmd, arg != NULL ? arg : "");
     len = strlen(buf);
 #ifndef _WIN32
     cc = write(s, buf, len);
diff --git a/src/client/fnlist.h b/src/client/fnlist.h
deleted file mode 100644 (file)
index c115562..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2005, 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.
- *
- *  ---
- *
- *  fnlist.h: function list structure
- * 
- *  Known contributors to this file:
- *     Dave Pare, 1986
- *     Steve McClure, 1998
- */
-
-#ifndef _FNLIST_H_
-#define _FNLIST_H_
-
-struct fn {
-    int (*func)(void);
-    char *name;
-    int value;
-};
-
-extern struct fn fnlist[];
-
-#endif /* _FNLIST_H_ */
diff --git a/src/client/globals.c b/src/client/globals.c
deleted file mode 100644 (file)
index 3e51818..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2005, 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.
- *
- *  ---
- *
- *  globals.c: Globals for the client
- * 
- *  Known contributors to this file:
- *     Dave Pare, 1986
- */
-
-#include <stdio.h>
-#include <setjmp.h>
-#include "misc.h"
-#include "fnlist.h"
-#include "proto.h"
-
-struct fn fnlist[] = {
-    {NULL, "user", USER,},
-    {NULL, "coun", COUN,},
-    {NULL, "quit", QUIT,},
-    {NULL, "pass", PASS,},
-    {NULL, "play", PLAY,},
-    {NULL, "list", LIST,},
-    {NULL, "cmd", CMD,},
-    {NULL, "ctld", CTLD,},
-    {NULL, "kill", KILL,},
-    {NULL, "", 0,},
-};
index 42fef09fab1fd590b8bb2eda8c344df8f307f5af..f888e06aca24e1df93101cf4e4955b8c8e3ae3bb 100644 (file)
@@ -54,7 +54,7 @@ login(int s, char *uname, char *cname, char *cpass, int kill_proc)
 
     if (!expect(s, C_INIT, buf))
        return 0;
-    (void)sendcmd(s, USER, uname);
+    (void)sendcmd(s, "user", uname);
     if (!expect(s, C_CMDOK, buf))
        return 0;
     if (cname == NULL) {
@@ -66,7 +66,7 @@ login(int s, char *uname, char *cname, char *cpass, int kill_proc)
     len = strlen(cname);
     if (cname[len-1] == '\n')
        cname[len-1] = 0;
-    (void)sendcmd(s, COUN, cname);
+    (void)sendcmd(s, "coun", cname);
     if (!expect(s, C_CMDOK, buf)) {
        (void)fprintf(stderr, "empire: no such country\n");
        return 0;
@@ -88,20 +88,20 @@ login(int s, char *uname, char *cname, char *cpass, int kill_proc)
 #endif
     }
     (void)printf("\n");
-    (void)sendcmd(s, PASS, cpass);
+    (void)sendcmd(s, "pass", cpass);
     memset(cpass, 0, strlen(cpass));   /* for core dumps */
     if (!expect(s, C_CMDOK, buf)) {
        (void)fprintf(stderr, "Bad password\n");
        return 0;
     }
     if (kill_proc) {
-       (void)sendcmd(s, KILL, NULL);
+       (void)sendcmd(s, "kill", NULL);
        (void)printf("\n\t-=O=-\n");
        (void)expect(s, C_EXIT, buf);
        fprintf(stderr, "%s\n", buf);
        return 0;
     }
-    (void)sendcmd(s, PLAY, NULL);
+    (void)sendcmd(s, "play", NULL);
     (void)printf("\n\t-=O=-\n");
     if (!expect(s, C_INIT, buf)) {
        fprintf(stderr, "%s\n", buf);
index 8df18e2777e84425f2a77422571f716cee632f21..c908e5596bc046452d199f1a51b7b776fa99a57f 100644 (file)
@@ -68,7 +68,7 @@ int hostconnect(struct sockaddr_in *addr);
 int hostport(char *name, struct sockaddr_in *addr);
 int login(int s, char *uname, char *cname, char *cpass, int kill_proc);
 void saveargv(int ac, char **src, char **dst);
-void sendcmd(int s, int cmd, char *arg);
+void sendcmd(int s, char *cmd, char *arg);
 int sendeof(int sock);
 void servercmd(struct ioqueue *ioq, FILE *auxfi);
 int serverio(int s, struct ioqueue *ioq);
index 89de5bfdcb525fc351b4bef4443b1565a3dff93b..aefc493f2c14b252d75e11fb79b7c4ccdccb9837 100644 (file)
 
 #define CLIENTPROTO    2       /* if new things are added, bump this */
 
-#define        USER            0
-#define        COUN            1
-#define        QUIT            2
-#define        PASS            3
-#define        PLAY            4
-#define        LIST            5
-#define        CMD             6
-#define        CTLD            7
-#define KILL           8
-
 #define        C_CMDOK         0x0
 #define        C_DATA          0x1
 #define        C_INIT          0x2