/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2006, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure
*
* This program is free software; you can redistribute it and/or modify
*
* ---
*
- * 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.
+ * See files README, COPYING and CREDITS in the root of the source
+ * tree for related information and legal notices. It is expected
+ * that future projects/authors will amend these files as needed.
*
* ---
*
* Steve McClure, 1998
*/
+#include <config.h>
+
#include "prototypes.h"
#include "misc.h"
#include "player.h"
#include "com.h"
-#include "user.h"
#include "match.h"
#include "nat.h"
#include "file.h"
#include "optlist.h"
#include "subs.h"
#include "common.h"
+#include "server.h"
+/*
+ * Execute command named by player->argp[0].
+ * BUF is the raw UTF-8 command line. It should have been passed to
+ * parse() to set up player->argp.
+ * If REDIR is not null, it's the command's redirection, in UTF-8.
+ * Return -1 if the command is not unique or doesn't exist, else 0.
+ */
int
-dispatch(s_char *buf, s_char *redir)
+dispatch(char *buf, char *redir)
{
- extern struct cmndstr player_coms[];
- extern int update_pending;
struct natstr *np;
struct cmndstr *command;
int cmd;
- cmd = comtch(player->argp[0], player_coms,
- player->ncomstat, player->god);
+ cmd = comtch(player->argp[0], player_coms, player->ncomstat);
if (cmd < 0) {
if (cmd == M_NOTUNIQUE)
- pr("\"%s\" is ambiguous -- ", buf);
+ pr("Command \"%s\" is ambiguous -- ", player->argp[0]);
else if (cmd == M_IGNORE)
return 0;
else {
- pr("\"%s\" is not a legal command ", buf);
+ pr("\"%s\" is not a legal command ", player->argp[0]);
if (player->nstat != player->ncomstat)
pr("now ");
pr("\n");
}
if (redir) {
prredir(redir);
- pr("%s\n", buf);
+ uprnf(buf);
+ pr("\n");
}
player->command = command;
switch (command->c_addr()) {