diff options
Diffstat (limited to 'gomoku')
| -rw-r--r-- | gomoku/bdisp.c | 12 | ||||
| -rw-r--r-- | gomoku/gomoku.h | 24 | ||||
| -rw-r--r-- | gomoku/main.c | 16 | ||||
| -rw-r--r-- | gomoku/makemove.c | 8 | ||||
| -rw-r--r-- | gomoku/pickmove.c | 8 | ||||
| -rw-r--r-- | gomoku/stoc.c | 14 |
6 files changed, 40 insertions, 42 deletions
diff --git a/gomoku/bdisp.c b/gomoku/bdisp.c index b530f32a..becce6b7 100644 --- a/gomoku/bdisp.c +++ b/gomoku/bdisp.c @@ -1,4 +1,4 @@ -/* $NetBSD: bdisp.c,v 1.5 1997/10/10 13:36:02 lukem Exp $ */ +/* $NetBSD: bdisp.c,v 1.6 1999/09/08 21:17:49 jsm Exp $ */ /* * Copyright (c) 1994 @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)bdisp.c 8.2 (Berkeley) 5/3/95"; #else -__RCSID("$NetBSD: bdisp.c,v 1.5 1997/10/10 13:36:02 lukem Exp $"); +__RCSID("$NetBSD: bdisp.c,v 1.6 1999/09/08 21:17:49 jsm Exp $"); #endif #endif /* not lint */ @@ -211,17 +211,15 @@ bdump(fp) */ void dislog(str) - char *str; + const char *str; { if (++lastline >= SCRNH - 1) { /* move 'em up */ lastline = 1; } - if (strlen(str) >= SCRNW - 46) - str[SCRNW - 46 - 1] = '\0'; move(lastline, 46); - addstr(str); + addnstr(str, SCRNW - 46 - 1); clrtoeol(); move(lastline + 1, 46); clrtoeol(); @@ -233,7 +231,7 @@ dislog(str) void ask(str) - char *str; + const char *str; { int len = strlen(str); diff --git a/gomoku/gomoku.h b/gomoku/gomoku.h index 9f304f80..84ccd471 100644 --- a/gomoku/gomoku.h +++ b/gomoku/gomoku.h @@ -1,4 +1,4 @@ -/* $NetBSD: gomoku.h,v 1.5 1998/09/13 15:27:28 hubertf Exp $ */ +/* $NetBSD: gomoku.h,v 1.6 1999/09/08 21:17:49 jsm Exp $ */ /* * Copyright (c) 1994 @@ -248,11 +248,11 @@ struct ovlp_info { u_char o_frameindex; /* intersection frame index */ }; -extern char *letters; +extern const char *letters; extern char fmtbuf[]; -extern char pdir[]; +extern const char pdir[]; -extern int dd[4]; +extern const int dd[4]; extern struct spotstr board[BAREA]; /* info for board */ extern struct combostr frames[FAREA]; /* storage for single frames */ extern struct combostr *sortframes[2]; /* sorted, non-empty frames */ @@ -267,24 +267,24 @@ extern int debug; void bdinit __P((struct spotstr *)); void init_overlap __P((void)); int getline __P((char *, int)); -void ask __P((char *)); -void dislog __P((char *)); +void ask __P((const char *)); +void dislog __P((const char *)); void bdump __P((FILE *)); void bdisp __P((void)); void bdisp_init __P((void)); void cursfini __P((void)); void cursinit __P((void)); void bdwho __P((int)); -void panic __P((char *)) __attribute__((__noreturn__)); -void log __P((char *)); -void dlog __P((char *)); +void panic __P((const char *)) __attribute__((__noreturn__)); +void log __P((const char *)); +void dlog __P((const char *)); void quit __P((void)) __attribute__((__noreturn__)); void quitsig __P((int)) __attribute__((__noreturn__)); void whatsup __P((int)); int readinput __P((FILE *)); -char *stoc __P((int)); +const char *stoc __P((int)); int lton __P((int)); -int ctos __P((char *)); +int ctos __P((const char *)); void update_overlap __P((struct spotstr *)); int makemove __P((int, int)); int list_eq __P((struct combostr **, struct combostr **, int)); @@ -301,5 +301,5 @@ int checkframes __P((struct combostr *, struct combostr *, struct spotstr *, int, struct ovlp_info *)); void addframes __P((int)); void scanframes __P((int)); -int better __P((struct spotstr *, struct spotstr *, int)); +int better __P((const struct spotstr *, const struct spotstr *, int)); int pickmove __P((int)); diff --git a/gomoku/main.c b/gomoku/main.c index 301812c2..5674fb99 100644 --- a/gomoku/main.c +++ b/gomoku/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.5 1998/02/03 05:40:45 perry Exp $ */ +/* $NetBSD: main.c,v 1.6 1999/09/08 21:17:49 jsm Exp $ */ /* * Copyright (c) 1994 @@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1994\n\ #if 0 static char sccsid[] = "@(#)main.c 8.4 (Berkeley) 5/4/95"; #else -__RCSID("$NetBSD: main.c,v 1.5 1998/02/03 05:40:45 perry Exp $"); +__RCSID("$NetBSD: main.c,v 1.6 1999/09/08 21:17:49 jsm Exp $"); #endif #endif /* not lint */ @@ -71,7 +71,7 @@ char *prog; /* name of program */ FILE *debugfp; /* file for debug output */ FILE *inputfp; /* file for debug input */ -char pdir[4] = "-\\|/"; +const char pdir[4] = "-\\|/"; char fmtbuf[128]; struct spotstr board[BAREA]; /* info for board */ @@ -81,7 +81,7 @@ u_char overlap[FAREA * FAREA]; /* true if frame [a][b] overlap */ short intersect[FAREA * FAREA]; /* frame [a][b] intersection */ int movelog[BSZ * BSZ]; /* log of all the moves */ int movenum; /* current move number */ -char *plyr[2]; /* who's who */ +const char *plyr[2]; /* who's who */ int main __P((int, char *[])); @@ -93,7 +93,7 @@ main(argc, argv) char buf[128]; int color, curmove, i, ch; int input[2]; - static char *fmt[2] = { + static const char *const fmt[2] = { "%3d %-6s", "%3d %-6s" }; @@ -497,7 +497,7 @@ syntax: */ void dlog(str) - char *str; + const char *str; { if (debugfp) @@ -510,7 +510,7 @@ dlog(str) void log(str) - char *str; + const char *str; { if (debugfp) @@ -543,7 +543,7 @@ quitsig(dummy) */ void panic(str) - char *str; + const char *str; { fprintf(stderr, "%s: %s\n", prog, str); fputs("resign\n", stdout); diff --git a/gomoku/makemove.c b/gomoku/makemove.c index ca270068..4b23ba9c 100644 --- a/gomoku/makemove.c +++ b/gomoku/makemove.c @@ -1,4 +1,4 @@ -/* $NetBSD: makemove.c,v 1.4 1997/10/10 13:36:05 lukem Exp $ */ +/* $NetBSD: makemove.c,v 1.5 1999/09/08 21:17:49 jsm Exp $ */ /* * Copyright (c) 1994 @@ -41,18 +41,18 @@ #if 0 static char sccsid[] = "@(#)makemove.c 8.2 (Berkeley) 5/3/95"; #else -__RCSID("$NetBSD: makemove.c,v 1.4 1997/10/10 13:36:05 lukem Exp $"); +__RCSID("$NetBSD: makemove.c,v 1.5 1999/09/08 21:17:49 jsm Exp $"); #endif #endif /* not lint */ #include "gomoku.h" /* direction deltas */ -int dd[4] = { +const int dd[4] = { MRIGHT, MRIGHT+MDOWN, MDOWN, MDOWN+MLEFT }; -int weight[5] = { 0, 1, 7, 22, 100 }; +const int weight[5] = { 0, 1, 7, 22, 100 }; /* * Return values: diff --git a/gomoku/pickmove.c b/gomoku/pickmove.c index 4a762927..1ddf29bf 100644 --- a/gomoku/pickmove.c +++ b/gomoku/pickmove.c @@ -1,4 +1,4 @@ -/* $NetBSD: pickmove.c,v 1.5 1997/10/10 13:36:06 lukem Exp $ */ +/* $NetBSD: pickmove.c,v 1.6 1999/09/08 21:17:49 jsm Exp $ */ /* * Copyright (c) 1994 @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)pickmove.c 8.2 (Berkeley) 5/3/95"; #else -__RCSID("$NetBSD: pickmove.c,v 1.5 1997/10/10 13:36:06 lukem Exp $"); +__RCSID("$NetBSD: pickmove.c,v 1.6 1999/09/08 21:17:49 jsm Exp $"); #endif #endif /* not lint */ @@ -171,8 +171,8 @@ pickmove(us) */ int better(sp, sp1, us) - struct spotstr *sp; - struct spotstr *sp1; + const struct spotstr *sp; + const struct spotstr *sp1; int us; { int them, s, s1; diff --git a/gomoku/stoc.c b/gomoku/stoc.c index c5d62e94..ccfd164a 100644 --- a/gomoku/stoc.c +++ b/gomoku/stoc.c @@ -1,4 +1,4 @@ -/* $NetBSD: stoc.c,v 1.4 1997/10/10 13:36:07 lukem Exp $ */ +/* $NetBSD: stoc.c,v 1.5 1999/09/08 21:17:50 jsm Exp $ */ /* * Copyright (c) 1994 @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)stoc.c 8.1 (Berkeley) 7/24/94"; #else -__RCSID("$NetBSD: stoc.c,v 1.4 1997/10/10 13:36:07 lukem Exp $"); +__RCSID("$NetBSD: stoc.c,v 1.5 1999/09/08 21:17:50 jsm Exp $"); #endif #endif /* not lint */ @@ -49,13 +49,13 @@ __RCSID("$NetBSD: stoc.c,v 1.4 1997/10/10 13:36:07 lukem Exp $"); #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[] = { +static const struct mvstr mv[] = { { RESIGN, "resign" }, { RESIGN, "quit" }, { SAVE, "save" }, @@ -65,7 +65,7 @@ static struct mvstr mv[] = { /* * Turn the spot number form of a move into the character form. */ -char * +const char * stoc(s) int s; { @@ -84,7 +84,7 @@ stoc(s) */ int ctos(mp) - char *mp; + const char *mp; { int i; |
