From 06e4c4ec6a4b5ac39b1d52c86457c5a0b2f2bacb Mon Sep 17 00:00:00 2001 From: zrj Date: Fri, 17 Nov 2017 11:20:44 +0200 Subject: [PATCH] backgammon(6): Avoid symbol issue with ncurses lib. The backgammon(6) has: back.k: extern int raw; while in ncurses tinfo/lib_raw.c: int raw(void){}. This breaks -flto -static link against LTO'ed libncurses.a. So just rename backgammon global raw to bgraw. Just for the fun of it, note that init.c: struct termios bgraw; NetBSD already have it fixed in games/backgammon/. Also still not clear how to do with c5e1790f6b. --- games/backgammon/backgammon/main.c | 6 +++--- games/backgammon/backgammon/move.c | 4 ++-- games/backgammon/backgammon/text.c | 4 ++-- games/backgammon/common_source/back.h | 2 +- games/backgammon/common_source/board.c | 2 +- games/backgammon/common_source/init.c | 2 +- games/backgammon/teachgammon/teach.c | 4 ++-- games/backgammon/teachgammon/ttext2.c | 4 ++-- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/games/backgammon/backgammon/main.c b/games/backgammon/backgammon/main.c index 7510183f77..1036f3ab91 100644 --- a/games/backgammon/backgammon/main.c +++ b/games/backgammon/backgammon/main.c @@ -95,7 +95,7 @@ main(int argc, char **argv) if (tcgetattr(0, &tty) == -1) /* get old tty mode */ errexit("backgammon(tcgetattr)"); old = tty.c_lflag; - raw = ((noech = old & ~ECHO) & ~ICANON); /* set up modes */ + bgraw = ((noech = old & ~ECHO) & ~ICANON); /* set up modes */ ospeed = cfgetospeed(&tty); /* for termlib */ /* get terminal capabilities, and decide if it can cursor address */ @@ -109,10 +109,10 @@ main(int argc, char **argv) args[acnt] = NULL; if (tflag) { /* clear screen */ noech &= ~(ICRNL | OXTABS); - raw &= ~(ICRNL | OXTABS); + bgraw &= ~(ICRNL | OXTABS); clear(); } - fixtty(raw); /* go into raw mode */ + fixtty(bgraw); /* go into raw mode */ /* check if restored game and save flag for later */ if ((rfl = rflag) != 0) { diff --git a/games/backgammon/backgammon/move.c b/games/backgammon/backgammon/move.c index cc859c0636..0eaf8de6b3 100644 --- a/games/backgammon/backgammon/move.c +++ b/games/backgammon/backgammon/move.c @@ -136,7 +136,7 @@ move(int okay) if (mvlim == 0) { writel(" but cannot use it.\n"); nexturn(); - fixtty(raw); + fixtty(bgraw); return; } @@ -174,7 +174,7 @@ move(int okay) buflush(); sleep(3); } - fixtty(raw); /* no more tty interrupt */ + fixtty(bgraw); /* no more tty interrupt */ } /* diff --git a/games/backgammon/backgammon/text.c b/games/backgammon/backgammon/text.c index 9a523c7ba2..4e04cf5da9 100644 --- a/games/backgammon/backgammon/text.c +++ b/games/backgammon/backgammon/text.c @@ -114,12 +114,12 @@ text(const char *const *t) writec('\n'); } else { writel("-->"); - fixtty(raw); + fixtty(bgraw); while ((i = readc()) != ' ' && i != '\n'); fixtty(noech); clear(); } t++; } - fixtty(raw); + fixtty(bgraw); } diff --git a/games/backgammon/common_source/back.h b/games/backgammon/common_source/back.h index 123ca4af4a..3b64c596c9 100644 --- a/games/backgammon/common_source/back.h +++ b/games/backgammon/common_source/back.h @@ -115,7 +115,7 @@ extern int colen; /* length of color of current player */ extern struct termios tty; /* tty information buffer */ extern int old; /* original tty status */ extern int noech; /* original tty status without echo */ -extern int raw; /* raw tty status, no echo */ +extern int bgraw; /* raw tty status, no echo */ extern int curr; /* row position of cursor */ extern int curc; /* column position of cursor */ diff --git a/games/backgammon/common_source/board.c b/games/backgammon/common_source/board.c index 8302620d43..e32ad9d5d4 100644 --- a/games/backgammon/common_source/board.c +++ b/games/backgammon/common_source/board.c @@ -153,7 +153,7 @@ lastline: writec('\n'); writec('\n'); } - fixtty(raw); + fixtty(bgraw); } static void diff --git a/games/backgammon/common_source/init.c b/games/backgammon/common_source/init.c index d239a48627..ab92b2a42a 100644 --- a/games/backgammon/common_source/init.c +++ b/games/backgammon/common_source/init.c @@ -90,4 +90,4 @@ int p[5]; int rscore; int table[6][6]; int wscore; -struct termios tty, old, noech, raw; +struct termios tty, old, noech, bgraw; diff --git a/games/backgammon/teachgammon/teach.c b/games/backgammon/teachgammon/teach.c index cc6299f1ee..d1827eab8c 100644 --- a/games/backgammon/teachgammon/teach.c +++ b/games/backgammon/teachgammon/teach.c @@ -65,13 +65,13 @@ main(int argc, char **argv) if (tcgetattr(0, &tty) == -1) /* get old tty mode */ errexit("teachgammon(tcgetattr)"); old = tty.c_lflag; - raw = ((noech = old & ~ECHO) & ~ICANON); /* set up modes */ + bgraw = ((noech = old & ~ECHO) & ~ICANON); /* set up modes */ ospeed = cfgetospeed(&tty); /* for termlib */ tflag = getcaps(getenv("TERM")); getarg(argc, argv); if (tflag) { noech &= ~(ICRNL | OXTABS); - raw &= ~(ICRNL | OXTABS); + bgraw &= ~(ICRNL | OXTABS); clear(); } text(hello); diff --git a/games/backgammon/teachgammon/ttext2.c b/games/backgammon/teachgammon/ttext2.c index 3281a0722e..233f30b81d 100644 --- a/games/backgammon/teachgammon/ttext2.c +++ b/games/backgammon/teachgammon/ttext2.c @@ -137,7 +137,7 @@ text(const char *const *txt) writel(a); writec('\n'); } else { - fixtty(raw); + fixtty(bgraw); writel(prompt); for (;;) { if ((b = readc()) == '?') { @@ -181,6 +181,6 @@ text(const char *const *txt) curmove(curr, 0); } } - fixtty(raw); + fixtty(bgraw); return (0); } -- 2.41.0