#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
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
# (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
-(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
*/
#include "misc.h"
-#include "fnlist.h"
#include <stdio.h>
#include <string.h>
}
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);
+++ /dev/null
-/*
- * 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_ */
+++ /dev/null
-/*
- * 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,},
-};
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) {
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;
#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);
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);
#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