]> git.cworth.org Git - ttt/blobdiff - src/ttt-error.c
2005-11-15 Carl Worth <cworth@cworth.org>
[ttt] / src / ttt-error.c
diff --git a/src/ttt-error.c b/src/ttt-error.c
new file mode 100644 (file)
index 0000000..26ab09d
--- /dev/null
@@ -0,0 +1,54 @@
+/* ttt-error.c - errors returned to clients
+ *
+ * Copyright © 2005 Carl Worth
+ *
+ * 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, 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.
+ *
+ * Author: Carl Worth <cworth@cworth.org>
+ */
+
+#include "ttt-error.h"
+
+const char *
+ttt_error_string (ttt_error_t error)
+{
+    switch (error) {
+    case TTT_ERROR_NONE:
+       return "ERROT NONE\n";
+    case TTT_ERROR_NONAMESET:
+       return "ERROR NONAMESET\n";
+    case TTT_ERROR_INVALIDNAME:
+       return "ERROR INVALIDNAME\n";
+    case TTT_ERROR_COMMAND:
+       return "ERROR COMMAND\n";
+    case TTT_ERROR_SYNTAX:
+       return "ERROR SYNTAX\n";
+    case TTT_ERROR_NOTNUMBER:
+       return "ERROR NOTNUMBER\n";
+    case TTT_ERROR_NOTGRID:
+       return "ERROR NOTGRID\n";
+    case TTT_ERROR_NOUSER:
+       return "ERROR NOUSER\n";
+    case TTT_ERROR_NOTINGAME:
+       return "ERROR_NOTINGAME\n";
+    case TTT_ERROR_NOTPLAYING:
+       return "ERROR_NOTPLAYING\n";
+    case TTT_ERROR_NOTYOURTURN:
+       return "ERROR NOTYOURTURN\n";
+    }
+
+    ASSERT_NOT_REACHED;
+    return NULL;
+}