|
|
1.1 ! root 1: static char sccsid[] = " teach.c 4.1 82/05/11 "; ! 2: ! 3: #include "back.h" ! 4: ! 5: char *hello[]; ! 6: char *list[]; ! 7: char *intro1[]; ! 8: char *intro2[]; ! 9: char *moves[]; ! 10: char *remove[]; ! 11: char *hits[]; ! 12: char *endgame[]; ! 13: char *doubl[]; ! 14: char *stragy[]; ! 15: char *prog[]; ! 16: char *lastch[]; ! 17: ! 18: extern char ospeed; /* tty output speed for termlib */ ! 19: ! 20: char *helpm[] = { ! 21: "\nEnter a space or newline to roll, or", ! 22: " b to display the board", ! 23: " d to double", ! 24: " q to quit\n", ! 25: 0 ! 26: }; ! 27: ! 28: char *contin[] = { ! 29: "", ! 30: 0 ! 31: }; ! 32: ! 33: main (argc,argv) ! 34: int argc; ! 35: char **argv; ! 36: ! 37: { ! 38: register char *s, *ts[]; ! 39: register int i; ! 40: ! 41: signal (2,getout); ! 42: if (gtty (0,&tty) == -1) /* get old tty mode */ ! 43: errexit ("teachgammon(gtty)"); ! 44: old = tty.sg_flags; ! 45: #ifdef V7 ! 46: raw = ((noech = old & ~ECHO) | CBREAK); /* set up modes */ ! 47: #else ! 48: raw = ((noech = old & ~ECHO) | RAW); /* set up modes */ ! 49: #endif ! 50: ospeed = old.sg_ospeed; /* for termlib */ ! 51: tflag = getcaps (getenv ("TERM")); ! 52: #ifdef V7 ! 53: while (*++argv != 0) ! 54: #else ! 55: while (*++argv != -1) ! 56: #endif ! 57: getarg (&argv); ! 58: if (tflag) { ! 59: noech &= ~(CRMOD|XTABS); ! 60: raw &= ~(CRMOD|XTABS); ! 61: clear(); ! 62: } ! 63: text (hello); ! 64: text (list); ! 65: i = text (contin); ! 66: if (i == 0) ! 67: i = 2; ! 68: init(); ! 69: while (i) ! 70: switch (i) { ! 71: ! 72: case 1: ! 73: leave(); ! 74: ! 75: case 2: ! 76: if (i = text(intro1)) ! 77: break; ! 78: wrboard(); ! 79: if (i = text(intro2)) ! 80: break; ! 81: ! 82: case 3: ! 83: if (i = text(moves)) ! 84: break; ! 85: ! 86: case 4: ! 87: if (i = text(remove)) ! 88: break; ! 89: ! 90: case 5: ! 91: if (i = text(hits)) ! 92: break; ! 93: ! 94: case 6: ! 95: if (i = text(endgame)) ! 96: break; ! 97: ! 98: case 7: ! 99: if (i = text(doubl)) ! 100: break; ! 101: ! 102: case 8: ! 103: if (i = text(stragy)) ! 104: break; ! 105: ! 106: case 9: ! 107: if (i = text(prog)) ! 108: break; ! 109: ! 110: case 10: ! 111: if (i = text(lastch)) ! 112: break; ! 113: } ! 114: tutor(); ! 115: } ! 116: ! 117: leave() { ! 118: if (tflag) ! 119: clear(); ! 120: else ! 121: writec ('\n'); ! 122: fixtty(old); ! 123: execl (EXEC,"backgammon",args,"n",0); ! 124: writel ("Help! Backgammon program is missing\007!!\n"); ! 125: exit (-1); ! 126: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.