uid when debugging code turned on
SCCS-vsn: games/mille/move.c 5.2
/*
* Copyright (c) 1983 Regents of the University of California.
/*
* Copyright (c) 1983 Regents of the University of California.
- * All rights reserved. The Berkeley software License Agreement
- * specifies the terms and conditions for redistribution.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that this notice is preserved and that due credit is given
+ * to the University of California at Berkeley. The name of the University
+ * may not be used to endorse or promote products derived from this
+ * software without specific prior written permission. This software
+ * is provided ``as is'' without express or implied warranty.
-static char sccsid[] = "@(#)move.c 5.1 (Berkeley) %G%";
-#endif not lint
+static char sccsid[] = "@(#)move.c 5.2 (Berkeley) %G%";
+#endif /* not lint */
#include "mille.h"
#ifndef unctrl
#include "mille.h"
#ifndef unctrl
error("already picked");
else {
pp->hand[0] = *--Topcard;
error("already picked");
else {
pp->hand[0] = *--Topcard;
if (Debug)
fprintf(outf, "DOMOVE: Draw %s\n", C_name[*Topcard]);
if (Debug)
fprintf(outf, "DOMOVE: Draw %s\n", C_name[*Topcard]);
acc:
if (Play == COMP) {
account(*Topcard);
acc:
if (Play == COMP) {
account(*Topcard);
if (pp->hand[1] == C_INIT && Topcard > Deck) {
Card_no = 1;
pp->hand[1] = *--Topcard;
if (pp->hand[1] == C_INIT && Topcard > Deck) {
Card_no = 1;
pp->hand[1] = *--Topcard;
if (Debug)
fprintf(outf, "DOMOVE: Draw %s\n", C_name[*Topcard]);
if (Debug)
fprintf(outf, "DOMOVE: Draw %s\n", C_name[*Topcard]);
goto acc;
}
pp->new_battle = FALSE;
goto acc;
}
pp->new_battle = FALSE;
for (i = 0; i < HAND_SZ; i++) {
card = pp->hand[i];
if (issafety(card) || canplay(pp, op, card)) {
for (i = 0; i < HAND_SZ; i++) {
card = pp->hand[i];
if (issafety(card) || canplay(pp, op, card)) {
if (Debug) {
fprintf(outf, "CHECK_GO: can play %s (%d), ", C_name[card], card);
fprintf(outf, "issafety(card) = %d, ", issafety(card));
fprintf(outf, "canplay(pp, op, card) = %d\n", canplay(pp, op, card));
}
if (Debug) {
fprintf(outf, "CHECK_GO: can play %s (%d), ", C_name[card], card);
fprintf(outf, "issafety(card) = %d, ", issafety(card));
fprintf(outf, "canplay(pp, op, card) = %d\n", canplay(pp, op, card));
}
else if (Debug)
fprintf(outf, "CHECK_GO: cannot play %s\n",
C_name[card]);
else if (Debug)
fprintf(outf, "CHECK_GO: cannot play %s\n",
C_name[card]);
}
card = pp->hand[Card_no];
}
card = pp->hand[Card_no];
if (Debug)
fprintf(outf, "PLAYCARD: Card = %s\n", C_name[card]);
if (Debug)
fprintf(outf, "PLAYCARD: Card = %s\n", C_name[card]);
Next = FALSE;
switch (card) {
case C_200:
Next = FALSE;
switch (card) {
case C_200:
getmove()
{
reg char c, *sp;
getmove()
{
reg char c, *sp;
- static char moveprompt[] = ">>:Move:";
#ifdef EXTRAP
static bool last_ex = FALSE; /* set if last command was E */
#ifdef EXTRAP
static bool last_ex = FALSE; /* set if last command was E */
case ' ': /* Spaces */
case '\0': /* and nulls */
break;
case ' ': /* Spaces */
case '\0': /* and nulls */
break;
case 'Z': /* Debug code */
case 'Z': /* Debug code */
- if (geteuid() == ARNOLD) {
- if (!Debug && outf == NULL) {
- char buf[40];
-over:
- prompt(FILEPROMPT);
- leaveok(Board, FALSE);
- refresh();
- sp = buf;
- while ((*sp = readch()) != '\n') {
- if (*sp == killchar())
- goto over;
- else if (*sp == erasechar()) {
- if (--sp < buf)
- sp = buf;
- else {
- addch('\b');
- if (*sp < ' ')
- addch('\b');
- clrtoeol();
- }
+ if (!Debug && outf == NULL) {
+ char buf[MAXPATHLEN];
+
+ prompt(FILEPROMPT);
+ leaveok(Board, FALSE);
+ refresh();
+ sp = buf;
+ while ((*sp = readch()) != '\n') {
+ if (*sp == killchar())
+ goto over;
+ else if (*sp == erasechar()) {
+ if (--sp < buf)
+ sp = buf;
+ else {
+ addch('\b');
+ if (*sp < ' ')
+ addch('\b');
+ clrtoeol();
- else
- addstr(unctrl(*sp++));
- refresh();
- *sp = '\0';
- leaveok(Board, TRUE);
- if ((outf = fopen(buf, "w")) == NULL)
- perror(buf);
- setbuf(outf, (char *)NULL);
+ else
+ addstr(unctrl(*sp++));
+ refresh();
- Debug = !Debug;
- break;
+ *sp = '\0';
+ leaveok(Board, TRUE);
+ if ((outf = fopen(buf, "w")) == NULL)
+ perror(buf);
+ setbuf(outf, (char *)NULL);
+ Debug = !Debug;
+ break;
+#endif
default:
error("unknown command: %s", unctrl(c));
break;
default:
error("unknown command: %s", unctrl(c));
break;