Project

General

Profile

Bug #1491 ยป backgammon.diff

uqs, 09/08/2009 05:35 PM

View differences:

games/backgammon/backgammon/Makefile
# $DragonFly: src/games/backgammon/backgammon/Makefile,v 1.4 2006/10/08 16:22:35 pavalos Exp $
PROG= backgammon
CFLAGS+=-DV7 -I${.CURDIR}/../common_source
CFLAGS+=-I${.CURDIR}/../common_source
SRCS= allow.c board.c check.c extra.c fancy.c init.c main.c move.c \
odds.c one.c save.c subs.c table.c text.c version.c
MAN= backgammon.6
games/backgammon/backgammon/main.c
*/
#include <stdio.h>
#include <termcap.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <signal.h>
#include "back.h"
......
};
static const char rules[] = "\nDo you want the rules of the game?";
static const char noteach[] = "Teachgammon not available!\n\007";
static const char noteach[] = "Teachgammon not available!\n\a";
static const char need[] = "Do you need instructions for this program?";
static const char askcol[] =
"Enter 'r' to play red, 'w' to play white, 'b' to play both:";
......
bflag = 2; /* default no board */
acnt = 1; /* Nuber of args */
signal (SIGINT,(sig_t)getout); /* trap interrupts */
if (ioctl(0, TIOCGETP, &tty) == -1) /* get old tty mode */
errexit ("backgammon(gtty)");
old = tty.sg_flags;
#ifdef V7
raw = ((noech = old & ~ECHO) | CBREAK); /* set up modes */
#else
raw = ((noech = old & ~ECHO) | RAW); /* set up modes */
#endif
if (tcgetattr (0,&tty) == -1) /* get old tty mode */
errexit ("backgammon(tcgetattr)");
old = tty.c_lflag;
raw = ((noech = old & ~ECHO) & ~ICANON); /* set up modes */
ospeed = cfgetospeed(&tty); /* for termlib */
/* get terminal
* capabilities, and
......
getarg (argc, argv);
args[acnt] = NULL;
if (tflag) { /* clear screen */
noech &= ~(CRMOD|XTABS);
raw &= ~(CRMOD|XTABS);
noech &= ~(ICRNL|OXTABS);
raw &= ~(ICRNL|OXTABS);
clear();
}
fixtty (raw); /* go into raw mode */
games/backgammon/common_source/back.h
* $DragonFly: src/games/backgammon/common_source/back.h,v 1.2 2006/08/08 16:36:11 pavalos Exp $
*/
#include <sgtty.h>
#include <termios.h>
#include <stdlib.h>
#include <unistd.h>
......
extern const char *const *Colorptr; /* color of current player, capitalized */
extern int colen; /* length of color of current player */
extern struct sgttyb tty; /* tty information buffer */
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 */
games/backgammon/common_source/save.c
writel (prompt);
fs = fname;
while ((*fs = readc()) != '\n') {
if (*fs == tty.sg_erase) {
if (*fs == tty.c_cc[2]) {
if (fs > fname) {
fs--;
if (tflag)
games/backgammon/common_source/subs.c
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "back.h"
......
if (tflag)
newpos();
buflush();
tty.sg_flags = mode;
if (ioctl(0, TIOCSETP, &tty) < 0)
tty.c_lflag = mode;
if (tcsetattr (0,TCSANOW,&tty) < 0)
errexit("fixtty");
}
games/backgammon/common_source/table.c
}
}
if (c == tty.sg_erase && ncin > 0) {
if (c == tty.c_cc[2] && ncin > 0) {
if (tflag)
curmove (curr,curc-1);
else {
if (tty.sg_erase == '\010')
if (tty.c_cc[2] == '\010')
writel ("\010 \010");
else
writec (cin[ncin-1]);
......
goto domove;
}
if (c == tty.sg_kill && ncin > 0) {
if (c == tty.c_cc[3] && ncin > 0) {
if (tflag) {
refresh();
curmove (curr,39);
ist = -1;
goto domove;
} else if (tty.sg_erase == '\010') {
} else if (tty.c_cc[2] == '\010') {
for (j = 0; j < ncin; j++)
writel ("\010 \010");
ist = -1;
games/backgammon/teachgammon/Makefile
# $DragonFly: src/games/backgammon/teachgammon/Makefile,v 1.3 2006/10/08 16:22:35 pavalos Exp $
PROG= teachgammon
CFLAGS+=-DTEACHGAMMON_TEXT -DV7 -I${.CURDIR}/../common_source
CFLAGS+=-DTEACHGAMMON_TEXT -I${.CURDIR}/../common_source
SRCS= allow.c board.c check.c data.c fancy.c init.c odds.c one.c save.c \
subs.c table.c teach.c ttext1.c ttext2.c tutor.c
DPADD= ${LIBTERMCAP}
games/backgammon/teachgammon/teach.c
#include <string.h>
#include <sys/types.h>
#include <termcap.h>
#include <unistd.h>
#include <signal.h>
#include "back.h"
#include "tutor.h"
......
acnt = 1;
signal (SIGINT,(sig_t)getout);
if (ioctl(0,TIOCGETP,&tty) == -1) /* get old tty mode */
errexit ("teachgammon(gtty)");
old = tty.sg_flags;
#ifdef V7
raw = ((noech = old & ~ECHO) | CBREAK); /* set up modes */
#else
raw = ((noech = old & ~ECHO) | RAW); /* set up modes */
#endif
if (tcgetattr (0,&tty) == -1) /* get old tty mode */
errexit ("teachgammon(tcgetattr)");
old = tty.c_lflag;
raw = ((noech = old & ~ECHO) & ~ICANON); /* set up modes */
ospeed = cfgetospeed(&tty); /* for termlib */
tflag = getcaps (getenv ("TERM"));
getarg (argc, argv);
if (tflag) {
noech &= ~(CRMOD|XTABS);
raw &= ~(CRMOD|XTABS);
noech &= ~(ICRNL|OXTABS);
raw &= ~(ICRNL|OXTABS);
clear();
}
text (hello);
    (1-1/1)