Index: main.c =================================================================== RCS file: /cvs/src/games/gomoku/main.c,v retrieving revision 1.21 diff -N -u -p main.c --- main.c 17 Mar 2008 09:17:56 -0000 1.21 +++ main.c 4 Jun 2009 01:37:44 -0000 @@ -81,9 +81,7 @@ char *plyr[2]; /* who's who */ static char you[MAXLOGNAME]; /* username */
int -main(argc, argv) - int argc; - char **argv; +main(int argc, char *argv[]) { char buf[128]; char fname[MAXPATHLEN]; @@ -162,7 +160,7 @@ again: if (inputfp == NULL && test == 0) { ask("black or white? "); while (((ch = getchar()) != 'b') && (ch != 'B') && - (ch != 'w') && (ch != 'W')) { + (ch != 'w') && (ch != 'W')) { move(BSZ3, 0); printw("Black moves first. Please enter `black' or `white'\n"); refresh(); @@ -217,7 +215,7 @@ again: } for (color = BLACK; ; color = !color) { - top: +top: switch (input[color]) { case INPUTF: /* input comes from a file */ curmove = readinput(inputfp); @@ -245,7 +243,7 @@ again: goto top; case USER: /* input comes from standard input */ - getinput: +getinput: if (interactive) { ask("Enter move (hjklyubn/S/Q)"); curmove = getcoord(); @@ -289,7 +287,7 @@ again: } if (interactive) { snprintf(fmtbuf, sizeof fmtbuf, - fmt[color], movenum, stoc(curmove)); + fmt[color], movenum, stoc(curmove)); logit(fmtbuf); } if ((i = makemove(color, curmove)) != MOVEOK) @@ -319,7 +317,7 @@ again: clrtoeol(); bdisp(); if (i != RESIGN) { - replay: +replay: ask("replay? "); if (getline(buf, sizeof(buf)) && (buf[0] == 'y' || buf[0] == 'Y')) @@ -335,7 +333,7 @@ again: } for (i = 0; i < movenum - 1; i++) fprintf(fp, "%s\n", - stoc(movelog[i])); + stoc(movelog[i])); fclose(fp); goto replay; } @@ -346,8 +344,7 @@ again: } int -readinput(fp) - FILE *fp; +readinput(FILE *fp) { char *cp; int c; @@ -364,8 +361,7 @@ readinput(fp) * Handle strange situations. */ void -whatsup(signum) - int signum; +whatsup(int signum) { int i, pnum, n, s1, s2, d1, d2; struct spotstr *sp; @@ -388,7 +384,7 @@ top: case 'd': /* set debug level */ debug = fmtbuf[1] - '0'; snprintf(fmtbuf, sizeof fmtbuf, - "Debug set to %d", debug); + "Debug set to %d", debug); dlog(fmtbuf); sleep(1); case 'c': @@ -403,8 +399,8 @@ top: case 's': /* suggest a move */ i = fmtbuf[1] == 'b' ? BLACK : WHITE; snprintf(fmtbuf, sizeof fmtbuf, - "suggest %c %s", i == BLACK ? 'B' : 'W', - stoc(pickmove(i))); + "suggest %c %s", i == BLACK ? 'B' : 'W', + stoc(pickmove(i))); dlog(fmtbuf); goto top; case 'f': /* go forward a move */ @@ -513,10 +509,8 @@ syntax: * Display debug info. */ void -dlog(str) - char *str; +dlog(char *str) { - if (debugfp) fprintf(debugfp, "%s\n", str); if (interactive) @@ -526,10 +520,8 @@ dlog(str) } void -logit(str) - char *str; +logit(char *str) { - if (debugfp) fprintf(debugfp, "%s\n", str); if (interactive) @@ -542,8 +534,7 @@ logit(str) * Deal with a fatal error. */ void -qlog(str) - char *str; +qlog(char *str) { dlog(str); if (interactive) @@ -554,8 +545,7 @@ qlog(str) /* ARGSUSED */ void -quit(sig) - int sig; +quit(int sig) { if (interactive) { bdisp(); /* show final board */ @@ -568,8 +558,7 @@ quit(sig) * Die gracefully. */ void -panic(str) - char *str; +panic(char *str) { fprintf(stderr, "%s: %s\n", prog, str); fputs("resign\n", stdout);