home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / vmsnet / ldb / part10 < prev    next >
Internet Message Format  |  1993-04-07  |  49KB

  1. Path: uunet!europa.eng.gtefsd.com!howland.reston.ans.net!usc!news.service.uci.edu!unogate!mvb.saic.com!dayton.saic.com!dayvd.dayton.saic.com!ake
  2. From: ake@dayvd.dayton.saic.com (Earle Ake)
  3. Newsgroups: vmsnet.sources.games
  4. Subject: ldb - Long Distance Backgammon [10/16]
  5. Date: 8 Apr 93 10:59:57 EST
  6. Organization: Science Applications Intl Corp - Dayton, OH
  7. Lines: 1168
  8. Message-ID: <1993Apr8.105957.1@dayvd.dayton.saic.com>
  9. NNTP-Posting-Host: dayvd.dayton.saic.com
  10. Xref: uunet vmsnet.sources.games:671
  11.  
  12. -+-+-+-+-+-+-+-+ START OF PART 10 -+-+-+-+-+-+-+-+
  13. X`09gtail`20=`20g->prev;`09/*`20move`20tail`20pointer`20back`20*/
  14. X`09gtail->next`20=`20NULL;`09/*`20last`20game`20has`20no`20next`20*/
  15. X`09`7D
  16. Xelse`20`7B
  17. X`09g->next->prev`20=`20g->prev;`09/*`20link`20back`20link`20around`20g`20*/
  18. X`09g->prev->next`20=`20g->next;`09/*`20and`20forward`20link`20too`20*/
  19. X`09`7D
  20. Xif`20(g->gameid`20!=`20NULL)
  21. X`09free(g->gameid);`09`09/*`20free`20string`20space`20*/
  22. Xif`20(g->opname`20!=`20NULL)
  23. X`09free(g->opname);
  24. Xif`20(g->opaddr`20!=`20NULL)
  25. X`09free(g->opaddr);
  26. Xif`20(g->mycmt`20!=`20NULL)
  27. X`09free(g->mycmt);
  28. Xif`20(g->mycmt2`20!=`20NULL)
  29. X`09free(g->mycmt2);
  30. Xif`20(g->opcmt`20!=`20NULL)
  31. X`09free(g->opcmt);
  32. Xif`20(g->opcmt2`20!=`20NULL)
  33. X`09free(g->opcmt2);
  34. Xif`20(g->dispmsg`20!=`20NULL)
  35. X`09free(g->dispmsg);
  36. Xfree(g);`09`09`09/*`20free`20the`20memory`20*/
  37. X`7D
  38. X
  39. X
  40. X/*----------------------------------------------------------------------
  41. X`20*`09findgame`20--`20find`20a`20game`20based`20on`20its`20game`20id
  42. X`20*
  43. X`20*`20This`20function`20performs`20a`20linear`20search`20through`20the`20game
  44. V`20list
  45. X`20*`20for`20a`20game`20id.`20`20It`20returns`20a`20pointer`20to`20the`20game,
  46. V`20or`20NULL`20if
  47. X`20*`20the`20game`20does`20not`20exist.
  48. X`20*----------------------------------------------------------------------
  49. X`20*/
  50. X
  51. Xstruct`20game`20*findgame(gid)
  52. Xchar`20*gid;
  53. X`7B
  54. Xstruct`20game`20*g;
  55. X
  56. Xfor`20(g`20=`20ghead;`20g`20!=`20NULL;`20g`20=`20g->next)
  57. X`09if`20(strcmp(gid,g->gameid)`20==`200)`09`09/*`20is`20this`20it?`20*/
  58. X`09`09return(g);`09`09`09/*`20return`20it`20*/
  59. Xreturn(NULL);`09`09`09`09`09/*`20no`20such`20game`20*/
  60. X`7D
  61. X
  62. X
  63. X/*---------------------------------------------------------------------------
  64. X`20*`09addppl`20--`20allocate`20a`20people`20struct`20and`20link`20it`20into
  65. V`20the`20list
  66. X`20*
  67. X`20*`20This`20function`20allocates`20a`20people`20structure`20and`20links`20it
  68. V`20into`20the
  69. X`20*`20people`20list.`20`20The`20head`20of`20this`20list`20is`20phead.
  70. X`20*
  71. X`20*`20NOTE:`20the`20memory-zeroing`20feature`20of`20calloc`20is`20depended
  72. V`20on`20to
  73. X`20*`09`20initialize`20the`20allocated`20people`20struct.
  74. X`20*--------------------------------------------------------------------------
  75. V-
  76. X`20*/
  77. X
  78. Xstruct`20people`20*addppl()
  79. X`7B
  80. Xstruct`20people`20*p,`20*t;
  81. X
  82. Xfor`20(t`20=`20NULL,`20p`20=`20phead;`20p`20!=`20NULL;`20t`20=`20p,`20p`20=
  83. V`20p->next);`20/*`20t`20=`20end`20of`20list`20*/
  84. Xif`20(`20(p`20=`20(struct`20people`20*)calloc(sizeof(struct`20people),1))`20==
  85. V`20NULL)
  86. X`09fatal("Out`20of`20memory!");
  87. Xif`20(t`20==`20NULL)
  88. X`09phead`20=`20p;
  89. Xelse
  90. X`09t->next`20=`20p;
  91. Xp->next`20=`20NULL;
  92. Xreturn(p);
  93. X`7D
  94. X
  95. X
  96. X/*----------------------------------------------------------------------
  97. X`20*`09findppl`20--`20find`20a`20people`20struct`20by`20address`20or`20alias
  98. X`20*
  99. X`20*`20This`20function`20performs`20a`20linear`20search`20through`20the`20peop
  100. Vle`20list
  101. X`20*`20searching`20for`20an`20address`20(if`20flag`20`26`20P_ADDR)`20or`20an
  102. V`20alias`20(if`20flag`20`26`20P_ALIAS).
  103. X`20*`20It`20returns`20a`20pointer`20to`20the`20struct,`20or`20NULL`20if`20the
  104. V`20address`20does`20not`20exist.
  105. X`20*----------------------------------------------------------------------
  106. X`20*/
  107. X
  108. Xstruct`20people`20*findppl(a,flag)
  109. Xchar`20*a;
  110. Xint`20flag;
  111. X`7B
  112. Xint`20i;
  113. Xstruct`20people`20*p;
  114. X
  115. Xif`20(a`20==`20NULL)
  116. X`09fatal("NULL`20address`20in`20findppl");
  117. Xrescan:
  118. Xfor`20(p`20=`20phead;`20p`20!=`20NULL;`20p`20=`20p->next)`20`7B
  119. X`09if`20(`20(flag`20`26`20P_ADDR)`20`26`26`20(strcmp(a,p->addr)`20==`200)`20)
  120. V`20`7B`20`20`20/*`20check`20addr`20*/
  121. X`09`09if`20(p->equiv`20!=`20NULL)`20`7B`09`09/*`20if`20equiv`20record,`20*/
  122. X`09`09`09a`20=`20p->equiv;`09`09/*`20go`20look`20for`20base`20record`20*/
  123. X`09`09`09goto`20rescan;
  124. X`09`09`09`7D
  125. X`09`09return(p);`09`09`09/*`20return`20it`20*/
  126. X`09`09`7D
  127. X`09if`20(p->equiv`20!=`20NULL)`09`09/*`20equiv`20records`20don't`20have`20alia
  128. Vses`20*/
  129. X`09`09continue;
  130. X`09if`20(`20(flag`20`26`20P_ALIAS)`20`26`26`20(strcmp(a,p->alias)`20==`200)
  131. V`20)`20/*`20check`20alias`20*/
  132. X`09`09return(p);
  133. X`09`7D
  134. Xreturn(NULL);`09`09`09`09`09/*`20no`20such`20record`20*/
  135. X`7D
  136. X
  137. X
  138. X/*----------------------------------------------------------------------
  139. X`20*`09newppl`20--`20create`20a`20new`20people`20struct`20for`20a`20game
  140. X`20*
  141. X`20*`20This`20function`20creates`20a`20new`20people`20record`20for`20a`20new
  142. V`20opponent.`20`20It`20takes
  143. X`20*`20a`20game`20structure,`20extracts`20the`20necessary`20information,`20and
  144. V`20inserts
  145. X`20*`20the`20new`20record`20into`20the`20people`20list,`20as`20well`20as`20sto
  146. Vring`20a`20pointer
  147. X`20*`20to`20the`20new`20people`20struct`20into`20the`20game's`20ppl`20pointer.
  148. V
  149. X`20*
  150. X`20*`20The`20alias`20field`20is`20initialized`20to`20the`20first`20word`20of
  151. V`20g->opname
  152. X`20*`20with`20all`20upper`20case`20converted`20to`20lower.
  153. X`20*
  154. X`20*`20To`20handle`20people`20with`20more`20than`20one`20e-mail`20address,`20t
  155. Vhe`20people`20list
  156. X`20*`20is`20scanned`20for`20identical`20name`20fields.`20`20If`20one`20is`20fo
  157. Vund,`20the
  158. X`20*`20user`20is`20asked`20if`20these`20people`20are`20the`20same.`20`20If`20h
  159. Ve`20answers`20yes,
  160. X`20*`20the`20"equiv"`20field`20is`20set`20to`20the`20name`20of`20the`20existin
  161. Vg`20people
  162. X`20*`20record,`20and`20the`20rest`20of`20the`20record`20is`20zeroed`20out.
  163. X`20*----------------------------------------------------------------------
  164. X`20*/
  165. X
  166. Xstruct`20people`20*newppl(g)
  167. Xstruct`20game`20*g;
  168. X`7B
  169. Xchar`20*a;
  170. Xregister`20struct`20people`20*p,`20*q;
  171. Xchar`20buf`5B80`5D;
  172. X
  173. Xif`20(g->opname`20==`20NULL)`20`7B`09/*`20return`20a`20struct,`20but`20don't
  174. V`20put`20in`20list`20*/
  175. X`09if`20(`20(p`20=`20(struct`20people`20*)`20calloc(sizeof(struct`20people),1)
  176. V)`20==`20NULL)
  177. X`09`09fatal("Out`20of`20memory!");
  178. X`09p->addr`20=`20g->opaddr;`09/*`20this`20will`20keep`20everyone`20happy`20unt
  179. Vil`20*/
  180. X`09p->name`20=`20"UNKNOWN";`09/*`20we`20find`20out`20what`20his`20name`20is
  181. V`20*/
  182. X`09p->alias`20=`20"NONE";
  183. X`09g->ppl`20=`20p;
  184. X`09return(p);
  185. X`09`7D
  186. Xp`20=`20addppl();`09`09`09`09/*`20create`20new`20people`20struct`20*/
  187. Xp->addr`20=`20save(g->opaddr);`09`09/*`20copy`20opponent's`20address`20*/
  188. Xfor`20(q`20=`20phead;`20q`20!=`20NULL;`20q`20=`20q->next)`20`7B
  189. X`09if`20(`20(q->name`20!=`20NULL)`20`26`26`20(strcmp(q->name,g->opname)`20==
  190. V`200)`20)`20`7B
  191. X`09`09printf("The`20following`20e-mail`20addresses:`5Cn`5Cn`5Ct%s`5Cn`5Ct%s
  192. V`5Cn`5Cn",
  193. X`09`09`09q->addr,g->opaddr);
  194. X`09`09printf("have`20the`20same`20name.`20`5B%s`5D`5Cn",g->opname);
  195. X`09`09printf("Do`20they`20refer`20to`20the`20same`20person?`20`5Bdefault=yes
  196. V`5D`20`20");
  197. X`09`09fgets(buf,sizeof(buf),stdin);
  198. X`09`09if`20(`20(*buf`20==`20'n')`20`7C`7C`20(*buf`20==`20'N')`20)
  199. X`09`09`09break;
  200. X`09`09p->equiv`20=`20save(q->addr);
  201. X`09`09g->ppl`20=`20q;
  202. X`09`09return(q);
  203. X`09`09`7D
  204. X`09`7D
  205. Xp->equiv`20=`20NULL;
  206. Xp->name`20=`20save(g->opname);`09`09/*`20copy`20opponent's`20name`20*/
  207. Xif`20(`20(a`20=`20strchr(g->opname,'`20'))`20!=`20NULL)`09/*`20create`20defaul
  208. Vt`20alias`20*/
  209. X`09*a`20=`20'`5C0';
  210. Xp->alias`20=`20save(g->opname);`09`09/*`20first`20word`20of`20opponent's`20nam
  211. Ve`20*/
  212. Xif`20(a`20!=`20NULL)
  213. X`09*a`20=`20'`20';
  214. Xfor`20(a`20=`20p->alias;`20*a;`20a++)`09`09/*`20converted`20to`20lower`20case
  215. V`20*/
  216. X`09if`20(isupper(*a))
  217. X`09`09*a`20=`20tolower(*a);
  218. Xp->myaddr`20=`20save(g->myaddr);`09`09/*`20copy`20out`20my`20address`20*/
  219. Xp->fence`20=`200L;`09`09`09`09/*`20no`20fence`20time`20yet`20*/
  220. Xg->ppl`20=`20p;`09`09`09`09/*`20side`20pointer`20from`20game`20struct`20*/
  221. Xreturn(p);
  222. X`7D
  223. X
  224. X
  225. X/*----------------------------------------------------------------------
  226. X`20*`09printscore`20--`20print`20the`20cumulative`20score`20for`20each`20oppon
  227. Vent
  228. X`20*
  229. X`20*`20This`20function`20scans`20the`20people`20file`20printing`20the`20conten
  230. Vts`20of`20the
  231. X`20*`20score`20field`20for`20each`20opponent.`20`20It`20also`20prints`20the
  232. V`20total`20over
  233. X`20*`20all`20opponents`20at`20the`20end.`20`20For`20the`20following:
  234. X`20*`09points
  235. X`20*`09games
  236. X`20*`09matches
  237. X`20*`09gammons
  238. X`20*`09backgammons
  239. X`20*`20the`20number`20won/lost/net`20is`20printed.`20`20Games`20in`20progress
  240. V`20are`20not`20counted,
  241. X`20*`20but`20games`20that`20have`20been`20completed`20are,`20even`20if`20they
  242. V`20are`20part`20of
  243. X`20*`20a`20match`20that`20has`20not`20completed.
  244. X`20*----------------------------------------------------------------------
  245. X`20*/
  246. X
  247. Xprintscore()
  248. X`7B
  249. Xregister`20struct`20people`20*p;
  250. Xregister`20int`20i;
  251. Xint`20total`5B10`5D;`09`09`09/*`20to`20store`20the`20total`20for`20all`20oppon
  252. Vent's`20*/
  253. X
  254. Xif`20(phead`20==`20NULL)`09`09/*`20nothing`20to`20print`20*/
  255. X`09return;
  256. Xprintf("opponent`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20point
  257. Vs`20`20`20`20`20games`20`20`20`20`20`20gammons`20`20backgammons`20`20matches
  258. V`5Cn");
  259. Xprintf("----------------------------------------------------------------------
  260. V--------`5Cn");
  261. Xfor`20(i`20=`200;`20i`20<`2010;`20i++)
  262. X`09total`5Bi`5D`20=`200;
  263. Xfor`20(p`20=`20phead;`20p`20!=`20NULL;`20p`20=`20p->next)`20`7B
  264. X`09if`20(p->equiv`20!=`20NULL)
  265. X`09`09continue;`09`09/*`20skip`20equiv`20records`20*/
  266. X`09pscore(p->name,p->score);`09/*`20print`20this`20opponent`20*/
  267. X`09for`20(i`20=`200;`20i`20<`2010;`20i++)`09/*`20keep`20running`20total`20*/
  268. X`09`09total`5Bi`5D`20+=`20p->score`5Bi`5D;
  269. X`09`7D
  270. Xpscore("total",total);`09`09`09/*`20print`20the`20total`20*/
  271. X`7D
  272. X
  273. X
  274. X/*----------------------------------------------------------------------
  275. X`20*`09pscore`20--`20print`20the`20score`20for`20one`20opponent
  276. X`20*
  277. X`20*`20This`20function`20is`20called`20by`20printscore`20to`20print`20each`20o
  278. Vpponent.
  279. X`20*`20The`20opponent`20name`20is`20in`20"name",`20and`20the`20score`20table
  280. V`20is`20in`20"score".
  281. X`20*----------------------------------------------------------------------
  282. X`20*/
  283. X
  284. Xpscore(name,score)
  285. Xchar`20*name;
  286. Xint`20score`5B10`5D;
  287. X`7B
  288. Xstatic`20int`20sc_idx`5B`5D`20=`20`7B`202,`200,`204,`206,`208`20`7D;`09/*`20or
  289. Vder`20to`20print`20p->score`5B`5D`20*/
  290. Xregister`20int`20i,`20diff;
  291. Xchar`20buf`5B30`5D;
  292. Xchar`20c;
  293. X
  294. Xif`20(strlen(name)`20>`2025)`20`7B`09/*`20truncate`20name`20to`2025`20chars
  295. V`20*/
  296. X`09c`20=`20name`5B25`5D;
  297. X`09name`5B25`5D`20=`20'`5C0';
  298. X`09`7D
  299. Xelse
  300. X`09c`20=`20'`5C0';
  301. Xprintf("%-25s",name);
  302. Xif`20(c`20!=`20'`5C0')
  303. X`09name`5B25`5D`20=`20c;`09`09/*`20restore`20name`20*/
  304. Xfor`20(i`20=`200;`20i`20<`205;`20i++)`20`7B
  305. X`09sprintf(buf,"%d/%d",score`5Bsc_idx`5Bi`5D`5D,score`5Bsc_idx`5Bi`5D+1`5D);
  306. X`09buf`5B9`5D`20=`20'`5C0';`09`09/*`20truncate`20to`209`20chars`20*/
  307. X`09if`20(strcmp(buf,"0/0")`20==`200)`09/*`20none`20won`20or`20lost`20*/
  308. X`09`09*buf`20=`20'`5C0';`09`09/*`20just`20leave`20it`20blank`20*/
  309. X`09printf("`20`20%-9s",buf);`09/*`20print`20with`20field`20width`20of`209`20*/
  310. V
  311. X`09`7D
  312. Xprintf("`5Cn%21s","");
  313. Xfor`20(i`20=`200;`20i`20<`205;`20i++)`20`7B
  314. X`09diff`20=`20score`5Bsc_idx`5Bi`5D`5D`20-`20score`5Bsc_idx`5Bi`5D+1`5D;
  315. X`09if`20(diff`20==`200)`20`7B
  316. X`09`09if`20(`20(score`5Bsc_idx`5Bi`5D`5D`20==`200)`20`26`26`20(score`5Bsc_idx
  317. V`5Bi`5D+1`5D`20==`200)`20)
  318. X`09`09`09printf("`20`20`20`20`20`20`20`20`20`20`20");
  319. X`09`09else
  320. X`09`09`09printf("`20`20`20`20`20`20even`20");
  321. X`09`09`7D
  322. X`09else
  323. X`09`09printf("`20`20`20`20`20`20%+-5d",`20diff);
  324. X`09`7D
  325. Xprintf("`5Cn`5Cn");
  326. X`7D
  327. X
  328. X
  329. Xilose(g,term,rsflag)
  330. Xstruct`20game`20*g;
  331. Xint`20term;`09`09`09/*`20T_*`20*/
  332. Xint`20rsflag;`09`09`09/*`201`20=`20restart`20game`20if`20necessary`20*/
  333. X`7B
  334. Xint`20bg,`20gv;
  335. X
  336. Xg->state`20=`20ST_GAMEOVER;
  337. Xg->term`20=`20term;
  338. Xbg`20=`20gvalue(g,`26gv);
  339. Xg->mcurrent`5BWHO_OPP`5D`20+=`20gv;`09`09/*`20bump`20match`20count`20*/
  340. Xg->ppl->score`5BSC_GAMESLOST`5D++;`09`09/*`20inc`20games`20lost`20*/
  341. Xg->ppl->score`5BSC_PTSLOST`5D`20+=`20gv;
  342. Xif`20(bg`20==`201)`09`09`09/*`20gammon`20*/
  343. X`09g->ppl->score`5BSC_GMNLOST`5D++;
  344. Xelse`20if`20(bg`20==`202)
  345. X`09g->ppl->score`5BSC_BGLOST`5D++;
  346. Xendgame(g,rsflag);
  347. X`7D
  348. X
  349. X
  350. Xiwin(g,term,rsflag)
  351. Xstruct`20game`20*g;
  352. Xint`20term;`09`09`09/*`20T_*`20*/
  353. Xint`20rsflag;`09`09`09/*`201`20=`20restart`20game`20if`20necessary`20*/
  354. X`7B
  355. Xint`20bg,`20gv;
  356. X
  357. Xg->state`20=`20ST_GAMEOVER;
  358. Xg->term`20=`20term;
  359. Xbg`20=`20gvalue(g,`26gv);
  360. Xg->mcurrent`5BWHO_ME`5D`20+=`20gv;`09`09/*`20bump`20match`20count`20*/
  361. Xg->ppl->score`5BSC_GAMESWON`5D++;`09`09/*`20inc`20games`20lost`20*/
  362. Xg->ppl->score`5BSC_PTSWON`5D`20+=`20gv;
  363. Xif`20(bg`20==`201)`09`09`09/*`20gammon`20*/
  364. X`09g->ppl->score`5BSC_GMNWON`5D++;
  365. Xelse`20if`20(bg`20==`202)
  366. X`09g->ppl->score`5BSC_BGWON`5D++;
  367. Xendgame(g,rsflag);
  368. X`7D
  369. X
  370. X
  371. Xendgame(g,rsflag)
  372. Xstruct`20game`20*g;
  373. Xint`20rsflag;`09`09`09`09/*`201`20=`20restart`20game`20if`20necessary`20*/
  374. X`7B
  375. X
  376. Xif`20(g->ppl->fence`20<`20g->starttime)`20`20`20/*`20if`20newer`20than`20fence
  377. V`20*/
  378. X`09g->ppl->fence`20=`20g->starttime;`09/*`20move`20up`20fence`20*/
  379. Xif`20(rsflag`20`26`26`20(g->flags`20`26`20F_PERM)`20`26`26`20(g->mcurrent`5BWH
  380. VO_OPP`5D`20>=`20g->mtotal)`20)`20`7B
  381. X`09message("Restarted`20game`20with`20%s`20(%s).`5Cn",g->opname,g->opaddr);
  382. X`09notify`20=`20NULL;
  383. X`09startgame(g->opaddr,g->mydir,g->mycolor,g->opcolor,
  384. X`09`20`20`20g->flags`20`26`20(F_JACOBY`7CF_CRAWFORD`7CF_PERM`7CF_EUROPE`7CF_IN
  385. VVERT),
  386. X`09`20`20`20g->mtotal,0);
  387. X`09`7D
  388. Xif`20(`20(g->notify`20!=`20NULL)`20`26`26`20(g->mcurrent`5BWHO_OPP`5D`20>=`20g
  389. V->mtotal)`20)
  390. X`09sendpkt(g,NOTIFY);
  391. X`7D
  392. $ call unpack GAME.C;1 1430388055 ""
  393. $!
  394. $ create 'f'
  395. X/*`09lock.c`09`094/28/92
  396. X`20*
  397. X`20*`20Copyright`201992`20`20Perry`20R.`20Ross
  398. X`20*
  399. X`20*`20Permission`20to`20use,`20copy,`20modify,`20and`20distribute`20this`20so
  400. Vftware`20and`20its
  401. X`20*`20documentation`20without`20fee`20is`20hereby`20granted,`20subject`20to
  402. V`20the`20restrictions
  403. X`20*`20detailed`20in`20the`20README`20file,`20which`20is`20included`20here`20b
  404. Vy`20reference.
  405. X`20*`20Any`20other`20use`20requires`20written`20permission`20from`20the`20auth
  406. Vor.`20`20This`20software
  407. X`20*`20is`20distributed`20"as`20is"`20without`20any`20warranty,`20including
  408. V`20any`20implied
  409. X`20*`20warranties`20of`20merchantability`20or`20fitness`20for`20a`20particular
  410. V`20purpose.
  411. X`20*`20The`20author`20shall`20not`20be`20liable`20for`20any`20damages`20result
  412. Ving`20from`20the
  413. X`20*`20use`20of`20this`20software.`20`20By`20using`20this`20software,`20the
  414. V`20user`20agrees
  415. X`20*`20to`20these`20terms.
  416. X`20*/
  417. X
  418. X#include`20"ldb.h"
  419. X
  420. X
  421. X/*----------------------------------------------------------------------
  422. X`20*`09get_lock`20--`20attempt`20to`20open`20a`20lock`20file,`20exit`20if`20it
  423. V`20exists
  424. X`20*
  425. X`20*`20This`20function`20attempts`20to`20create`20a`20file`20in`20such`20a`20w
  426. Vay`20that,
  427. X`20*`20if`20the`20file`20exists,`20the`20create`20will`20fail.`20`20If`20the
  428. V`20create`20succeeds,
  429. X`20*`20we`20"own"`20the`20ldb`20lock,`20and`20have`20the`20exclusive`20right
  430. V`20to`20access
  431. X`20*`20the`20ldb`20data`20files`20in`20this`20directory.`20`20If`20the`20creat
  432. Ve`20fails,
  433. X`20*`20some`20other`20ldb`20already`20has`20the`20lock`20and`20we`20exit.
  434. X`20*
  435. X`20*`20This`20uses`20the`20O_EXCL`20flag`20to`20open,`20which`20as`20far`20as
  436. V`20I`20know`20is
  437. X`20*`20supported`20on`20all`20UNIX`20flavors.`20`20If`20it`20isn't`20on`20your
  438. Vs:
  439. X`20*`09a.`20Please`20mail`20me`20at`20ross@emf780.den.mmc.com`20and`20tell`20m
  440. Ve
  441. X`20*`09`20`20`20what`20your`20system`20is.
  442. X`20*`09b.`20try`20replacing`20open(fn,O_...,0644)`20with`20creat(fn,0444).
  443. X`20*----------------------------------------------------------------------
  444. X`20*/
  445. X
  446. Xget_lock(fn)
  447. Xchar`20*fn;
  448. X`7B
  449. Xint`20fd;
  450. Xstruct`20stat`20s;
  451. X
  452. Xif`20(`20(fd`20=`20open(fn,O_WRONLY`7CO_CREAT`7CO_EXCL,0644))`20<`200)`20`7B
  453. X`09printf("ERROR:`20Ldb`20is`20already`20running`20in`20this`20account`20--
  454. V`20exiting.`5Cn`5Cn");
  455. X`09printf("If`20you`20are`20sure`20no`20other`20ldb`20is`20active,`20you`20can
  456. V`20remove`5Cn");
  457. X`09printf("the`20lock`20with`20the`20following`20command:`5Cn`5Cn");
  458. X#ifdef`20VMS
  459. X`09printf("`5Ct$`20delete`20sys$login:%s;*`5Cn",fn);
  460. X#else
  461. X`09if`20(*fn`20==`20'/')
  462. X`09`09printf("`5Ct$`20rm`20%s`5Cn",fn);
  463. X`09else
  464. X`09`09printf("`5Ct$`20rm`20$HOME/%s`5Cn",fn);
  465. X#endif
  466. X`09printf(
  467. X`09"`5CnPlease`20be`20certain`20no`20other`20ldb`20is`20running`20before`20doi
  468. Vng`20this.`5Cn`5Cn");
  469. X`09if`20(stat(fn,`26s)`20>=`200)
  470. X`09`09printf("The`20lock`20file`20was`20created`20%s`5Cn",ctime(`26s.st_ctime)
  471. V);
  472. X`09exit(STAT_ABORT);`09/*`20DON'T`20call`20ldbexit,`20it`20calls`20release_loc
  473. Vk`20*/
  474. X`09`7D
  475. Xclose(fd);`09`09/*`20success,`20close`20the`20file`20and`20return`20*/
  476. X`7D
  477. $ call unpack LOCK.C;1 1409310034 ""
  478. $!
  479. $ create 'f'
  480. X/*`09main.c`09`098/3/91
  481. X`20*
  482. X`20*`20Copyright`201991`20`20Perry`20R.`20Ross
  483. X`20*
  484. X`20*`20Permission`20to`20use,`20copy,`20modify,`20and`20distribute`20this`20so
  485. Vftware`20and`20its
  486. X`20*`20documentation`20without`20fee`20is`20hereby`20granted,`20subject`20to
  487. V`20the`20restrictions
  488. X`20*`20detailed`20in`20the`20README`20file,`20which`20is`20included`20here`20b
  489. Vy`20reference.
  490. X`20*`20Any`20other`20use`20requires`20written`20permission`20from`20the`20auth
  491. Vor.`20`20This`20software
  492. X`20*`20is`20distributed`20"as`20is"`20without`20any`20warranty,`20including
  493. V`20any`20implied
  494. X`20*`20warranties`20of`20merchantability`20or`20fitness`20for`20a`20particular
  495. V`20purpose.
  496. X`20*`20The`20author`20shall`20not`20be`20liable`20for`20any`20damages`20result
  497. Ving`20from`20the
  498. X`20*`20use`20of`20this`20software.`20`20By`20using`20this`20software,`20the
  499. V`20user`20agrees
  500. X`20*`20to`20these`20terms.
  501. X`20*/
  502. X
  503. X#include`20"ldb.h"
  504. X
  505. X/*============================================================================
  506. V
  507. X`20*`09ldb`20--`09Long`20Distance`20Backgammon
  508. X`20*
  509. X`20*`20The`20following`20arguments`20are`20recognized:
  510. X`20*`09-read`09`09Mail`20is`20read,`20and`20the`20games`20are`20updated`20and
  511. V`20saved.
  512. X`20*`09`09`09The`20user`20is`20not`20prompted`20for`20his`20moves.
  513. X`20*`09-play`09`09Any`20games`20that`20are`20waiting`20for`20local`20input`20a
  514. Vre
  515. X`20*`09`09`09displayed`20for`20the`20user`20to`20process.`20`20No`20mail`20is
  516. V`20read.
  517. X`20*`09-color`20xy`09The`20colors`20for`20any`20games`20started`20are`20set
  518. V`20to`20x`20and`20y.
  519. X`20*`09`09`09The`20first`20color`20is`20played`20by`20the`20local`20user,`20an
  520. Vd`20the
  521. X`20*`09`09`09other`20is`20played`20by`20the`20opponent.`20`20Legal`20color
  522. X`20*`09`09`09characters`20are`20upper`20and`20lower`20case`20letters.
  523. X`20*`09`09`09The`20default`20is`20"-color`20rw".
  524. X`20*`09-direction`20up/down
  525. X`20*`09`09`09The`20direction`20of`20play`20for`20the`20local`20user`20is`20set
  526. V
  527. X`20*`09`09`09to`20the`20specified`20value.`20`20The`20default`20is
  528. X`20*`09`09`09"-direction`20up".
  529. X`20*`09-myaddr`20addr`09Override`20the`20"myaddr"`20field`20of`20.ldbrc`20for
  530. V`20any
  531. X`20*`09`09`09games`20started`20by`20this`20invocation`20of`20ldb.`20`20This
  532. X`20*`09`09`09is`20effective`20only`20for`20games`20started`20by`20-start
  533. X`20*`09`09`09and`20only`20for`20-start's`20that`20appear`20after`20the`20-myad
  534. Vdr
  535. X`20*`09`09`09on`20the`20command`20line.
  536. X`20*`09-start`20user`09A`20game`20is`20started`20with`20the`20specified`20user
  537. V.`20`20User`20may
  538. X`20*`09`09`09be`20either`20an`20e-mail`20address`20or`20an`20alias`20for`20an
  539. X`20*`09`09`09opponent`20that`20has`20been`20played`20previously.
  540. X`20*`09-remotestart`20user1`20user2
  541. X`20*`09`09`09A`20game`20is`20started`20between`20user1`20and`20user2.`20`20The
  542. V`20local
  543. X`20*`09`09`09host`20sends`20a`20remote`20start`20message`20to`20user1`20instru
  544. Vcting
  545. X`20*`09`09`09it`20to`20start`20a`20game`20with`20user2.`20`20The`20local`20hos
  546. Vt
  547. X`20*`09`09`09does`20not`20participate`20thereafter`20in`20the`20game.
  548. X`20*`09`09`09For`20the`20purposes`20of`20the`20-color`20and`20-direction`20opt
  549. Vions,
  550. X`20*`09`09`09user1`20is`20considered`20the`20local`20user.
  551. X`20*`09-broadcast`20file
  552. X`20*`09`09`09A`20file`20is`20mailed`20to`20all`20opponents.`20`20This`20is`20u
  553. Vseful
  554. X`20*`09`09`09for`20announcing`20vacation`20absences,`20etc.
  555. X`20*`09-help`09`09A`20summary`20of`20available`20options`20is`20printed.`20
  556. V`20This
  557. X`20*`09`09`09list`20may`20be`20more`20up`20to`20date`20than`20these`20comments
  558. V.
  559. X`20*`09-jacoby`09`09Enables`20the`20jacoby`20rule`20for`20any`20games`20subseq
  560. Vuently
  561. X`20*`09`09`09started.`20`20This`20rule`20states`20that`20gammons`20or`20backga
  562. Vmmons
  563. X`20*`09`09`09only`20count`20as`201`20when`20neither`20player`20doubled`20durin
  564. Vg
  565. X`20*`09`09`09the`20game.
  566. X`20*`09-crawford`09Enables`20the`20crawford`20rule`20for`20any`20games`20subse
  567. Vquently
  568. X`20*`09`09`09started.`20`20This`20rule`20prevents`20doubling`20when`20either
  569. X`20*`09`09`09player`20is`20within`201`20point`20of`20winning`20the`20match.
  570. X`20*`09-european`09Enables`20european`20scoring`20for`20any`20subsequently
  571. X`20*`09`09`09created`20games.`20`20This`20rule`20makes`20backgammons`20count
  572. X`20*`09`09`09as`20double`20games,`20rather`20than`20triple.
  573. X`20*`09-permanent`09Marks`20any`20subsequently`20created`20games`20as`20perman
  574. Vent.
  575. X`20*`09`09`09Permanent`20games`20will`20be`20restarted`20whenever`20they
  576. X`20*`09`09`09end.`20`20This`20is`20for`20people`20you`20play`20all`20the`20tim
  577. Ve.
  578. X`20*`09`09`09Permanent`20games`20must`20be`20deleted`20via`20-control.
  579. X`20*`09-match`20points`09Marks`20any`20subsequently`20created`20games`20as`20m
  580. Vatches
  581. X`20*`09`09`09that`20play`20to`20the`20specified`20number`20of`20points.
  582. X`20*`09`09`09Games`20will`20be`20restarted`20until`20one`20player`20wins
  583. X`20*`09`09`09this`20number`20of`20points.
  584. X`20*`09-control`09Enters`20control`20mode.`20`20No`20games`20may`20be`20starte
  585. Vd
  586. X`20*`09`09`09or`20played.`20`20Each`20game`20is`20displayed,`20along`20with
  587. X`20*`09`09`09a`20menu`20that`20allows`20various`20administrative
  588. X`20*`09`09`09functions`20to`20be`20performed.
  589. X`20*`09-reconstruct`20file
  590. X`20*`09`09`09This`20option`20allows`20you`20to`20recover`20your`20.ldbdata
  591. X`20*`09`09`09file`20even`20if`20you`20lose`20all`20copies.`20`20Simply`20have
  592. X`20*`09`09`09all`20your`20opponents`20send`20you`20their`20.ldbdata`20files
  593. X`20*`09`09`09and,`20one`20by`20one,`20feed`20them`20into`20ldb`20with`20the
  594. X`20*`09`09`09-reconstruct`20option.`20`20Ldb`20will`20scan`20the`20file,
  595. X`20*`09`09`09find`20any`20games`20that`20have`20your`20name`20as`20the
  596. X`20*`09`09`09opponent,`20and`20rebuild`20your`20game`20data`20using`20the
  597. X`20*`09`09`09data`20in`20that`20game.
  598. X`20*`09-score`09`09Print`20the`20cumulative`20score`20for`20all`20your`20oppon
  599. Vents.
  600. X`20*
  601. X`20*`20If`20neither`20-read`20or`20-play`20is`20given,`20the`20default`20is
  602. V`20to`20do`20both;`20incoming`20mail
  603. X`20*`20is`20read,`20then`20any`20games`20requiring`20the`20user's`20attention
  604. V`20are`20displayed.
  605. X`20*
  606. X`20*`20Note`20that`20the`20-start`20and`20-remotestart`20options`20use`20the
  607. V`20color`20and`20direction
  608. X`20*`20options`20that`20have`20been`20set`20*at`20the`20time`20the`20argument
  609. V`20is`20processed*.
  610. X`20*`20Thus,
  611. X`20*
  612. X`20*`09ldb`20-start`20joe@momma`20-color`20rb
  613. X`20*
  614. X`20*`20will`20NOT`20use`20the`20colors`20r`20and`20b`20for`20the`20game`20with
  615. V`20joe,`20but
  616. X`20*
  617. X`20*`09ldb`20-color`20rb`20-start`20joe@momma
  618. X`20*
  619. X`20*`20will.`20`20The`20color`20and`20direction`20arguments`20may`20be`20chang
  620. Ved`20between`20-start
  621. X`20*`20and`20-remotestart`20arguments.`20`20For`20example,
  622. X`20*
  623. X`20*`09ldb`20-color`20wr`20-direction`20down`20-start`20user1`20-direction`20u
  624. Vp`20-start`20user2
  625. X`20*
  626. X`20*`20will`20start`20a`20game`20with`20user1`20with`20your`20direction`20bein
  627. Vg`20down,`20and`20one`20with
  628. X`20*`20user2`20with`20your`20direction`20being`20up.
  629. X`20*
  630. X`20*--------------------------------------------------------------------------
  631. V--
  632. X`20*`09`09`09`09REVISION`20HISTORY
  633. X`20***`20Version`2001`20`20`20Rev`200`20`20`20Patch`200
  634. X`20*`201.`09Initial`20release.`20`20Countless`20helpful`20suggestions`20from
  635. V`20Karen`20Ward.
  636. X`20*
  637. X`20***`20Version`2001`20`20`20Rev`201`20`20`20Patch`200
  638. X`20*`201.`09The`20personal`20name`20and`20e-mail`20address`20printed`20on`20th
  639. Ve`20top`20line
  640. X`20*`09were`20switched.`20`20It`20makes`20more`20sense`20to`20be`20playing`20a
  641. V`20person`20rather
  642. X`20*`09than`20an`20address.`20`20If`20the`20e-mail`20address`20is`20too`20long
  643. V`20to`20fit`20on
  644. X`20*`09the`20top`20line,`20it`20is`20truncated`20and`20an`20ellipsis`20is`20ad
  645. Vded.
  646. X`20*`202.`09Pressing`20ESC`20while`20entering`20a`20comment`20now`20returns
  647. V`20you`20to`20the
  648. X`20*`09previous`20menu`20and`20discards`20the`20comment.`20`20This`20allows
  649. V`20you`20to
  650. X`20*`09change`20your`20mind`20after`20hitting`20"Send",`20for`20example.`20
  651. V`20Suggested
  652. X`20*`09by`20Franc,ois`20Pinard.
  653. X`20*`203.`09The`20checkpoint`20code`20was`20moved`20to`20sendpkt(),`20where
  654. V`20the`20games
  655. X`20*`09are`20saved`20before`20the`20packet`20is`20sent.`20`20This`20removes
  656. V`20a`20window
  657. X`20*`09where`20a`20packet`20could`20be`20sent`20but`20ldb`20could`20croak`20be
  658. Vfore`20saving
  659. X`20*`09the`20game.`20`20Suggested`20by`20Earle`20Ake.
  660. X`20*`204.`09Ldb`20will`20not`20ask`20for`20the`20second`20digit`20of`20a`20poi
  661. Vnt`20number`20when:
  662. X`20*`09`09The`20first`20digit`20is`203`20-`209,
  663. X`20*`09`09The`20first`20digit`20is`201`20and`20there`20is`20no`20point`20in
  664. V`2010`20-`2019
  665. X`20*`09`09`09that`20could`20use`20the`20selected`20roll,`20or
  666. X`20*`09`09The`20first`20digit`20is`202`20and`20there`20is`20no`20point`20in
  667. V`2020`20-`2024
  668. X`20*`09`09`09that`20could`20use`20the`20selected`20roll.
  669. X`20*`09Suggested`20by`20Earle`20Ake`20and`20Franc,ois`20Pinard.
  670. X`20*`205.`09When`20a`20roll`20is`20selected`20and`20a`20piece`20is`20on`20the
  671. V`20bar,`20no`20point`20is
  672. X`20*`09prompted`20for,`20since`20moving`20off`20the`20bar`20is`20the`20only
  673. V`20legal`20move.
  674. X`20*`09Suggested`20by`20Franc,ois`20Pinard.
  675. X`20*`206.`09The`20Makefile`20now`20used`20$(CC)`20instead`20of`20cc.`20`20Sugg
  676. Vested`20by
  677. X`20*`09Franc,ois`20Pinard.
  678. X`20*`207.`09A`20number`20of`20patches`20to`20make`20ldb`20run`20under`20SCO
  679. V`20Xenix`20(and`20probably
  680. X`20*`09SCO`20UNIX`20as`20well)`20were`20sent`20by`20Dinesh`20Vichare.
  681. X`20*`208.`09A`20bare`20bones`20rename`20function`20is`20included`20for`20those
  682. V`20systems`20that
  683. X`20*`09don't`20have`20one.`20`20Suggested`20by`20Franc,ois`20Pinard.
  684. X`20*`209.`09Comments`20are`20now`20rot13'd`20before`20they`20are`20sent.`20
  685. V`20This`20keeps
  686. X`20*`09them`20from`20being`20read`20while`20mail`20is`20extracted.`20`20They
  687. V`20are
  688. X`20*`09rotated`20back`20when`20ldb`20displays`20them.`20`20This`20is`20disable
  689. Vd`20if`20the
  690. X`20*`09opponent`20is`20using`20the`20old`20(1.0)`20ldb`20version,`20so`201.1
  691. V`20and`201.0
  692. X`20*`09ldb's`20will`20still`20work`20together.`20`20The`20only`20catch`20is
  693. V`20when`20you`20switch
  694. X`20*`09from`201.0`20to`201.1`20with`20games`20in`20progress,`20your`20opponent
  695. Vs`20won't`20know
  696. X`20*`09you've`20switched`20until`20you`20send`20them`20a`20move.`20`20As`20a
  697. V`20result,`20the
  698. X`20*`09comment`20from`20their`20next`20message`20will`20be`20garbled.`20`20To
  699. V`20avoid`20this,
  700. X`20*`09do`20"ldb`20-read"`20under`201.0,`20then`20switch`20to`201.1`20to`20pla
  701. Vy.`20`20This`20is
  702. X`20*`09only`20necessary`20once,`20after`20that`20your`20opponent's`20will`20kn
  703. Vow`20you
  704. X`20*`09are`20using`201.1`20and`20the`20messages`20will`20work`20normally.
  705. X`20*`09Suggested`20by`20Franc,ois`20Pinard.
  706. X`20*`2010.`09Ldb`20now`20clears`20the`20screen`20before`20exiting.`20`20Keeps
  707. V`20wandering
  708. X`20*`09manager`20types`20from`20seeing`20the`20remnants`20of`20a`20game.
  709. X`20*`2011.`09The`20sequence`20number`20warning`20was`20removed`20for`20leftove
  710. Vr`20messages
  711. X`20*`09from`20dead`20games.
  712. X`20*`2012.`09There`20is`20now`20a`20"Press`20<return>`20to`20continue"`20befor
  713. Ve`20the`20screen
  714. X`20*`09is`20drawn`20if`20any`20messages`20were`20printed.`20`20This`20lets`20y
  715. Vou`20read
  716. X`20*`09the`20messages`20before`20the`20screen`20is`20cleared.`20`20Suggested
  717. V`20by
  718. X`20*`09practically`20everybody.
  719. X`20*`2013.`09Default`20file`20names`20for`20vms`20are`20now`20ldb.rc,`20ldb.da
  720. Vta,`20`20and`20ldb.olddata.
  721. X`20*`09This`20keeps`20the`20ldb`20files`20together`20and`20out`20of`20the`20wa
  722. Vy,`20since`20vms
  723. X`20*`09doesn't`20treat`20filenames`20with`20a`20leading`20'.'`20like`20UNIX
  724. V`20does.
  725. X`20*`09Suggested`20by`20Earle`20Ake.
  726. X`20*`2014.`09There`20is`20now`20a`20debug`20setting`20in`20.ldbrc.`20`20It`20i
  727. Vs`20a`20mask,`20with`20each
  728. X`20*`09bit`20enabling`20debug`20info`20from`20a`20different`20piece`20of`20cod
  729. Ve.`20`20The
  730. X`20*`09bits`20are`20defined`20as`20DB_*`20in`20ldb.h`20Suggested`20by`20Earle
  731. V`20Ake.
  732. X`20*`2015.`09A`20sum`20of`20all`20rolls`20is`20kept`20in`20the`20"rolls"`20and
  733. V`20"doubles"`20fields
  734. X`20*`09of`20the`20game`20structure.`20`20This`20counts`20the`20number`20of`20e
  735. Vach`20type`20of
  736. X`20*`09roll`20you`20get,`20and`20the`20number`20of`20doubles`20of`20each`20typ
  737. Ve.
  738. X`20*`09The`20same`20is`20true`20for`20your`20opponent's`20rolls`20and`20double
  739. Vs`20in
  740. X`20*`09the`20oprolls`20and`20opdoubles`20fields.`20`20Suggested`20by`20Earle
  741. V`20Ake.
  742. X`20*`2016.`09The`20crawford`20and`20jacoby`20rules`20are`20now`20supported.
  743. V`20`20They`20are`20activated
  744. X`20*`09by`20the`20-crawford`20and`20-jacoby`20command`20line`20options,`20and
  745. V`20can`20only
  746. X`20*`09be`20enabled`20by`20whoever`20starts`20the`20game.`20`20If`20they`20are
  747. V`20used`20to`20start
  748. X`20*`09a`20game`20with`20a`20version`20of`20ldb`20that`20does`20not`20support
  749. V`20them,`20a`20message
  750. X`20*`09is`20printed`20and`20they`20are`20disabled.
  751. X`20*`2017.`09Ldb`20now`20allows`20a`20game`20to`20be`20declared`20"permanent",
  752. V`20meaning`20that
  753. X`20*`09it`20is`20automatically`20restarted`20when`20it`20is`20over.`20`20This
  754. V`20is`20activated
  755. X`20*`09the`20the`20-permanent`20command`20line`20option,`20and`20can`20only
  756. V`20be`20enabled
  757. X`20*`09by`20whoever`20starts`20the`20game.
  758. X`20*`2018.`09Ldb`20now`20supports`20match`20play.`20`20This`20is`20activated
  759. V`20by`20the`20-match
  760. X`20*`09command`20line`20options,`20which`20takes`20a`20numeric`20argument`20sp
  761. Vecifying
  762. X`20*`09how`20many`20points`20the`20match`20plays`20to.`20`20When`20a`20game
  763. V`20that`20is`20part`20of
  764. X`20*`09a`20match`20ends,`20and`20the`20specified`20number`20of`20points`20has
  765. V`20not`20been`20reached,
  766. X`20*`09the`20game`20is`20restarted.
  767. X`20*`2019.`09The`20"buttons"`20in`20the`20menu`20in`20fe_curses`20now`20light
  768. V`20up`20to`20show`20the
  769. X`20*`09item`20that`20was`20chosen.
  770. X`20*`2020.`09Ldb`20now`20supports`20the`20"european`20rule",`20which`20states
  771. V`20that`20backgammons
  772. X`20*`09only`20count`20double,`20not`20triple,`20the`20game`20value.
  773. X`20*`2021.`09Ldb`20now`20creates`20a`20lock`20file`20when`20it`20starts`20in
  774. V`20such`20a`20way`20as`20to
  775. X`20*`09prevent`20multiple`20ldb`20processes`20from`20running`20in`20the`20same
  776. V`20account`20at`20the
  777. X`20*`09same`20time.`20`20The`20lock`20code`20does`20not`20depend`20on`20any
  778. V`20operating`20system
  779. X`20*`09locking`20features,`20other`20than`20O_EXCL,`20and`20so`20should`20be
  780. V`20fairly`20portable.
  781. X`20*`2022.`09There`20is`20now`20an`20option`20in`20.ldbrc`20to`20automatically
  782. V`20delete`20mail
  783. X`20*`09files`20after`20they`20have`20been`20read.`20`20It`20will`20refuse`20to
  784. V`20delete
  785. X`20*`09files`20that`20begin`20with`20'/'`20(on`20UNIX`20only)`20to`20help`20pr
  786. Vevent
  787. X`20*`09catastrophic`20mistakes.`20`20This`20option`20is`20off`20by`20default,
  788. X`20*`09and`20should`20only`20be`20used`20with`20great`20care.
  789. X`20*`09You`20should`20also`20read`20the`20disclaimer`20at`20the`20top`20of`20t
  790. Vhis`20(and`20all
  791. X`20*`09other)`20files,`20where`20it`20says`20I'm`20not`20responsible.`20`20Cav
  792. Veat`20User.
  793. X`20*`2023.`09A`20"timeout"`20setting`20has`20been`20added`20to`20.ldbrc.`20
  794. V`20Games`20that`20have
  795. X`20*`09not`20been`20accessed`20for`20more`20than`20"timeout"`20days`20(default
  796. V`207),
  797. X`20*`09and`20are`20waiting`20on`20remote`20input,`20have`20the`20last`20packet
  798. V`20automatically
  799. X`20*`09resent.`20`20If`20timeout`20is`20set`20to`200,`20automatic`20resends
  800. V`20are`20disabled.
  801. X`20*`2024.`09A`20"keepold"`20setting`20has`20been`20added`20to`20.ldbrc.`20
  802. V`20Games`20that`20are`20over
  803. X`20*`09are`20retained`20in`20.ldbdata`20for`20"keepold"`20days`20(default`207)
  804. V,`20allowing
  805. X`20*`09time`20for`20the`20last`20move`20to`20be`20resent`20if`20necessary.`20
  806. V`20If`20"keepold"`20is
  807. X`20*`09set`20to`200,`20games`20are`20deleted`20as`20soon`20as`20they`20are`20o
  808. Vver.
  809. X`20*`2025.`09Old`20start`20packets`20are`20now`20rejected.`20`20To`20do`20this
  810. V,`20a`20new`20file
  811. X`20*`09called`20the`20"people"`20file`20is`20maintained.`20`20This`20file`20is
  812. V`20organised
  813. X`20*`09by`20opponent`20address,`20and`20stores`20the`20start`20time`20of`20the
  814. V`20newest`20completed
  815. X`20*`09game,`20called`20the`20"fence".`20`20Any`20start`20packets`20not`20newe
  816. Vr`20than`20the
  817. X`20*`09fence`20are`20discarded.`20`20The`20only`20way`20a`20legitimate`20start
  818. V`20packet`20would`20be
  819. X`20*`09rejected`20is`20if`20it`20were`20not`20fed`20to`20ldb`20until`20after
  820. V`20another`20game`20with
  821. X`20*`09the`20same`20opponent`20had`20been`20started`20and`20finished.`20`20Thi
  822. Vs`20should`20never
  823. X`20*`09happen,`20but`20if`20it`20did,`20all`20that`20would`20be`20required`20t
  824. Vo`20fix`20it`20would
  825. X`20*`09be`20to`20have`20the`20opponent`20resend`20the`20start`20packet`20via
  826. V`20-control.
  827. X`20*`2026.`09The`20people`20file`20also`20stores`20the`20opponent's`20name`20a
  828. Vnd
  829. X`20*`09an`20alias,`20or`20nickname,`20for`20the`20opponent.`20`20The`20alias
  830. V`20is`20initialized
  831. X`20*`09to`20the`20first`20word`20of`20the`20opponent's`20name`20with`20all`20c
  832. Vapitals`20changed
  833. X`20*`09to`20lower`20case.`20`20To`20change`20an`20opponent's`20alias,`20a`20te
  834. Vxt`20editor`20may
  835. X`20*`09be`20used`20on`20the`20people`20file.`20`20The`20-start`20command`20wil
  836. Vl`20take`20an
  837. X`20*`09alias`20in`20place`20of`20an`20e-mail`20address.`20`20There`20is`20no
  838. V`20check`20for
  839. X`20*`09duplicate`20aliases,`20and`20if`20one`20is`20used`20in`20a`20-start`20c
  840. Vommand,`20the
  841. X`20*`09game`20will`20be`20started`20with`20the`20first`20record`20found`20in
  842. V`20the`20people
  843. X`20*`09file`20with`20that`20alias.
  844. X`20*`2027.`09The`20people`20file`20also`20stores`20a`20record`20of`20all`20gam
  845. Ves`20won/lost`20to
  846. X`20*`09that`20opponent.`20`20The`20data`20stored`20includes`20games`20won/lost
  847. V,`20points
  848. X`20*`09won/lost,`20gammons`20won/lost,`20backgammons`20won/lost,`20and`20match
  849. Ves`20won/lost.
  850. X`20*`09There`20is`20currently`20no`20utility`20to`20print`20these`20out,`20but
  851. V`20they`20can
  852. X`20*`09be`20extracted`20from`20the`20people`20file`20manually.`20`20See`20the
  853. V`20definitions
  854. X`20*`09for`20SC_*`20in`20ldb.h`20to`20see`20which`20number`20is`20which.
  855. X`20*`2028.`09There`20is`20now`20a`20way`20to`20reconstruct`20the`20.ldbdata
  856. V`20file`20from`20your
  857. X`20*`09opponents'`20.ldbdata`20files.`20`20Just`20have`20them`20mail`20their
  858. V`20ldbdata
  859. X`20*`09files`20to`20you,`20remove`20the`20mail`20header,`20and`20run:
  860. X`20*`09`09ldb`20-reconstruct`20file
  861. X`20*`09where`20file`20is`20the`20file`20containing`20the`20opponent's`20ldbdat
  862. Va`20file.
  863. X`20*`09Each`20game`20in`20that`20file`20showing`20you`20as`20the`20opponent
  864. V`20is`20extracted
  865. X`20*`09and`20inserted`20into`20your`20game`20list.`20`20You`20will`20be`20prom
  866. Vpted`20for`20the
  867. X`20*`09address`20of`20your`20opponent`20(and`20name,`20if`20they`20are`20not
  868. V`20in`20the
  869. X`20*`09people`20file)`20for`20each`20game`20found.
  870. X`20*`2029.`09The`20people`20file`20has`20a`20method`20for`20handling`20people
  871. V`20with`20multiple
  872. X`20*`09e-mail`20addresses.`20`20When`20a`20new`20opponent`20is`20found`20with
  873. V`20the
  874. X`20*`09same`20name`20as`20an`20existing`20one,`20but`20a`20different`20address
  875. V,`20the
  876. X`20*`09user`20is`20asked`20if`20these`20addresses`20refer`20to`20the`20same
  877. V`20person.
  878. X`20*`09If`20they`20do,`20an`20"equiv"`20record`20is`20added`20to`20the`20peopl
  879. Ve`20file,
  880. X`20*`09which`20merely`20records`20that`20the`20second`20address`20refers`20to
  881. V`20the
  882. X`20*`09same`20person`20as`20the`20first.`20`20If`20they`20don't`20(e.g.`20John
  883. V`20Smith),
  884. X`20*`09two`20separate`20people`20records`20are`20created`20for`20the`20differe
  885. Vnt`20people.
  886. X`20*`2030.`09There`20is`20now`20a`20way`20to`20request`20a`20resend`20from`20y
  887. Vour`20opponent`20under
  888. X`20*`09-control.`20`20The`20menu`20item`20is`20"Get`20Resend",`20since`20"Requ
  889. Vest`20Resend"
  890. X`20*`09would`20have`20used`20the`20same`20first`20letter`20as`20"Resend".`20(o
  891. Vh`20well)
  892. X`20*`09A`20special`20packet`20is`20sent`20to`20your`20opponent;`20when`20his
  893. V`20ldb`20receives`20it,
  894. X`20*`09it`20will`20perform`20a`20resend`20automatically.`20`20This`20feature
  895. V`20is`20disabled
  896. X`20*`09if`20the`20opversion`20field`20of`20the`20game`20structure`20indicates
  897. V`20your
  898. X`20*`09opponent`20is`20using`20a`20pre-1.1`20version`20of`20ldb.`20`20Sending
  899. V`20the`20resend
  900. X`20*`09packet`20to`20an`20ldb`20older`20than`201.1`20would`20cause`20it`20to
  901. V`20abort.`20`20Oops.
  902. X`20*`2031.`09Any`20upper`20or`20lower`20case`20letters`20may`20now`20be`20used
  903. V`20to`20draw`20the
  904. X`20*`09pieces`20on`20the`20board.`20`20Previously`20only`20r,`20w,`20and`20b
  905. V`20were`20used.
  906. X`20*`09As`20r,`20w,`20and`20b`20stood`20for`20red,`20white,`20and`20black,`20t
  907. Vhe`20option
  908. X`20*`09to`20set`20them`20was`20called`20-color.`20`20While`20the`20letters`20n
  909. Vo`20longer
  910. X`20*`09(necessarily)`20represent`20colors,`20the`20option`20is`20still`20-colo
  911. Vr.
  912. X`20*`2032.`09A`20screen`20dump`20of`20a`20game`20may`20be`20obtained`20via`20t
  913. Vhe`20-control`20menu.
  914. X`20*`09The`20dump`20goes`20to`20ldb_screen.dmp.
  915. X`20*
  916. X`20*`20---`20`20The`20following`20modifications`20made`20by`20Earle`20Ake.
  917. X`20*
  918. X`20*`201.`09A`20context-sensitive`20help`20function`20was`20added`20that`20is
  919. V`20activated`20by
  920. X`20*`09pressing`20'h'`20or`20'?'`20at`20any`20time`20other`20than`20while`20co
  921. Vmposing`20a`20message.
  922. X`20*`202.`09The`20redraw`20key`20now`20works`20under`20VMS.`20`20Clearok()`20n
  923. Veeded`20to`20be`20called
  924. X`20*`09to`20force`20a`20redraw.
  925. X`20*`203.`09The`20superkey`20function`20now`20works`20under`20VMS.`20`20It`20w
  926. Vas`20rewritten`20to
  927. X`20*`09spawn`20a`20subprocess`20and`20execute`20the`20supercmd`20if`20specifie
  928. Vd.
  929. X`20*`09The`20user`20must`20logout`20of`20the`20subprocess`20to`20resume`20the
  930. V`20game.
  931. X`20*`204.`09The`20.ldbrc`20file`20now`20contains`20reasonable`20defaults`20for
  932. V`20VMS`20when
  933. X`20*`09the`20VMS-compiled`20ldb`20creates`20it.`20`20The`20sendcmd`20setting
  934. V`20calls
  935. X`20*`09the`20IN%`20mailer`20by`20default.
  936. X`20*`205.`09Old`20versions`20of`20.oldldbdata`20are`20now`20purged.
  937. X`20*`206.`09setattr()`20and`20clrattr()`20are`20used`20instead`20of`20standout
  938. V()`20and
  939. X`20*`09standend()`20to`20get`20reverse`20video`20on`20VMS.`20`20standout()`20o
  940. Vn`20VMS
  941. X`20*`09used`20bold`20instead`20of`20reverse`20video,`20which`20made`20the`20cu
  942. Vbe
  943. X`20*`09look`20non-cubical.
  944. X`20*`207.`09The`20current`20pip`20count`20for`20you`20and`20your`20opponent
  945. V`20are`20displayed
  946. X`20*`09above`20the`20board.`20`20These`20change`20depending`20on`20which`20boa
  947. Vrd`20is
  948. X`20*`09displayed,`20and`20are`20updated`20as`20you`20move.
  949. X`20*`208.`09An`20extensive`20display`20of`20statistics`20regarding`20the`20num
  950. Vber`20and
  951. X`20*`09frequency`20of`20rolls`20and`20doubles`20for`20both`20users`20can`20be
  952. V`20displayed
  953. X`20*`09by`20pressing`20the`20%`20or`20#`20keys.`20`20This`20data`20can`20also
  954. V`20be`20displayed
  955. X`20*`09as`20a`20histogram.
  956. X`20*
  957. X`20***`20Version`2001`20`20`20Rev`202`20`20`20Patch`200
  958. X`20***`20Note`20Rev`202`20was`20never`20officially`20released.`20`20A`20number
  959. V`20of`20beta`20versions
  960. X`20***`20of`201.2`20were`20distributed,`20and`20this`20led`20to`20so`20much
  961. V`20confusion`20that`20the
  962. X`20***`20official`20release`20was`20called`201.3.
  963. X`20*`201.`09The`20"Get`20Resend"`20option`20in`20-control`20is`20disabled`20fo
  964. Vr`20games
  965. X`20*`09that`20are`20over.`20`20Patch`20by`20Earle`20Ake.
  966. X`20*`202.`09All`20occurrences`20of`20"gets"`20have`20been`20replaced`20by`20"f
  967. Vgets"`20to
  968. X`20*`09avoid`20buffer`20overrun`20problems.
  969. X`20*`203.`09Ldb`20now`20detects`20games`20where`20no`20further`20contact`20is
  970. V`20possible`20and
  971. X`20*`09changes`20the`20"BAR"`20indicator`20to`20"---".
  972. X`20*`204.`09The`20"Resend"`20option`20in`20-control`20is`20disabled`20for`20ga
  973. Vmes`20that`20are`20in
  974. X`20*`09a`20"local"`20state`20(i.e.`20it`20is`20the`20local`20player's`20turn).
  975. V
  976. X`20*`205.`09The`20cumulative`20score`20from`20the`20people`20file`20can`20now
  977. V`20be`20displayed
  978. X`20*`09via`20the`20-score`20command`20line`20argument.`20`20This`20is`20simila
  979. Vr`20to`20a
  980. X`20*`09system`20implemented`20by`20Doug`20Parisek,`20but`20uses`20the`20info
  981. V`20from`20the
  982. X`20*`09people`20file`20rather`20than`20from`20a`20separate`20standings`20file.
  983. V
  984. X`20*`206.`09An`20option`20has`20been`20added`20to`20make`20ldb`20notify`20the
  985. V`20game`20starter
  986. X`20*`09when`20a`20game`20started`20by`20-remotestart`20has`20ended.`20`20If
  987. V`20a
  988. X`20*`09-notify`20<addr>`20option`20is`20on`20the`20command`20line`20before`20t
  989. Vhe
  990. X`20*`09-remotestart,`20the`20ldb`20from`20both`20players`20will`20send`20a`20m
  991. Vessage
  992. X`20*`09to`20<addr>`20when`20the`20game`20ends.`20`20This`20message`20will`20lo
  993. Vok`20like
  994. X`20*`09a`20normal`20ldb`20packet,`20but`20the`20opcode`20will`20be`20NOTIFY,
  995. V`20and
  996. X`20*`09the`20comment`20field`20will`20contain`20three`20numbers;`20these`20are
  997. V
  998. X`20*`09the`20termination`20code`20(T_*`20in`20ldb.h),`20the`20game`20value,
  999. V`20and
  1000. X`20*`09the`20backgammon`20flag`20(1`20=`20gammon,`202`20=`20backgammon,`200
  1001. V`20=`20neither).
  1002. X`20*`09Note`20that`20the`20integer`20values`20of`20the`20termination`20codes
  1003. V`20changed
  1004. X`20*`09between`20rev`201.0`20and`20rev`201.1`20--`20the`20one`20in`20the`20com
  1005. Vment`20field
  1006. X`20*`09corresponds`20to`20the`20new`20codes`20(the`20ones`20found`20in`20ldb.h
  1007. V`20from
  1008. X`20*`09rev`201.1`20or`20higher).`20`20The`20comment2`20field`20contains`20the
  1009. V`20address
  1010. X`20*`09of`20the`20opponent`20played.`20`20Ldb`20itself`20has`20no`20provisions
  1011. V`20to`20read
  1012. X`20*`09notify`20packets,`20and`20would`20not`20be`20able`20to`20do`20anything
  1013. V`20useful
  1014. X`20*`09with`20them`20if`20it`20could.`20`20They`20are`20purely`20for`20the`20u
  1015. Vse`20of`20a
  1016. X`20*`09game`20starter,`20if`20anyone`20feels`20like`20writing`20one.
  1017. X`20*`207.`09Remote`20start`20packets`20left`20in`20the`20mail`20file`20no`20lo
  1018. Vnger`20start
  1019. X`20*`09a`20new`20game`20every`20time`20ldb`20is`20run.`20`20This`20is`20done
  1020. V`20by`20scanning
  1021. X`20*`09the`20game`20list`20for`20a`20game`20where`20both`20opaddr`20and`20star
  1022. Vttime`20match
  1023. X`20*`09those`20shown`20in`20the`20remotestart`20packet,`20and`20discarding`20i
  1024. Vt`20if
  1025. X`20*`09one`20is`20found.`20`20If`20it`20is`20not`20found,`20the`20address`20is
  1026. V`20looked`20up`20in
  1027. X`20*`09the`20people`20list`20and`20the`20fence`20time,`20if`20any,`20is`20chec
  1028. Vked.
  1029. X`20*`09This`20catches`20the`20case`20where`20the`20game`20started`20by`20that
  1030. V`20remotestart
  1031. X`20*`09packet`20has`20already`20finished.`20`20Bug`20found`20by`20Mark`20Rubin
  1032. V.
  1033. X`20*`208.`09The`20-remotestart`20option`20now`20supports`20the`20crawford,`20j
  1034. Vacoby,`20europe,
  1035. X`20*`09and`20permanent`20options,`20as`20well`20as`20match`20play.
  1036. X`20*`209.`09The`20crawford`20rule`20code`20has`20been`20rewritten.`20`20It`20n
  1037. Vow`20(correctly)
  1038. X`20*`09only`20disallows`20doubling`20for`20the`20first`20game`20after`20either
  1039. V`20player
  1040. X`20*`09reaches`20match`20score`20-`201.`20`20Subsequent`20games`20allow`20doub
  1041. Vling.
  1042. X`20*`09During`20the`20crawford`20rule`20game,`20the`20C`20indicator`20above
  1043. V`20the`20board
  1044. X`20*`09is`20drawn`20in`20reverse`20video.
  1045. X`20*`2010.`09Concede`20now`20scores`20a`20gammon`20if`20the`20loser`20has`20no
  1046. Vt`20borne`20off`20any
  1047. X`20*`09pieces,`20and`20a`20backgammon`20if`20the`20loser`20has`20any`20pieces
  1048. V`20in`20the`20winners
  1049. X`20*`09inner`20table.`20`20This`20fixes`20a`20bug`20where`20Concede`20could
  1050. V`20be`20used`20to
  1051. X`20*`09avoid`20a`20gammon/backgammon.
  1052. X`20*`2011.`09Ldb`20now`20scans`20the`20mail`20file(s)`20before`20checking`20fo
  1053. Vr`20access`20timeouts.
  1054. X`20*`09Previously,`20it`20would`20perform`20automatic`20resends`20for`20games
  1055. V`20when
  1056. X`20*`09a`20message`20for`20that`20game`20was`20waiting`20in`20the`20mail,`20re
  1057. Vsulting`20in`20an
  1058. X`20*`09unnecessary`20resend.`20`20This`20was`20common`20when`20returning`20fro
  1059. Vm`20vacation,
  1060. X`20*`09for`20example,`20when`20all`20games`20would`20time`20out.
  1061. X`20*`2012.`09The`20error`20messages`20displayed`20when`20a`20move`20is`20rejec
  1062. Vted`20have`20been
  1063. X`20*`09made`20more`20understandable.`20`20Previously`20the`20same`20set`20of
  1064. V`20messages
  1065. X`20*`09were`20used`20for`20the`20local`20player`20and`20for`20received`20moves
  1066. V,`20and`20the
  1067. X`20*`09wording`20was`20somewhat`20awkward`20to`20allow`20this`20double`20usage
  1068. V.`20`20Local
  1069. X`20*`09errors`20now`20use`20the`20messages`20in`20rejlcl`5B`5D,`20while`20rece
  1070. Vived`20moves`20still
  1071. X`20*`09use`20the`20messages`20in`20rejmsg`5B`5D.
  1072. X`20*`2013.`09A`20serious`20bug`20was`20fixed`20in`20rcvop.c.`20`20restart()
  1073. V`20and`20mstart()`20did`20not
  1074. X`20*`09call`20legalmoves()`20to`20regenerate`20the`20maxused`20and`20hiused
  1075. V`20fields`20of
  1076. X`20*`09the`20game`20structure.`20`20The`20consequence`20of`20this`20for`20rest
  1077. Vart()`20is`20that
  1078. X`20*`09move`20checking`20will`20not`20work`20for`20the`20first`20move`20of`20a
  1079. Vny`20game`20that`20had
  1080. X`20*`09a`20tie`20on`20an`20opening`20roll.`20`20For`20mstart(),`20which`20star
  1081. Vts`20the`20next
  1082. X`20*`09game`20of`20a`20match,`20maxused`20and`20hiused`20will`20still`20be`20w
  1083. Vhatever`20they
  1084. X`20*`09were`20for`20the`20last`20move`20of`20the`20previous`20game,`20which
  1085. V`20could`20result`20in
  1086. X`20*`09either`20allowing`20an`20illegal`20move`20or`20disallowing`20a`20legal
  1087. V`20one.
  1088. X`20*`09Bug`20found`20by`20Earle`20Ake.
  1089. X`20*`2014.`09Cbreak`20is`20now`20turned`20off`20during`20the`20supercmd.
  1090. X`20*`2015.`09Any`20printing`20character`20(other`20than`20space)`20is`20allowe
  1091. Vd`20to`20be`20used
  1092. X`20*`09to`20draw`20game`20pieces.`20`20These`20can`20be`20upper`20or`20lower
  1093. V`20case`20letters,
  1094. X`20*`09numbers,`20or`20punctuation.`20`20The`20only`20restriction`20is`20that
  1095. V`20the`20characters
  1096. X`20*`09used`20may`20not`20be`20the`20same`20for`20both`20players.`20`20This
  1097. V`20includes`20using
  1098. X`20*`09the`20upper`20and`20lower`20case`20of`20the`20same`20letter.
  1099. X`20*`2016.`09Command`20line`20options`20may`20now`20be`20abbreviated`20by`20th
  1100. Ve`20shortest
  1101. X`20*`09unique`20string.
  1102. X`20*`2017.`09If`20the`20-broadcast`20option`20is`20given`20without`20a`20file
  1103. V`20argument,`20it
  1104. X`20*`09reads`20from`20stdin.`20`20-broadcast`20also`20reads`20the`20people`20f
  1105. Vile`20instead
  1106. X`20*`09of`20the`20game`20file,`20so`20duplicate`20messages`20are`20not`20sent
  1107. V`20to`20opponents
  1108. X`20*`09with`20more`20than`20one`20game`20in`20progress.
  1109. X`20*`2018.`09The`20-start`20and`20-remotestart`20options`20are`20deferred`20un
  1110. Vtil`20after`20all
  1111. X`20*`09options`20have`20been`20scanned.`20`20This`20removes`20order`20dependen
  1112. Vcies`20in
  1113. X`20*`09command`20line`20options,`20so`20that:
  1114. X`20*`09`09ldb`20-match`207`20-start`20joe
  1115. X`20*`09and`09ldb`20-start`20joe`20-match`207
  1116. X`20*`09have`20identical`20effect.`20`20Because`20of`20this`20change,`20only
  1117. V`20one`20-start`20and
  1118. X`20*`09one`20-remotestart`20may`20be`20used`20per`20run`20of`20ldb.`20`20Sugge
  1119. Vsted`20by`20Earle`20Ake.
  1120. X`20***`20Version`2001`20`20`20Rev`202`20`20`20Patch`200
  1121. X`20*`201.`09A`20warning`20is`20printed`20if`20the`20crawford`20rule`20is`20use
  1122. Vd`20with`20a`20pre-1.3
  1123. X`20*`09version`20of`20ldb.`20`20The`20Crawford`20rule`20was`20fixed`20during
  1124. V`201.2,`20but`20many
  1125. X`20*`09beta`20versions`20were`20distributed`20before`20this`20fix`20was`20incl
  1126. Vuded.
  1127. X`20*==========================================================================
  1128. V==
  1129. X`20*/
  1130. X
  1131. Xmain(argc,argv)
  1132. Xint`20argc;
  1133. Xchar`20*argv`5B`5D;
  1134. X`7B
  1135. Xstruct`20game`20*g;
  1136. Xstruct`20people`20*p;
  1137. XFILE`20*fp;
  1138. Xchar`20subj`5B128`5D;
  1139. Xchar`20*bcfile;
  1140. Xint`20i,`20j;
  1141. Xchar`20c,`20c2;
  1142. Xint`20done;
  1143. Xint`20ldbsignal();
  1144. Xint`20flags,`20match;
  1145. Xchar`20*start_addr;
  1146. Xchar`20*rst1,`20*rst2;
  1147. X
  1148. Xghead`20=`20NULL;`09`09`09/*`20init`20game`20list`20to`20empty`20*/
  1149. Xgtail`20=`20NULL;
  1150. Xsignal(SIGINT,ldbsignal);`09/*`20set`20up`20interrupt`20trap`20to`20save`20gam
  1151. Ves`20*/
  1152. XRflag`20=`201;`09`09/*`20should`20we`20try`20to`20extract`20incoming`20mail?
  1153. V`20*/
  1154. XPflag`20=`201;`09`09/*`20should`20we`20process`20waiting`20games?`20*/
  1155. XRandomInit(time((long`20*)0));`09/*`20seed`20the`20random`20number`20generator
  1156. V`20*/
  1157. X
  1158. Xreadldbrc();`09`09/*`20read`20startup`20file`20*/
  1159. X
  1160. Xget_lock(rc.lockfile);`09/*`20is`20another`20ldb`20already`20running?`20*/
  1161. X
  1162. Xcr_mycolor`20=`20rc.defclrs`5B0`5D;`09/*`20default`20color`20when`20creating
  1163. V`20games`20*/
  1164. Xcr_opcolor`20=`20rc.defclrs`5B1`5D;
  1165. Xcr_mydir`20=`20(*rc.defdir`20==`20'u')`20?`201`20:`20-1;`09/*`20default`20dire
  1166. Vction`20*/
  1167. X
  1168. Xreadgames();`09`09/*`20load`20games`20in`20progress`20*/
  1169. X
  1170. Xmatch`20=`200;`09`09/*`20default`20to`20no`20match`20play`20*/
  1171. Xflags`20=`200;`09`09/*`20default`20to`20no`20special`20rules`20or`20perm`20gam
  1172. Ves`20*/
  1173. Xnotify`20=`20NULL;`09`09/*`20default`20to`20no`20notify`20address`20*/
  1174. Xstart_addr`20=`20NULL;`09/*`20default`20to`20no`20game`20started`20*/
  1175. Xrst1`20=`20NULL;`09`09/*`20default`20to`20no`20remote`20start`20game`20*/
  1176. Xrst2`20=`20NULL;
  1177. Xfor`20(i`20=`201;`20(i`20<`20argc)`20`26`26`20(argv`5Bi`5D`5B0`5D`20==`20'-');
  1178. V`20i++)`20`7B
  1179. +-+-+-+-+-+-+-+-  END  OF PART 10 +-+-+-+-+-+-+-+-
  1180.