]> git.pond.sub.org Git - empserver/blobdiff - src/lib/player/dispatch.c
COPYING duplicates information from README. Remove. Move GPL from
[empserver] / src / lib / player / dispatch.c
index 3ee407c0b9d9729356eed211d67f6f8dfb23ea6a..8eb6e6f1975d289cc02504dd7f86b493425336e5 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  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
@@ -19,9 +19,9 @@
  *
  *  ---
  *
- *  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.
  *
  *  ---
  *
@@ -32,6 +32,8 @@
  *     Steve McClure, 1998
  */
 
+#include <config.h>
+
 #include "prototypes.h"
 #include "misc.h"
 #include "player.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");
@@ -89,7 +96,8 @@ dispatch(s_char *buf, s_char *redir)
     }
     if (redir) {
        prredir(redir);
-       pr("%s\n", buf);
+       uprnf(buf);
+       pr("\n");
     }
     player->command = command;
     switch (command->c_addr()) {