-/* $NetBSD: stoc.c,v 1.3 1997/01/03 01:35:31 cgd Exp $ */
+/* $NetBSD: stoc.c,v 1.5 1999/09/08 21:17:50 jsm Exp $ */
/*
* Copyright (c) 1994
* SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)stoc.c 8.1 (Berkeley) 7/24/94";
#else
-static char rcsid[] = "$NetBSD: stoc.c,v 1.3 1997/01/03 01:35:31 cgd Exp $";
+__RCSID("$NetBSD: stoc.c,v 1.5 1999/09/08 21:17:50 jsm Exp $");
#endif
#endif /* not lint */
-#include "gomoku.h"
#include <ctype.h>
+#include <stdlib.h>
+#include "gomoku.h"
-char *letters = "<ABCDEFGHJKLMNOPQRST>";
+const char *letters = "<ABCDEFGHJKLMNOPQRST>";
struct mvstr {
int m_code;
- char *m_text;
+ const char *m_text;
};
-static struct mvstr mv[] = {
- RESIGN, "resign",
- RESIGN, "quit",
- SAVE, "save",
- -1, 0
+static const struct mvstr mv[] = {
+ { RESIGN, "resign" },
+ { RESIGN, "quit" },
+ { SAVE, "save" },
+ { -1, 0 }
};
/*
* Turn the spot number form of a move into the character form.
*/
-char *
+const char *
stoc(s)
int s;
{
static char buf[32];
- register int i;
+ int i;
for (i = 0; mv[i].m_code >= 0; i++)
if (s == mv[i].m_code)
/*
* Turn the character form of a move into the spot number form.
*/
+int
ctos(mp)
- char *mp;
+ const char *mp;
{
- register int i;
+ int i;
for (i = 0; mv[i].m_code >= 0; i++)
if (strcmp(mp, mv[i].m_text) == 0)
/*
* Turn a letter into a number.
*/
+int
lton(c)
int c;
{
- register int i;
+ int i;
if (islower(c))
c = toupper(c);