slackware-current/source/y/bsd-games/bsd-games.getline.diff
Patrick J Volkerding b76270bf9e Slackware 13.1
Wed May 19 08:58:23 UTC 2010
Slackware 13.1 x86_64 stable is released!
Lots of thanks are due -- see the RELEASE_NOTES and the rest of the
ChangeLog for credits.  The ISOs are on their way to replication,
a 6 CD-ROM 32-bit set and a dual-sided 32-bit/64-bit x86/x86_64 DVD.
We are taking pre-orders now at store.slackware.com, and offering
a discount if you sign up for a subscription.  Consider picking up
a copy to help support the project.  Thanks again to the Slackware
community for testing, contributing, and generally holding us to a
high level of quality.  :-)
Enjoy!
2018-05-31 22:43:05 +02:00

251 lines
6.9 KiB
Diff

--- ./gomoku/main.c.orig 2000-05-28 09:51:46.000000000 -0500
+++ ./gomoku/main.c 2010-05-11 16:10:10.000000000 -0500
@@ -159,7 +159,7 @@
if (inputfp == NULL && test == 0) {
for (;;) {
ask("black or white? ");
- getline(buf, sizeof(buf));
+ g_getline(buf, sizeof(buf));
if (buf[0] == 'b' || buf[0] == 'B') {
color = BLACK;
break;
@@ -176,7 +176,7 @@
}
} else {
setbuf(stdout, 0);
- getline(buf, sizeof(buf));
+ g_getline(buf, sizeof(buf));
if (strcmp(buf, "black") == 0)
color = BLACK;
else if (strcmp(buf, "white") == 0)
@@ -248,7 +248,7 @@
getinput:
if (interactive)
ask("move? ");
- if (!getline(buf, sizeof(buf))) {
+ if (!g_getline(buf, sizeof(buf))) {
curmove = RESIGN;
break;
}
@@ -260,7 +260,7 @@
FILE *fp;
ask("save file name? ");
- (void)getline(buf, sizeof(buf));
+ (void)g_getline(buf, sizeof(buf));
if ((fp = fopen(buf, "w")) == NULL) {
glog("cannot create save file");
goto getinput;
@@ -313,14 +313,14 @@
if (i != RESIGN) {
replay:
ask("replay? ");
- if (getline(buf, sizeof(buf)) &&
+ if (g_getline(buf, sizeof(buf)) &&
(buf[0] == 'y' || buf[0] == 'Y'))
goto again;
if (strcmp(buf, "save") == 0) {
FILE *fp;
ask("save file name? ");
- (void)getline(buf, sizeof(buf));
+ (void)g_getline(buf, sizeof(buf));
if ((fp = fopen(buf, "w")) == NULL) {
glog("cannot create save file");
goto replay;
@@ -371,7 +371,7 @@
quit();
top:
ask("cmd? ");
- if (!getline(fmtbuf, sizeof(fmtbuf)))
+ if (!g_getline(fmtbuf, sizeof(fmtbuf)))
quit();
switch (*fmtbuf) {
case '\0':
--- ./gomoku/gomoku.h.orig 1999-09-15 05:34:31.000000000 -0500
+++ ./gomoku/gomoku.h 2010-05-11 16:10:10.000000000 -0500
@@ -269,7 +269,7 @@
void bdinit __P((struct spotstr *));
void init_overlap __P((void));
-int getline __P((char *, int));
+int g_getline __P((char *, int));
void ask __P((const char *));
void dislog __P((const char *));
void bdump __P((FILE *));
--- ./gomoku/bdisp.c.orig 2001-02-07 18:18:22.000000000 -0600
+++ ./gomoku/bdisp.c 2010-05-11 16:10:10.000000000 -0500
@@ -245,7 +245,7 @@
}
int
-getline(buf, size)
+g_getline(buf, size)
char *buf;
int size;
{
--- ./cribbage/score.c.orig 1999-09-15 05:34:31.000000000 -0500
+++ ./cribbage/score.c 2010-05-11 16:10:10.000000000 -0500
@@ -122,7 +122,7 @@
CARD h[(CINHAND + 1)];
char buf[32];
- expl[0] = '\0'; /* initialize explanation */
+ cr_expl[0] = '\0'; /* initialize explanation */
score = 0;
flag = TRUE;
k = hand[0].suit;
@@ -132,29 +132,29 @@
if (hand[i].suit == starter.suit) {
score++;
if (do_explain)
- strcat(expl, "His Nobs");
+ strcat(cr_expl, "His Nobs");
}
h[i] = hand[i];
}
if (flag && n >= CINHAND) {
- if (do_explain && expl[0] != '\0')
- strcat(expl, ", ");
+ if (do_explain && cr_expl[0] != '\0')
+ strcat(cr_expl, ", ");
if (starter.suit == k) {
score += 5;
if (do_explain)
- strcat(expl, "Five-flush");
+ strcat(cr_expl, "Five-flush");
} else
if (!crb) {
score += 4;
- if (do_explain && expl[0] != '\0')
- strcat(expl, ", Four-flush");
+ if (do_explain && cr_expl[0] != '\0')
+ strcat(cr_expl, ", Four-flush");
else
- strcpy(expl, "Four-flush");
+ strcpy(cr_expl, "Four-flush");
}
}
- if (do_explain && expl[0] != '\0')
- strcat(expl, ", ");
+ if (do_explain && cr_expl[0] != '\0')
+ strcat(cr_expl, ", ");
h[n] = starter;
sorthand(h, n + 1); /* sort by rank */
i = 2 * fifteens(h, n + 1);
@@ -162,9 +162,9 @@
if (do_explain) {
if (i > 0) {
(void) sprintf(buf, "%d points in fifteens", i);
- strcat(expl, buf);
+ strcat(cr_expl, buf);
} else
- strcat(expl, "No fifteens");
+ strcat(cr_expl, "No fifteens");
}
i = pairuns(h, n + 1);
score += i;
@@ -172,9 +172,9 @@
if (i > 0) {
(void) sprintf(buf, ", %d points in pairs, %d in runs",
pairpoints, runpoints);
- strcat(expl, buf);
+ strcat(cr_expl, buf);
} else
- strcat(expl, ", No pairs/runs");
+ strcat(cr_expl, ", No pairs/runs");
}
return (score);
}
--- ./cribbage/support.c.orig 1999-09-15 05:34:31.000000000 -0500
+++ ./cribbage/support.c 2010-05-11 16:10:10.000000000 -0500
@@ -152,7 +152,7 @@
msg("You should have taken %d, not %d!", i, j);
}
if (explain)
- msg("Explanation: %s", expl);
+ msg("Explanation: %s", cr_expl);
do_wait();
} else
win = chkscr(&pscore, i);
--- ./cribbage/cribbage.h.orig 2000-10-17 14:58:05.000000000 -0500
+++ ./cribbage/cribbage.h 2010-05-11 16:10:10.000000000 -0500
@@ -59,7 +59,7 @@
extern BOOLEAN quiet; /* if suppress random mess */
extern BOOLEAN playing; /* currently playing game */
-extern char expl[]; /* string for explanation */
+extern char cr_expl[]; /* string for explanation */
void addmsg __P((const char *, ...))
__attribute__((__format__(__printf__, 1, 2)));
@@ -81,7 +81,7 @@
int fifteens __P((const CARD [], int));
void game __P((void));
void gamescore __P((void));
-char *getline __P((void));
+char *cr_getline __P((void));
int getuchar __P((void));
int incard __P((CARD *));
int infrom __P((const CARD [], int, const char *));
--- ./cribbage/io.c.orig 1999-10-01 15:45:34.000000000 -0500
+++ ./cribbage/io.c 2010-05-11 16:10:10.000000000 -0500
@@ -254,7 +254,7 @@
retval = FALSE;
rnk = sut = EMPTY;
- if (!(line = getline()))
+ if (!(line = cr_getline()))
goto gotit;
p = p1 = line;
while (*p1 != ' ' && *p1 != '\0')
@@ -355,7 +355,7 @@
for (sum = 0;;) {
msg(prompt);
- if (!(p = getline()) || *p == '\0') {
+ if (!(p = cr_getline()) || *p == '\0') {
msg(quiet ? "Not a number" :
"That doesn't look like a number");
continue;
@@ -562,7 +562,7 @@
* compressed to one space; a space is inserted before a ','
*/
char *
-getline()
+cr_getline()
{
char *sp;
int c, oy, ox;
--- ./cribbage/crib.c.orig 2001-02-07 18:18:22.000000000 -0600
+++ ./cribbage/crib.c 2010-05-11 16:10:10.000000000 -0500
@@ -225,7 +225,7 @@
if (!rflag) { /* player cuts deck */
msg(quiet ? "Cut for crib? " :
"Cut to see whose crib it is -- low card wins? ");
- getline();
+ cr_getline();
}
i = (rand() >> 4) % CARDS; /* random cut */
do { /* comp cuts deck */
@@ -401,7 +401,7 @@
if (!rflag) { /* random cut */
msg(quiet ? "Cut the deck? " :
"How many cards down do you wish to cut the deck? ");
- getline();
+ cr_getline();
}
i = (rand() >> 4) % (CARDS - pos);
turnover = deck[i + pos];
--- ./cribbage/extern.c.orig 1999-09-26 06:37:19.000000000 -0500
+++ ./cribbage/extern.c 2010-05-11 16:10:10.000000000 -0500
@@ -52,7 +52,7 @@
BOOLEAN quiet = FALSE; /* if suppress random mess */
BOOLEAN rflag = FALSE; /* if all cuts random */
-char expl[128]; /* explanation */
+char cr_expl[128]; /* explanation */
int cgames = 0; /* number games comp won */
int cscore = 0; /* comp score in this game */