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

  1. Path: uunet!zaphod.mps.ohio-state.edu!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 [14/16]
  5. Date: 8 Apr 93 11:05:50 EST
  6. Organization: Science Applications Intl Corp - Dayton, OH
  7. Lines: 1122
  8. Message-ID: <1993Apr8.110550.1@dayvd.dayton.saic.com>
  9. NNTP-Posting-Host: dayvd.dayton.saic.com
  10. Xref: uunet vmsnet.sources.games:675
  11.  
  12. -+-+-+-+-+-+-+-+ START OF PART 14 -+-+-+-+-+-+-+-+
  13. X
  14. X/*----------------------------------------------------------------------
  15. X`20*`09nvscan`20--`20read`20name/value`20pairs`20from`20a`20file
  16. X`20*
  17. X`20*`20This`20function`20provides`20a`20generalized`20method`20for`20reading
  18. V`20name/value
  19. X`20*`20pairs.`20`20The`20names`20and`20value`20types`20are`20specified`20in
  20. V`20an`20array`20of
  21. X`20*`20struct`20namevalue's,`20along`20with`20an`20offset`20which`20is`20used
  22. V`20to`20store
  23. X`20*`20the`20value.`20`20The`20offset`20is`20added`20to`20a`20base`20pointer,
  24. V`20passed`20as`20the
  25. X`20*`20"st"`20argument,`20to`20form`20a`20pointer,`20which`20is`20then`20conve
  26. Vrted`20to`20the
  27. X`20*`20type`20indicated`20by`20the`20"type"`20field`20of`20the`20namevalue`20t
  28. Vable`20using
  29. X`20*`20the`20"nvtypes"`20union,`20and`20used`20to`20store`20the`20value.`20
  30. V`20The`20legal
  31. X`20*`20value`20types`20are`20defined`20in`20ldb.h`20as`20FT_*.`20`20Name/value
  32. V`20pairs`20are
  33. X`20*`20expected`20to`20be`20in`20the`20form`20"name=value`5Cn",`20with`20no
  34. V`20spaces`20before
  35. X`20*`20or`20after`20name,`20and`20with`20any`20spaces`20after`20the`20=`20or
  36. V`20before`20the
  37. X`20*`20newline`20being`20part`20of`20the`20value`20string.`20`20Comments`20are
  38. V`20indicated`20by
  39. X`20*`20a`20#`20in`20column`201,`20which`20comments`20to`20the`20end`20of`20the
  40. V`20line.
  41. X`20*----------------------------------------------------------------------
  42. X`20*/
  43. X
  44. Xchar`20*nvscan(fp,t,st)
  45. XFILE`20*fp;`09`09/*`20file`20to`20scan`20*/
  46. Xstruct`20namevalue`20*t;`09/*`20table`20of`20name/value`20pairs`20*/
  47. Xchar`20*st;`09`09/*`20really`20a`20pointer`20to`20a`20structure`20*/
  48. X`7B
  49. Xstatic`20char`20buf`5B128`5D;
  50. Xchar`20*s,`20**p;
  51. Xint`20i,`20j;
  52. Xunion`20nvtypes`20u;
  53. Xlong`20atol();
  54. X
  55. Xwhile`20(fgets(buf,sizeof(buf),fp)`20!=`20NULL)`20`7B
  56. X`09if`20(*buf`20==`20'#')`09`09`09/*`20comment`20character`20*/
  57. X`09`09continue;
  58. X`09buf`5Bstrlen(buf)-1`5D`20=`20'`5C0';`09`09/*`20clobber`20the`20newline`20*/
  59. V
  60. X`09if`20(`20(s`20=`20strchr(buf,'='))`20==`20NULL)
  61. X`09`09return(buf);`09`09`09/*`20bad`20line,`20return`20it`20*/
  62. X`09*s++`20=`20'`5C0';
  63. X`09for`20(i`20=`200;`20t`5Bi`5D.name`20!=`20NULL;`20i++)
  64. X`09`09if`20(strcmp(t`5Bi`5D.name,buf)`20==`200)
  65. X`09`09`09break;
  66. X`09if`20(t`5Bi`5D.name`20==`20NULL)`09`09/*`20got`20a`20name`20we`20don't`20re
  67. Vcognize`20*/
  68. X`09`09continue;`09`09/*`20ignore`20it`20*/
  69. X`09u.nvchar`20=`20st`20+`20t`5Bi`5D.offset;`09/*`20put`20pointer`20into`20unio
  70. Vn`20*/
  71. X`09switch`20(t`5Bi`5D.type)`20`7B
  72. X`09case`20FT_CHAR:`09`09`09/*`20just`20store`20a`20single`20char`20*/
  73. X`09`09*u.nvchar`20=`20atoi(s);`09/*`20chars`20stored`20as`20ints`20in`20the
  74. V`20file`20*/
  75. X`09`09break;
  76. X`09case`20FT_INT:`09`09`09/*`20store`20an`20int`20*/
  77. X`09`09*u.nvint`20=`20atoi(s);
  78. X`09`09break;
  79. X`09case`20FT_STRING:`09`09`09/*`20store`20a`20copy`20of`20a`20string`20*/
  80. X`09`09*u.nvstring`20=`20save(s);
  81. X`09`09break;
  82. X`09case`20FT_MOVE:`09`09`09/*`20store`20a`20struct`20mv`20*/
  83. X`09`09str2mv(s,u.nvmove);
  84. X`09`09break;
  85. X`09case`20FT_BOARD:`09`09`09/*`20store`20an`20entire`20board`20*/
  86. X`09`09for`20(j`20=`200;`20j`20<`20BOARDSIZE;`20j++)`20`7B
  87. X`09`09`09u.nvboard`5Bj`5D.qty`20=`20*s++`20-`20'A';
  88. X`09`09`09u.nvboard`5Bj`5D.color`20=`20*s++;
  89. X`09`09`09`7D
  90. X`09`09break;
  91. X`09case`20FT_STRLKUP:`09`09/*`20look`20up`20string`20`26`20store`20index`20*/
  92. X`09`09p`20=`20(char`20**)`20t`5Bi`5D.dflt;`09/*`20unions`20are`20such`20a`20pa
  93. Vin`20*/
  94. X`09`09if`20(p`20==`20NULL)`09`09/*`20choke...`20*/
  95. X`09`09`09fatal("ERROR:`20NULL`20string`20table`20in`20nvscan.");
  96. X`09`09for`20(j`20=`200;`20*p;`20j++,`20p++)
  97. X`09`09`09if`20(strcmp(s,*p)`20==`200)
  98. X`09`09`09`09break;
  99. X`09`09if`20(*p`20==`20NULL)`20`7B
  100. X`09`09`09FeFinishSession();`09/*`20close`20down`20front-end`20*/
  101. X`09`09`09TFinishSession();`09/*`20close`20down`20transport`20*/
  102. X`09`09`09fprintf(stderr,"ERROR:`20unknown`20string:`20%s`5Cn",s);
  103. X`09`09`09ldbexit(STAT_ABORT);`09/*`20shouldn't`20do`20this...`20*/
  104. X`09`09`09`7D
  105. X`09`09*u.nvint`20=`20j;`09/*`20store`20integer`20opcode`20*/
  106. X`09`09break;
  107. X`09case`20FT_TIME:`09`09`09/*`20read`20in`20a`20timestamp`20*/
  108. X`09`09*u.nvtime`20=`20atol(s);
  109. X`09`09break;
  110. X`09case`20FT_INTARRAY:`09`09/*`20array`20of`20integers`20*/
  111. X`09`09for`20(j`20=`200;`20j`20<`20t`5Bi`5D.dflt;`20j++)`20`7B
  112. X`09`09`09while`20(isspace(*s))
  113. X`09`09`09`09s++;
  114. X`09`09`09(u.nvint)`5Bj`5D`20=`20atoi(s);`09`09/*`20store`20an`20int`20*/
  115. X`09`09`09while`20(isdigit(*s))`09/*`20skip`20to`20end`20of`20int`20*/
  116. X`09`09`09`09s++;
  117. X`09`09`09`7D
  118. X`09`09break;
  119. X`09case`20FT_END:`09`09`09/*`20we`20hit`20the`20end`20marker`20*/
  120. X`09`09return(NULL);`09`09/*`20return`20success`20*/
  121. X`09default:`09`09`09/*`20we`20have`20a`20bad`20nv`20table`20*/
  122. X`09`09*--s`20=`20'=';`09`09/*`20restore`20the`20buffer`20*/
  123. X`09`09return(buf);`09`09/*`20return`20bad`20line`20*/
  124. X`09`09`7D
  125. X`09`7D
  126. Xreturn(NULL);
  127. X`7D
  128. X
  129. X
  130. X
  131. X/*----------------------------------------------------------------------
  132. X`20*`09nvwrite`20--`20write`20name/value`20pairs`20into`20a`20file
  133. X`20*
  134. X`20*`20This`20function`20writes`20name/value`20pairs`20to`20a`20file`20in`20th
  135. Ve`20same`20format
  136. X`20*`20used`20by`20nvscan.`20`20Nvwrite`20is`20merely`20the`20inverse`20of`20n
  137. Vvscan,`20taking`20values
  138. X`20*`20out`20of`20the`20structure`20in`20the`20same`20manner`20nvscan`20used
  139. V`20to`20store`20them
  140. X`20*`20there,`20and`20generating`20"name=value"`20lines.`20`20One`20line`20is
  141. V`20generated`20for
  142. X`20*`20each`20element`20in`20the`20namevalue`20table,`20except`20that`20elemen
  143. Vts`20of`20type
  144. X`20*`20FT_MOVE`20whose`20"roll"`20field`20is`20<=`200`20are`20skipped,`20as
  145. V`20are`20elements`20of
  146. X`20*`20type`20FT_STRING`20that`20are`20equal`20to`20NULL.
  147. X`20*----------------------------------------------------------------------
  148. X`20*/
  149. X
  150. Xnvwrite(fp,t,st)
  151. XFILE`20*fp;`09`09`09/*`20file`20to`20write`20to`20*/
  152. Xstruct`20namevalue`20*t;`09`09/*`20table`20of`20name/value`20pairs`20*/
  153. Xchar`20*st;`09`09`09/*`20really`20a`20pointer`20to`20a`20structure`20*/
  154. X`7B
  155. Xstruct`20namevalue`20*n;
  156. Xstatic`20char`20buf`5B128`5D;
  157. Xint`20nstr;
  158. Xunion`20nvtypes`20u;
  159. Xchar`20c,`20**stbl;
  160. Xint`20j;
  161. X
  162. Xfor`20(n`20=`20t;`20n->name`20!=`20NULL;`20n++)`20`7B
  163. X`09u.nvchar`20=`20st`20+`20n->offset;
  164. X`09switch`20(n->type)`20`7B
  165. X`09case`20FT_CHAR:`09`09`09/*`20just`20store`20a`20single`20char`20*/
  166. X`09`09fprintf(fp,"%s=%d`5Cn",n->name,*u.nvchar);
  167. X`09`09break;
  168. X`09case`20FT_INT:`09`09`09/*`20store`20an`20int`20*/
  169. X`09`09fprintf(fp,"%s=%d`5Cn",n->name,*u.nvint);
  170. X`09`09break;
  171. X`09case`20FT_STRING:`09`09`09/*`20store`20a`20copy`20of`20a`20string`20*/
  172. X`09`09if`20(*u.nvstring`20!=`20NULL)/*`20skip`20NULL`20strings`20*/
  173. X`09`09`09fprintf(fp,"%s=%s`5Cn",n->name,*u.nvstring);
  174. X`09`09break;
  175. X`09case`20FT_MOVE:`09`09`09/*`20store`20a`20struct`20mv`20*/
  176. X`09`09if`20(u.nvmove->roll`20>`200)`20`7B
  177. X`09`09`09mv2str(u.nvmove,buf);
  178. X`09`09`09fprintf(fp,"%s=%s`5Cn",n->name,buf);
  179. X`09`09`09`7D
  180. X`09`09break;
  181. X`09case`20FT_BOARD:`09`09`09/*`20store`20an`20entire`20board`20*/
  182. X`09`09fprintf(fp,"%s=%s`5Cn",n->name,boardstr(u.nvboard));
  183. X`09`09break;
  184. X`09case`20FT_STRLKUP:`09`09/*`20look`20up`20string`20`26`20store`20index`20*/
  185. X`09`09stbl`20=`20(char`20**)`20n->dflt;`09/*`20hope`20char**`20fits`20in`20int
  186. V`20*/
  187. X`09`09if`20(stbl`20==`20NULL)
  188. X`09`09`09fatal("ERROR:`20NULL`20string`20table`20in`20nvwrite.");
  189. X`09`09for`20(nstr`20=`200;`20stbl`5Bnstr`5D;`20nstr++);`20/*`20#`20strings`20*
  190. V/
  191. X`09`09if`20(`20(*u.nvint`20<`200)`20`7C`7C`20(*u.nvint`20>=`20nstr)`20)`20`7B
  192. X`09`09`09FeFinishSession();`09/*`20close`20down`20front-end`20*/
  193. X`09`09`09TFinishSession();`09/*`20close`20down`20transport`20*/
  194. X`09`09`09fprintf(stderr,"ERROR:`20invalid`20index:`20%s=%d`5Cn",
  195. X`09`09`09`09n->name,*u.nvint);
  196. X`09`09`09ldbexit(STAT_ABORT);`09/*`20shouldn't`20do`20this...`20*/
  197. X`09`09`09`7D
  198. X`09`09fprintf(fp,"%s=%s`5Cn",n->name,stbl`5B*u.nvint`5D);
  199. X`09`09break;
  200. X`09case`20FT_TIME:`09`09`09/*`20generate`20a`20timestamp`20*/
  201. X`09`09fprintf(fp,"%s=%lu`5Cn",n->name,*u.nvtime);
  202. X`09`09break;
  203. X`09case`20FT_INTARRAY:`09`09/*`20generate`20an`20integer`20array`20*/
  204. X`09`09fprintf(fp,"%s",n->name);
  205. X`09`09c`20=`20'=';
  206. X`09`09for`20(j`20=`200;`20j`20<`20n->dflt;`20j++)`20`7B
  207. X`09`09`09fprintf(fp,"%c%d",c,(u.nvint)`5Bj`5D);
  208. X`09`09`09c`20=`20'`20';
  209. X`09`09`09`7D
  210. X`09`09fprintf(fp,"`5Cn");
  211. X`09`09break;
  212. X`09case`20FT_END:`09`09`09/*`20we`20hit`20the`20end`20marker`20*/
  213. X`09`09fprintf(fp,"%s=end`5Cn",n->name);
  214. X`09`09break;
  215. X`09default:`09`09`09/*`20we`20have`20a`20bad`20nv`20table`20*/
  216. X`09`09FeFinishSession();`09/*`20close`20down`20front-end`20*/
  217. X`09`09TFinishSession();`09/*`20close`20down`20transport`20*/
  218. X`09`09fprintf(stderr,"ERROR:`20bad`20namevalue`20type:`20%s`20(%d)`5Cn",
  219. X`09`09`09n->name,n->type);
  220. X`09`09ldbexit(STAT_ABORT);`09`09/*`20should`20have`20saved`20games?`20*/
  221. X`09`09`7D
  222. X`09`7D
  223. X`7D
  224. X
  225. X
  226. X/*---------------------------------------------------------------------------
  227. X`20*`09check_timeout`20--`20see`20if`20a`20game`20has`20been`20accessed`20rece
  228. Vntly
  229. X`20*
  230. X`20*`20This`20function`20checks`20the`20access`20time`20of`20a`20game.`20`20If
  231. V`20it`20is`20less`20than
  232. X`20*`20rc.acctime`20(default`207`20days),`20and`20the`20game`20is`20waiting
  233. V`20for`20the`20opponent,
  234. X`20*`20an`20automatic`20timeout`20is`20performed.`20`20If`20rc.acctime`20is
  235. V`20<=`200,
  236. X`20*`20automatic`20timeouts`20are`20disabled.
  237. X`20*--------------------------------------------------------------------------
  238. V-
  239. X`20*/
  240. X
  241. Xcheck_timeout(g)
  242. Xstruct`20game`20*g;
  243. X`7B
  244. Xlong`20old;
  245. X
  246. Xif`20(rc.acctime`20<=`200)
  247. X`09return;
  248. Xold`20=`20time((long`20*)`200)`20-`20((long)`20(rc.acctime*86400));`20/*`20loo
  249. Vk`20for`20idle`20games`20*/
  250. Xif`20(`20(g->lastacc`20<`20old)`20`26`26`20(g->state`20<`20OPSTATES)`20)`20
  251. V`7B
  252. X`09message("Access`20timeout`20(%d`20days)`20with`20%s`20--`20resending...`5Cn
  253. V",
  254. X`09`09rc.acctime,g->opaddr);
  255. X`09g->lastacc`20=`20time(`20(long`20*)`200);
  256. X`09resendpkt(g);`09/*`20auto`20resend`20*/
  257. X`09`7D
  258. X`7D
  259. $ call unpack SAVE.C;1 1246453896 ""
  260. $!
  261. $ create 'f'
  262. X/*`09t_email.c`09`099/5/91
  263. X`20*
  264. X`20*`20Copyright`201991`20`20Perry`20R.`20Ross
  265. X`20*
  266. X`20*`20Permission`20to`20use,`20copy,`20modify,`20and`20distribute`20this`20so
  267. Vftware`20and`20its
  268. X`20*`20documentation`20without`20fee`20is`20hereby`20granted,`20subject`20to
  269. V`20the`20restrictions
  270. X`20*`20detailed`20in`20the`20README`20file,`20which`20is`20included`20here`20b
  271. Vy`20reference.
  272. X`20*`20Any`20other`20use`20requires`20written`20permission`20from`20the`20auth
  273. Vor.`20`20This`20software
  274. X`20*`20is`20distributed`20"as`20is"`20without`20any`20warranty,`20including
  275. V`20any`20implied
  276. X`20*`20warranties`20of`20merchantability`20or`20fitness`20for`20a`20particular
  277. V`20purpose.
  278. X`20*`20The`20author`20shall`20not`20be`20liable`20for`20any`20damages`20result
  279. Ving`20from`20the
  280. X`20*`20use`20of`20this`20software.`20`20By`20using`20this`20software,`20the
  281. V`20user`20agrees
  282. X`20*`20to`20these`20terms.
  283. X`20*/
  284. X
  285. X#include`20"ldb.h"
  286. X
  287. X/*======================================================================
  288. X`20*`20This`20file`20is`20the`20e-mail`20transport`20for`20the`20ldb`20program
  289. V.`20`20It`20is
  290. X`20*`20modularized`20to`20allow`20other`20transports`20to`20be`20substituted,
  291. V`20most
  292. X`20*`20notably`20a`20socket`20transport`20to`20allow`20interactive`20network
  293. V`20backgammon.
  294. X`20*`20For`20now,`20though,`20this`20is`20the`20only`20transport`20available.
  295. X`20*
  296. X`20*`20Packets`20are`20sent`20via`20TSendPacket,`20which`20takes`20an`20instan
  297. Vce`20of
  298. X`20*`20struct`20packet`20and`20an`20address,`20and`20sends`20the`20packet`20to
  299. V`20that`20address.
  300. X`20*`20TInitialize`20must`20be`20called`20before`20any`20calls`20to`20TSendPac
  301. Vket,`20and
  302. X`20*`20TFinishSession`20must`20be`20called`20before`20exiting.
  303. X`20*
  304. X`20*`20Individual`20files`20may`20be`20sent`20by`20calling`20TSendFile.`20`20T
  305. Vhese`20files
  306. X`20*`20need`20not`20be`20related`20to`20a`20game.
  307. X`20*======================================================================
  308. X`20*/
  309. X
  310. XPRIVATE`20PStringSub();
  311. X
  312. X
  313. X/*----------------------------------------------------------------------
  314. X`20*`09TInitialize`20--`20initialize`20the`20transport
  315. X`20*
  316. X`20*`20This`20function`20is`20called`20before`20the`20transport`20is`20used.
  317. V`20`20As`20you`20can
  318. X`20*`20see,`20email`20doesn't`20require`20a`20great`20deal`20of`20initializati
  319. Von.
  320. X`20*----------------------------------------------------------------------
  321. X`20*/
  322. X
  323. XTInitialize()
  324. X`7B
  325. X`7D
  326. X
  327. X
  328. X/*----------------------------------------------------------------------
  329. X`20*`09FeDrawMenu`20--`20draw`20menu`20choices`20in`20menu`20box
  330. X`20*
  331. X`20*`20This`20function`20closes`20down`20the`20transport.
  332. X`20*----------------------------------------------------------------------
  333. X`20*/
  334. X
  335. XTFinishSession()
  336. X`7B
  337. X`7D
  338. X
  339. X
  340. X
  341. X/*----------------------------------------------------------------------
  342. X`20*`09TSendPacket`20--`20send`20a`20packet`20to`20an`20email`20address
  343. X`20*
  344. X`20*`20This`20function`20sends`20a`20packet`20to`20an`20email`20address.`20
  345. V`20It`20returns`201`20if
  346. X`20*`20the`20packet`20was`20sent,`200`20if`20an`20error`20occurred.
  347. X`20*----------------------------------------------------------------------
  348. X`20*/
  349. X
  350. XTSendPacket(p,addr)
  351. Xstruct`20packet`20*p;
  352. Xchar`20*addr;
  353. X`7B
  354. Xchar`20subject`5B80`5D;
  355. XFILE`20*fp;
  356. Xint`20status;
  357. X
  358. X
  359. Xif`20((fp`20=`20fopen(rc.tempfile,"w"))`20==`20NULL)`20`7B`09/*`20open`20temp
  360. V`20file`20*/
  361. X`09message("ERROR:`20can't`20create`20%s!`5Cn",rc.tempfile);
  362. X`09return;
  363. X`09`7D
  364. Xfprintf(fp,"<<<===LDB===>>>`5Cn");`09/*`20send`20magic`20header`20text`20*/
  365. Xnvwrite(fp,nv_packet,p);`09/*`20write`20the`20contents`20of`20the`20packet`20*
  366. V/
  367. Xfclose(fp);`09`09`09`09/*`20close`20temp`20file`20*/
  368. Xsprintf(subject,"<=LDB=>`20from`20%s`20(Long`20Distance`20Backgammon)",`20rc.m
  369. Vyname);
  370. Xstatus`20=`20TSendFile(addr,rc.tempfile,subject);`09/*`20send`20the`20file`20*
  371. V/
  372. Xunlink(rc.tempfile);`09`09/*`20delete`20the`20temp`20file`20*/
  373. Xreturn(status);
  374. X`7D
  375. X
  376. X
  377. X/*----------------------------------------------------------------------
  378. X`20*`09TSendFile`20--`20send`20a`20file`20to`20an`20address
  379. X`20*
  380. X`20*`20This`20function`20takes`20an`20e-mail`20address,`20a`20file,`20and`20a
  381. V`20subject`20line,
  382. X`20*`20and`20sends`20the`20contents`20of`20the`20file`20to`20the`20specified
  383. V`20address.`20`20The
  384. X`20*`20subject`20is`20set`20to`20the`20contents`20of`20the`20subject`20argumen
  385. Vt,`20which`20should
  386. X`20*`20be`20one`20line.`20`20TSendFile`20returns`20a`201`20if`20the`20message
  387. V`20was`20sent,
  388. X`20*`20and`20a`200`20if`20an`20error`20occurred.
  389. X`20*----------------------------------------------------------------------
  390. X`20*/
  391. X
  392. XTSendFile(addr,file,subj)
  393. Xchar`20*addr,`20*file,`20*subj;
  394. X`7B
  395. Xchar`20cmd`5B256`5D;
  396. Xchar`20*subs`5B3`5D;
  397. Xint`20s;
  398. X
  399. Xsubs`5B0`5D`20=`20addr;`09`09`09/*`20substitute`20$a`20with`20opponent`20addre
  400. Vss`20*/
  401. Xsubs`5B1`5D`20=`20file;`09`09`09/*`20substitue`20$f`20with`20file`20*/
  402. Xsubs`5B2`5D`20=`20subj;`09`09`09/*`20substitute`20$s`20with`20subject`20*/
  403. XPStringSub(rc.sendcmd,"afs",subs,cmd);
  404. Xs`20=`20system(cmd);`09`09`09/*`20execute`20email`20command`20*/
  405. Xreturn(s`20==`20SYS_GOOD);
  406. X`7D
  407. X
  408. X
  409. X
  410. X/*----------------------------------------------------------------------
  411. X`20*`09PStringSub`20--`20substitute`20variables`20in`20a`20string
  412. X`20*
  413. X`20*`20This`20function`20copies`20str`20to`20obuf,`20replacing`20occurrences
  414. V`20of`20$x`20to
  415. X`20*`20a`20corresponding`20string.`20`20The`20characters`20which`20can`20appea
  416. Vr`20after
  417. X`20*`20the`20$`20are`20passed`20in`20a`20single`20string`20in`20the`20"chars"
  418. V`20argument,`20and
  419. X`20*`20the`20strings`20to`20replace`20them`20with`20are`20passed,`20in`20the
  420. V`20same`20order`20as
  421. X`20*`20the`20characters`20appear`20in`20"chars",`20in`20the`20"strings"`20argu
  422. Vment.
  423. X`20*----------------------------------------------------------------------
  424. X`20*/
  425. X
  426. XPRIVATE`20PStringSub(str,chars,strings,obuf)
  427. Xchar`20*str,`20*chars,`20*strings`5B`5D,`20obuf`5B`5D;
  428. X`7B
  429. Xchar`20*s,`20*o,`20*t;
  430. X
  431. Xfor`20(s`20=`20str,`20o`20=`20obuf;`20*s;`20s++)`20`7B
  432. X`09if`20(*s`20!=`20'$')`20`7B`09/*`20as`20long`20as`20we`20don't`20see`20a`20$
  433. V`20*/
  434. X`09`09*o++`20=`20*s;`09/*`20just`20keep`20copying`20*/
  435. X`09`09continue;
  436. X`09`09`7D
  437. X`09s++;
  438. X`09if`20(*s`20==`20'$')`20`7B`09/*`20$$`20is`20a`20single`20$`20*/
  439. X`09`09*o++`20=`20'$';
  440. X`09`09continue;
  441. X`09`09`7D
  442. X`09if`20(`20(t`20=`20strchr(chars,*s))`20==`20NULL)`09/*`20skip`20invalid`20$
  443. V`20subs`20*/
  444. X`09`09continue;
  445. X`09t`20=`20strings`5Bt`20-`20chars`5D;`09`09/*`20get`20ptr`20to`20replacement
  446. V`20string`20*/
  447. X`09while`20(*t)`09`09`09/*`20copy`20it`20to`20obuf`20*/
  448. X`09`09*o++`20=`20*t++;
  449. X`09`7D
  450. X*o`20=`20'`5C0';`09`09`09`09/*`20null`20terminate`20obuf`20*/
  451. X`7D
  452. $ call unpack T_EMAIL.C;1 2014881667 ""
  453. $!
  454. $ create 'f'
  455. X/*`09vars.c`09`098/4/91
  456. X`20*
  457. X`20*`20Copyright`201991`20`20Perry`20R.`20Ross
  458. X`20*
  459. X`20*`20Permission`20to`20use,`20copy,`20modify,`20and`20distribute`20this`20so
  460. Vftware`20and`20its
  461. X`20*`20documentation`20without`20fee`20is`20hereby`20granted,`20subject`20to
  462. V`20the`20restrictions
  463. X`20*`20detailed`20in`20the`20README`20file,`20which`20is`20included`20here`20b
  464. Vy`20reference.
  465. X`20*`20Any`20other`20use`20requires`20written`20permission`20from`20the`20auth
  466. Vor.`20`20This`20software
  467. X`20*`20is`20distributed`20"as`20is"`20without`20any`20warranty,`20including
  468. V`20any`20implied
  469. X`20*`20warranties`20of`20merchantability`20or`20fitness`20for`20a`20particular
  470. V`20purpose.
  471. X`20*`20The`20author`20shall`20not`20be`20liable`20for`20any`20damages`20result
  472. Ving`20from`20the
  473. X`20*`20use`20of`20this`20software.`20`20By`20using`20this`20software,`20the
  474. V`20user`20agrees
  475. X`20*`20to`20these`20terms.
  476. X`20*/
  477. X
  478. X#include`20"ldb.h"
  479. X
  480. X/*======================================================================
  481. X`20*`20This`20file`20contains`20the`20definition`20for`20all`20global`20variab
  482. Vles,`20as`20well
  483. X`20*`20as`20the`20static`20initialization`20values`20for`20those`20that`20need
  484. V`20it.
  485. X`20*======================================================================
  486. X`20*/
  487. X
  488. Xint`20Pflag;`09`09`09/*`20should`20I`20process`20local`20input?`20*/
  489. Xint`20Rflag;`09`09`09/*`20should`20I`20look`20for`20mail?`20*/
  490. Xstruct`20game`20*ghead;`09`09/*`20head`20of`20linked`20list`20of`20games`20*/
  491. Xstruct`20game`20*gtail;`09`09/*`20tail`20of`20linked`20list`20of`20games`20*/
  492. Xstruct`20legal`20*lhead;`09`09/*`20head`20of`20list`20of`20legal`20moves`20*/
  493. Xstruct`20legal`20*ltail;`09`09/*`20tail`20of`20list`20of`20legal`20moves`20*/
  494. Xstruct`20people`20*phead;`09`09/*`20head`20of`20people`20list`20*/
  495. Xstruct`20packet`20P;`09`09/*`20last`20packet`20read`20*/
  496. Xchar`20cr_mycolor;`09`09/*`20my`20color`20when`20game`20is`20created`20*/
  497. Xchar`20cr_opcolor;`09`09/*`20opponent's`20color`20for`20new`20games`20*/
  498. Xchar`20cr_mydir;`09`09`09/*`20my`20direction`20for`20new`20games`20*/
  499. Xchar`20*notify;`09`09`09/*`20address`20to`20notify`20when`20game`20ends`20*/
  500. Xchar`20blk76`5B`5D`20=`09`09`09/*`2076`20blanks`20*/
  501. X"`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20
  502. V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20
  503. V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20
  504. V`20";
  505. X
  506. Xchar`20FeIsActive`20=`200;`09`09/*`20has`20the`20front-end`20been`20initialize
  507. Vd?`20*/
  508. Xchar`20FeWaitInit`20=`200;`09`09/*`20non-0`20if`20message()`20has`20been`20cal
  509. Vled`20*/
  510. X
  511. X#ifdef`20NEED_READDIR
  512. Xstruct`20direct`20dirbuf;`09`09/*`20mem`20used`20by`20readdir`20emulation`20#d
  513. Vefine`20*/
  514. X#endif
  515. X
  516. Xint`20GameState`20=`200;`09`09/*`20Current`20game`20state`20for`20help`20*/
  517. Xint`20boardnums`5B3`5D`20=`20`7BBD_AFTOP,`20BD_BEFOP,`20BD_CUR`7D;
  518. Xchar`20*states`5B`5D`20=`20`7B`09`09/*`20description`20of`20the`20states`20*/
  519. X`09"Waiting`20for`20opponent`20to`20start`20game",
  520. X`09"Waiting`20for`20opponent`20to`20move",
  521. X`09"Waiting`20for`20opponent`20to`20accept`20double",
  522. X`09"Your`20turn`20(you`20haven't`20rolled`20yet)",
  523. X`09"Your`20move`20(you`20have`20rolled)",
  524. X`09"Waiting`20for`20you`20to`20accept`20double",
  525. X`09"Game`20over"
  526. X`09`7D;
  527. X
  528. Xstruct`20opt`20options`5B`5D`20=`20`7B
  529. X`09"broadcast",`09OPT_BCAST,`09"`20`5Bfile`5D",
  530. X`09"`5CtSend`20a`20mail`20message`20to`20all`20opponents",
  531. X`09"colors",`09OPT_COLOR,`09"`20xx",
  532. X`09"`5Ct`5CtSet`20colors`20for`20new`20game",
  533. X`09"control",`09OPT_CONTROL,`09"",
  534. X`09"`5Ct`5CtPerform`20control`20functions`20on`20games",
  535. X`09"crawford",`09OPT_CRAWFORD,`09"",
  536. X`09"`5Ct`5CtEnable`20crawford`20rule`20for`20new`20games",
  537. X`09"direction",`09OPT_DIRECTION,`09"`20dir",
  538. X`09"`5Ct`5CtSet`20direction`20for`20new`20game`20`5Bup`20or`20down`5D",
  539. X`09"european",`09OPT_EUROPE,`09"",
  540. X`09"`5Ct`5CtEnable`20european`20rule`20for`20new`20games",
  541. X`09"help",`09`09OPT_HELP,`09"",
  542. X`09"`5Ct`5Ct`5CtPrint`20this`20message",
  543. X`09"jacoby",`09OPT_JACOBY,`09"",
  544. X`09"`5Ct`5Ct`5CtEnable`20jacoby`20rule`20for`20new`20games",
  545. X`09"match",`09OPT_MATCH,`09"`20number",
  546. X`09"`5Ct`5CtSet`20number`20of`20points`20in`20match",
  547. X`09"myaddr",`09OPT_MYADDR,`09"`20addr",
  548. X`09"`5Ct`5CtSet`20local`20e-mail`20address",
  549. X`09"notify",`09OPT_NOTIFY,`09"`20addr",
  550. X`09"`5Ct`5CtSend`20mail`20to`20addr`20when`20game`20ends",
  551. X`09"permanent",`09OPT_PERM,`09"",
  552. X`09"`5Ct`5CtMake`20new`20games`20permanent",
  553. X`09"play",`09`09OPT_PLAY,`09"",
  554. X`09"`5Ct`5Ct`5CtPlay`20any`20waiting`20games`20but`20do`20not`20read`20mail",
  555. X`09"read",`09`09OPT_READ,`09"",
  556. X`09"`5Ct`5Ct`5CtRead`20incoming`20mail`20but`20do`20not`20play",
  557. X`09"reconstruct",`09OPT_RECONS,`09"`20file",
  558. X`09"`5CtReconstruct`20a`20game`20from`20opponent's`20data`20file",
  559. X`09"remotestart",`09OPT_RSTART,`09"`20u1`20u2",
  560. X`09"`5CtStart`20a`20game`20between`20u1`20and`20u2",
  561. X`09"score",`09OPT_SCORE,`09"",
  562. X`09"`5Ct`5Ct`5CtPrint`20cumulative`20score`20by`20opponent",
  563. X`09"start",`09OPT_START,`09"`20user",
  564. X`09"`5Ct`5CtStart`20a`20game`20with`20another`20user",
  565. X`09NULL,`09`09-1,`09`09NULL,`09`09NULL
  566. X`09`7D;
  567. X
  568. Xchar`20*opcodes`5B`5D`20=`20`7B
  569. X`20`20`20`20`20`20`20`20"START",`20"USTART",`20"TIE",`20`20"MOVE",`20"OFFERDOU
  570. VBLE",`20"ACCEPTDOUBLE",
  571. X`09"DECLINEDOUBLE",`20"CONCEDE",`20"REMOTESTART",`20"RESTART",`20"MSTART",
  572. X`09"RESEND",`20"NOTIFY",
  573. X`09NULL
  574. X`20`20`20`20`20`20`20`20`7D;
  575. X
  576. Xstruct`20namevalue`20nv_rcfile`5B`5D`20=`20`7B
  577. X`09"myname",`09FT_STRING,`09Offset(struct`20ldbrc`20*,myname),`09NULL,
  578. X`09"myaddr",`09FT_STRING,`09Offset(struct`20ldbrc`20*,myaddr),`09NULL,
  579. X`09"peoplefile",`09FT_STRING,`09Offset(struct`20ldbrc`20*,pfile),`09NULL,
  580. X`09"gamefile",`09FT_STRING,`09Offset(struct`20ldbrc`20*,gfile),`09NULL,
  581. X`09"backupfile",`09FT_STRING,`09Offset(struct`20ldbrc`20*,gbackup),`09NULL,
  582. X`09"mailfile",`09FT_STRING,`09Offset(struct`20ldbrc`20*,mfile),`09NULL,
  583. X`09"delmail",`09FT_STRING,`09Offset(struct`20ldbrc`20*,delmail),`09NULL,
  584. X`09"lockfile",`09FT_STRING,`09Offset(struct`20ldbrc`20*,lockfile),NULL,
  585. X`09"sendcmd",`09FT_STRING,`09Offset(struct`20ldbrc`20*,sendcmd),`09NULL,
  586. X`09"tempfile",`09FT_STRING,`09Offset(struct`20ldbrc`20*,tempfile),NULL,
  587. X`09"colors",`09FT_STRING,`09Offset(struct`20ldbrc`20*,defclrs),`09NULL,
  588. X`09"direction",`09FT_STRING,`09Offset(struct`20ldbrc`20*,defdir),`09NULL,
  589. X`09"initialboard",`09FT_STRING,`09Offset(struct`20ldbrc`20*,initboard),NULL,
  590. X`09"autoroll",`09FT_STRING,`09Offset(struct`20ldbrc`20*,autoroll),NULL,
  591. X`09"automove",`09FT_STRING,`09Offset(struct`20ldbrc`20*,automove),NULL,
  592. X`09"autodouble",`09FT_INT,`09`09Offset(struct`20ldbrc`20*,autodouble),0,
  593. X`09"supercmd",`09FT_STRING,`09Offset(struct`20ldbrc`20*,supercmd),NULL,
  594. X`09"superkey",`09FT_CHAR,`09Offset(struct`20ldbrc`20*,superkey),0,
  595. X`09"checkpoint",`09FT_STRING,`09Offset(struct`20ldbrc`20*,chkpt),`09NULL,
  596. X`09"timeout",`09FT_INT,`09`09Offset(struct`20ldbrc`20*,acctime),`090,
  597. X`09"keepold",`09FT_INT,`09`09Offset(struct`20ldbrc`20*,keepold),`090,
  598. X`09"debug",`09FT_INT,`09`09Offset(struct`20ldbrc`20*,debug),`090,
  599. X`09NULL,`09`090,`09`09-1,`090
  600. X`09`7D;
  601. X
  602. Xstruct`20namevalue`20nv_gfile`5B`5D`20=`20`7B`09`09/*`20extracts`20into`20glob
  603. Val`20var`20G`20*/
  604. X`09"gameid",`09FT_STRING,`09Offset(struct`20game`20*,gameid),`09NULL,
  605. X`09"opaddr",`09FT_STRING,`09Offset(struct`20game`20*,opaddr),`09NULL,
  606. X`09"opname",`09FT_STRING,`09Offset(struct`20game`20*,opname),`09NULL,
  607. X`09"myaddr",`09FT_STRING,`09Offset(struct`20game`20*,myaddr),`09NULL,
  608. X`09"mycolor",`09FT_CHAR,`09Offset(struct`20game`20*,mycolor),`090,
  609. X`09"opcolor",`09FT_CHAR,`09Offset(struct`20game`20*,opcolor),`090,
  610. X`09"mydir",`09FT_CHAR,`09Offset(struct`20game`20*,mydir),`090,
  611. X`09"opdir",`09FT_CHAR,`09Offset(struct`20game`20*,opdir),`090,
  612. X`09"gameval",`09FT_INT,`09`09Offset(struct`20game`20*,gameval),`090,
  613. X`09"flags",`09FT_INT,`09`09Offset(struct`20game`20*,flags),`090,
  614. X`09"opversion",`09FT_INT,`09`09Offset(struct`20game`20*,opver),`090,
  615. X`09"state",`09FT_CHAR,`09Offset(struct`20game`20*,state),`090,
  616. X`09"term",`09`09FT_CHAR,`09Offset(struct`20game`20*,term),`090,
  617. X`09"seq",`09`09FT_INT,`09`09Offset(struct`20game`20*,seq),`090,
  618. X`09"lastop",`09FT_STRLKUP,`09Offset(struct`20game`20*,lastop),
  619. X`09`09(int)`20opcodes,
  620. X`09"mycmt",`09FT_STRING,`09Offset(struct`20game`20*,mycmt),`09NULL,
  621. X`09"mycmt2",`09FT_STRING,`09Offset(struct`20game`20*,mycmt2),`09NULL,
  622. X`09"opcmt",`09FT_STRING,`09Offset(struct`20game`20*,opcmt),`09NULL,
  623. X`09"opcmt2",`09FT_STRING,`09Offset(struct`20game`20*,opcmt2),`09NULL,
  624. X`09"dispmsg",`09FT_STRING,`09Offset(struct`20game`20*,dispmsg),`09NULL,
  625. X`09"opmvs0",`09FT_MOVE,`09Offset(struct`20game`20*,opmvs`5B0`5D),`090,
  626. X`09"opmvs1",`09FT_MOVE,`09Offset(struct`20game`20*,opmvs`5B1`5D),`090,
  627. X`09"opmvs2",`09FT_MOVE,`09Offset(struct`20game`20*,opmvs`5B2`5D),`090,
  628. X`09"opmvs3",`09FT_MOVE,`09Offset(struct`20game`20*,opmvs`5B3`5D),`090,
  629. X`09"blot0",`09FT_CHAR,`09Offset(struct`20game`20*,blot`5B0`5D),`090,
  630. X`09"blot1",`09FT_CHAR,`09Offset(struct`20game`20*,blot`5B1`5D),`090,
  631. X`09"blot2",`09FT_CHAR,`09Offset(struct`20game`20*,blot`5B2`5D),`090,
  632. X`09"blot3",`09FT_CHAR,`09Offset(struct`20game`20*,blot`5B3`5D),`090,
  633. X`09"mvs0",`09`09FT_MOVE,`09Offset(struct`20game`20*,mvs`5B0`5D),`090,
  634. X`09"mvs1",`09`09FT_MOVE,`09Offset(struct`20game`20*,mvs`5B1`5D),`090,
  635. X`09"mvs2",`09`09FT_MOVE,`09Offset(struct`20game`20*,mvs`5B2`5D),`090,
  636. X`09"mvs3",`09`09FT_MOVE,`09Offset(struct`20game`20*,mvs`5B3`5D),`090,
  637. X`09"maxused",`09FT_INT,`09`09Offset(struct`20game`20*,maxused),`090,
  638. X`09"hiused",`09FT_INT,`09`09Offset(struct`20game`20*,hiused),`090,
  639. X`09"adcnt",`09FT_INT,`09`09Offset(struct`20game`20*,adcnt),`090,
  640. X`09"admax",`09FT_INT,`09`09Offset(struct`20game`20*,admax),`090,
  641. X`09"opbd",`09`09FT_BOARD,`09Offset(struct`20game`20*,opbd`5B0`5D),`090,
  642. X`09"mybd",`09`09FT_BOARD,`09Offset(struct`20game`20*,mybd`5B0`5D),`090,
  643. X`09"board",`09FT_BOARD,`09Offset(struct`20game`20*,board`5B0`5D),`090,
  644. X`09"curbd",`09FT_CHAR,`09Offset(struct`20game`20*,curbd),`09-1,
  645. X`09"rolls",`09FT_INTARRAY,`09Offset(struct`20game`20*,rolls`5B0`5D),`096,
  646. X`09"doubles",`09FT_INTARRAY,`09Offset(struct`20game`20*,doubles`5B0`5D),6,
  647. X`09"oprolls",`09FT_INTARRAY,`20Offset(struct`20game`20*,oprolls`5B0`5D),`096,
  648. X`09"opdoubles",`09FT_INTARRAY,`20Offset(struct`20game`20*,opdoubles`5B0`5D),6,
  649. V
  650. X`09"starttime",`09FT_TIME,`09Offset(struct`20game`20*,starttime),0,
  651. X`09"lastacc",`09FT_TIME,`09Offset(struct`20game`20*,lastacc),`090,
  652. X`09"mcurrent",`09FT_INTARRAY,`09Offset(struct`20game`20*,mcurrent`5B0`5D),2,
  653. X`09"mtotal",`09FT_INT,`09`09Offset(struct`20game`20*,mtotal),`090,
  654. X`09"notify",`09FT_STRING,`09Offset(struct`20game`20*,notify),`09NULL,
  655. X`09"end",`09`09FT_END,`09`09-1,`090,
  656. X`09NULL,`09`090,`09`09-1,`090
  657. X`09`7D;
  658. X
  659. Xstruct`20namevalue`20nv_packet`5B`5D`20=`20`7B
  660. X`09"version",`09FT_INT,`09`09Offset(struct`20packet`20*,version),0,
  661. X`09"timestamp",`09FT_TIME,`09Offset(struct`20packet`20*,timestamp),0,
  662. X`09"gameid",`09FT_STRING,`09Offset(struct`20packet`20*,gameid),`09NULL,
  663. X`09"opcode",`09FT_STRLKUP,`09Offset(struct`20packet`20*,opcode),
  664. X`09`09(int)`20opcodes,
  665. X`09"move0",`09FT_MOVE,`09Offset(struct`20packet`20*,mvs`5B0`5D),`090,
  666. X`09"move1",`09FT_MOVE,`09Offset(struct`20packet`20*,mvs`5B1`5D),`090,
  667. X`09"move2",`09FT_MOVE,`09Offset(struct`20packet`20*,mvs`5B2`5D),`090,
  668. X`09"move3",`09FT_MOVE,`09Offset(struct`20packet`20*,mvs`5B3`5D),`090,
  669. X`09"name",`09`09FT_STRING,`09Offset(struct`20packet`20*,name),`09NULL,
  670. X`09"addr",`09`09FT_STRING,`09Offset(struct`20packet`20*,addr),`09NULL,
  671. X`09"comment",`09FT_STRING,`09Offset(struct`20packet`20*,comment),NULL,
  672. X`09"comment2",`09FT_STRING,`09Offset(struct`20packet`20*,comment2),NULL,
  673. X`09"seq",`09`09FT_INT,`09`09Offset(struct`20packet`20*,seq),`090,
  674. X`09"colors",`09FT_STRING,`09Offset(struct`20packet`20*,colors),`09NULL,
  675. X`09"direction",`09FT_STRING,`09Offset(struct`20packet`20*,dir),`09NULL,
  676. X`09"autodouble",`09FT_STRING,`09Offset(struct`20packet`20*,autodbl),NULL,
  677. X`09"jacoby",`09FT_STRING,`09Offset(struct`20packet`20*,jacoby),`20NULL,
  678. X`09"crawford",`09FT_STRING,`09Offset(struct`20packet`20*,crawford),NULL,
  679. X`09"european",`09FT_STRING,`09Offset(struct`20packet`20*,european),NULL,
  680. X`09"permanent",`09FT_STRING,`09Offset(struct`20packet`20*,perm),`09NULL,
  681. X`09"match",`09FT_STRING,`09Offset(struct`20packet`20*,match),`20`20NULL,
  682. X`09"notify",`09FT_STRING,`09Offset(struct`20packet`20*,notify),`09NULL,
  683. X`09"end",`09`09FT_END,`09`09-1,`090,
  684. X`09NULL,`09`090,`09`09-1,`090
  685. X`09`7D;
  686. X
  687. Xstruct`20namevalue`20nv_pfile`5B`5D`20=`20`7B
  688. X`09"addr",`09`09FT_STRING,`09Offset(struct`20people`20*,addr),`09NULL,
  689. X`09"name",`09`09FT_STRING,`09Offset(struct`20people`20*,name),`09NULL,
  690. X`09"alias",`09FT_STRING,`09Offset(struct`20people`20*,alias),`09NULL,
  691. X`09"myaddr",`09FT_STRING,`09Offset(struct`20people`20*,myaddr),`09NULL,
  692. X`09"equiv",`09FT_STRING,`09Offset(struct`20people`20*,equiv),`09NULL,
  693. X`09"fence",`09FT_TIME,`09Offset(struct`20people`20*,fence),`090,
  694. X`09"score",`09FT_INTARRAY,`09Offset(struct`20people`20*,score`5B0`5D),`2010,
  695. X`09"end",`09`09FT_END,`09`09-1,`090,
  696. X`09NULL,`09`090,`09`09-1,`090
  697. X`09`7D;
  698. X
  699. Xstruct`20namevalue`20nv_pequiv`5B`5D`20=`20`7B
  700. X`09"addr",`09`09FT_STRING,`09Offset(struct`20people`20*,addr),`09NULL,
  701. X`09"equiv",`09FT_STRING,`09Offset(struct`20people`20*,equiv),`09NULL,
  702. X`09"end",`09`09FT_END,`09`09-1,`090,
  703. X`09NULL,`09`090,`09`09-1,`090
  704. X`09`7D;
  705. X
  706. Xint`20(*func`5BOPSTATES`5D`5BNOP`5D)()`20=`20`7B
  707. X/*`09START`09USTART`09TIE`09MOVE`09OFRDBL`09ACPTDBL
  708. X`09`09DECDBL`09CONCEDE`09RSTART`09RESTART`09MSTART`09RESEND`09NOTIFY`09*/
  709. X`09start,`09istart,`09tie,`09opmove,`09smerr,`09smerr,
  710. X`09`09smerr,`09opconc,`09smerr,`09restart,mstart,`09smerr,`09smerr,
  711. X`09smerr,`09smerr,`09smerr,`09opmove,`09opofr,`09smerr,
  712. X`09`09smerr,`09opconc,`09smerr,`09smerr,`09smerr,`09smerr,`09smerr,
  713. X`09smerr,`09smerr,`09smerr,`09smerr,`09smerr,`09opacpt,
  714. X`09`09opdec,`09opconc,`09smerr,`09smerr,`09smerr,`09smerr,`09smerr
  715. X`09`7D;
  716. X
  717. Xchar`20*rejlcl`5B`5D`20=`20`7B`09`09`09/*`20reject`20messages`20for`20local
  718. V`20player`20*/
  719. X`09"",`09`09`09`09`09/*`20no`20error`20*/
  720. X`09"Move`20does`20not`20contain`20a`20legal`20roll.",`09/*`20shouldn't`20happe
  721. Vn`20*/
  722. X`09"You`20must`20fill`20your`20inner`20table`20before`20bearing`20off.",
  723. X`09"There`20is`20no`20piece`20on`20that`20point.",
  724. X`09"The`20destination`20of`20that`20move`20is`20occupied.",
  725. X`09"You`20cannot`20move`20while`20you`20are`20on`20the`20bar.",
  726. X`09"You`20can't`20move`20your`20opponent's`20pieces.",
  727. X`09"You`20must`20bear`20that`20piece`20off`20with`20an`20exact`20roll."
  728. X`09`7D;
  729. X
  730. Xchar`20*rejmsg`5B`5D`20=`20`7B`09`09/*`20reject`20messages`20for`20received
  731. V`20moves`20*/
  732. X`09"Move`20Accepted.",`09`09`09`09/*`20no`20error`20*/
  733. X`09"Move`20does`20not`20contain`20a`20legal`20roll.",`09`09/*`20bad`20roll`20*
  734. V/
  735. X`09"Cannot`20remove`20pieces`20before`20filling`20inner`20table.",
  736. X`09"There`20is`20no`20piece`20at`20the`20specified`20location.",
  737. X`09"The`20destination`20of`20this`20move`20is`20occupied.",
  738. X`09"Attempt`20to`20move`20while`20pieces`20are`20on`20the`20bar.",
  739. X`09"Attempt`20to`20move`20wrong`20color.",
  740. X`09"That`20piece`20must`20be`20borne`20off`20by`20an`20exact`20roll."
  741. X`09`7D;
  742. $ call unpack VARS.C;1 374419947 ""
  743. $!
  744. $ create 'f'
  745. X/*`09ldb.h`09`098/3/91
  746. X`20*
  747. X`20*`20Copyright`201991`20`20Perry`20R.`20Ross
  748. X`20*
  749. X`20*`20Permission`20to`20use,`20copy,`20modify,`20and`20distribute`20this`20so
  750. Vftware`20and`20its
  751. X`20*`20documentation`20without`20fee`20is`20hereby`20granted,`20subject`20to
  752. V`20the`20restrictions
  753. X`20*`20detailed`20in`20the`20README`20file,`20which`20is`20included`20here`20b
  754. Vy`20reference.
  755. X`20*`20Any`20other`20use`20requires`20written`20permission`20from`20the`20auth
  756. Vor.`20`20This`20software
  757. X`20*`20is`20distributed`20"as`20is"`20without`20any`20warranty,`20including
  758. V`20any`20implied
  759. X`20*`20warranties`20of`20merchantability`20or`20fitness`20for`20a`20particular
  760. V`20purpose.
  761. X`20*`20The`20author`20shall`20not`20be`20liable`20for`20any`20damages`20result
  762. Ving`20from`20the
  763. X`20*`20use`20of`20this`20software.`20`20By`20using`20this`20software,`20the
  764. V`20user`20agrees
  765. X`20*`20to`20these`20terms.
  766. X`20*/
  767. X
  768. X#include`20"patchlevel.h"
  769. X
  770. X`09/*`20LDB_VER`20breaks`20if`20REVISION`20or`20PATCHLEVEL`20>`209,`20see`20pa
  771. Vtchlevel.h`20*/
  772. X#define`20LDB_VER`09((VERSION*100)+(REVISION*10)+PATCHLEVEL)`20`20/*`20used
  773. V`20in`20sendpkt`20*/
  774. X
  775. X#include`20<stdio.h>
  776. X#include`20<ctype.h>
  777. X#include`20<curses.h>
  778. X#include`20<signal.h>
  779. X
  780. X#ifdef`20VMS
  781. X
  782. X#include`20<types.h>
  783. X#include`20<time.h>
  784. X#include`20<unixio.h>
  785. X#include`20<file.h>
  786. X#include`20<descrip.h>
  787. X#include`20<processes.h>
  788. X#include`20<ssdef.h>
  789. X#include`20<rms.h>
  790. X#include`20<stat.h>
  791. X#define`20STAT_NORM`20SS$_NORMAL
  792. X#define`20STAT_ABORT`20SS$_ABORT
  793. X#define`20SYS_GOOD`201`09`09/*`20success`20return`20from`20system()`20*/
  794. X
  795. X#else
  796. X
  797. X#include`20<sys/types.h>
  798. X#include`20<sys/dir.h>
  799. X#include`20<sys/stat.h>
  800. X#include`20<time.h>
  801. X#include`20<fcntl.h>
  802. X#define`20STAT_NORM`200
  803. X#define`20STAT_ABORT`201
  804. X#define`20SYS_GOOD`200`09`09/*`20success`20return`20from`20system()`20*/
  805. X
  806. X#endif
  807. X
  808. X#ifdef`20NEED_READDIR`09`09/*`20defined`20by`20Makefile`20*/
  809. Xextern`20struct`20direct`20dirbuf;`09/*`20simulate`20Berkeley`20directory`20ro
  810. Vutines`20*/
  811. X#define`20DIR`20FILE
  812. X#define`20opendir(X)`20fopen((X),"r")
  813. X#define`20readdir(X)`20(fread(`26dirbuf,sizeof(dirbuf),1,(X))?`26dirbuf:NULL)
  814. X#define`20closedir(X)`20fclose(X)
  815. X#endif
  816. X
  817. X#ifdef`20vaxc
  818. X#define`20OLD_CURSES`201
  819. X#define`20unlink(X)`20delete(X)
  820. X#endif
  821. X
  822. X#ifdef`20sequent
  823. X#define`20OLD_CURSES`201
  824. X#endif
  825. X
  826. X#ifdef`20OLD_CURSES`09`09/*`20defined`20above`20or`20in`20Makefile`20*/
  827. X#define`20cbreak()`20crmode()`09/*`20from`20ancient`20curses`20*/
  828. X#define`20nocbreak()`20nocrmode()
  829. X#endif
  830. X
  831. X#ifdef`20USE_INDEX`09`09/*`20defined`20in`20Makefile`20*/
  832. X#define`20strchr`20index`09`09/*`20$%!@`5E`26#$`20pick`20a`20name`20and`20stic
  833. Vk`20with`20it`20*/
  834. X#define`20strrchr`20rindex
  835. X#endif
  836. X
  837. X#define`20release_lock(X)`20unlink(X)`09/*`20delete`20lock`20file`20*/
  838. X
  839. X`09/*`20swiped`20from`20X`20toolkit`20*/
  840. X#define`20Offset(T,F)`20((int)(((char`20*)(`26(((T)NULL)->F)))-((char`20*)NULL
  841. V)))
  842. X
  843. X#define`20PRIVATE`20static`09`09/*`20for`20private`20functions`20*/
  844. X
  845. X#define`20INTGFILE`20"interrupt.ldbdata"`09/*`20file`20to`20save`20games`20to
  846. V`20on`20`5EC`20*/
  847. X#define`20INTPFILE`20"interrupt.ldbpeople"`09/*`20file`20to`20save`20people
  848. V`20to`20on`20`5EC`20*/
  849. X
  850. X#define`20BLANKS(X)`20(`26blk76`5B76-(X)`5D)`09/*`20blank`20string`20of`20spec
  851. Vified`20length`20*/
  852. X
  853. X`09`09/*`20locations`20in`20board`20typedef`20*/
  854. X#define`20UPBAR`09`090`09`09/*`20BAR`20point`20for`20up-bound`20player`20*/
  855. X#define`20DOWNBAR`09`0925`09`09/*`20BAR`20point`20for`20down-bound`20player
  856. V`20*/
  857. X#define`20UPOFF`09`0926`09`09/*`20off`20point`20for`20up-bound`20player`20*/
  858. X#define`20DOWNOFF`09`0927`09`09/*`20off`20point`20for`20down-bound`20player
  859. V`20*/
  860. X#define`20BOARDSIZE`0928`09`09/*`20number`20of`20points`20in`20board`20*/
  861. X
  862. X`09/*`20BARPT`20takes`20a`20direction`20(-1`20or`201)`20and`20returns`20the
  863. V`09*/
  864. X`09/*`20point`20in`20the`20board`20typedef`20that`20represents`20that`09*/
  865. X`09/*`20players`20bar.`20`20OFFPT`20does`20the`20same`20thing`20for`20the`09*/
  866. V
  867. X`09/*`20point`20that`20pieces`20go`20to`20when`20they`20are`20thrown`20off.
  868. V`09*/
  869. X`09/*`20REV(direction)`20returns`20the`20opposite`20direction.`09*/
  870. X#define`20BARPT(D)`09(((D)>0)?UPBAR:DOWNBAR)
  871. X#define`20OFFPT(D)`09(((D)>0)?UPOFF:DOWNOFF)
  872. X#define`20REV(D)`09`09(-(D))
  873. X
  874. X`09`09/*`20states`20we`20can`20be`20in`20*/
  875. X#define`20ST_OPSTART`090`09`09/*`20we`20have`20sent`20a`20START`20(or`20rcvd
  876. V`20one)*/
  877. X#define`20ST_OPTURN`091`09`09/*`20Its`20the`20opponent's`20turn`20*/
  878. X#define`20ST_OPACCEPT`092`09`09/*`20I`20have`20offered`20to`20double`20*/
  879. X
  880. X#define`20OPSTATES`093`09`09/*`20<`20OPSTATES`20needs`20remote`20input`20*/
  881. X
  882. X#define`20ST_MYTURN`093`09`09/*`20My`20turn,`20I`20haven't`20rolled`20yet`20*/
  883. V
  884. X#define`20ST_MYMOVE`094`09`09/*`20I've`20rolled,`20but`20I`20haven't`20moved
  885. V`20*/
  886. X#define`20ST_MYACCEPT`095`09`09/*`20Opponent`20has`20offered`20to`20double`20*
  887. V/
  888. X#define`20ST_GAMEOVER`096`09`09/*`20game`20is`20dead,`20see`20T_*`20for`20reas
  889. Von`20*/
  890. X#define`20NSTATE`09`097`09`09/*`20number`20of`20possible`20states`20*/
  891. X
  892. X`09`09/*`20operations`20to`20send`20or`20receive`20*/
  893. X#define`20START`09`090`09`09/*`20start`20a`20game`20*/
  894. X#define`20USTART`09`091`09`09/*`20if`20rcvd,`20we`20won`20the`20initial`20roll
  895. V`20*/
  896. X#define`20TIE`09`092`09`09/*`20tie`20on`20initial`20roll,`20restart`20*/
  897. X#define`20MOVE`09`093`09`09/*`20send`20a`20move`20*/
  898. X#define`20OFRDBL`09`094`09`09/*`20offer`20to`20double`20*/
  899. X#define`20ACPTDBL`09`095`09`09/*`20double`20accepted`20*/
  900. X#define`20DECDBL`09`096`09`09/*`20double`20declined,`20game`20over`20*/
  901. X#define`20CONCEDE`09`097`09`09/*`20we`20give`20up`20*/
  902. X#define`20RSTART`09`098`09`09/*`20remote`20start`20packet`20*/
  903. X#define`20RESTART`09`099`09`09/*`20repeat`20initial`20roll`20*/
  904. X#define`20MSTART`09`0910`09`09/*`20start`20next`20game`20of`20match`20*/
  905. X#define`20RESEND`09`0911`09`09/*`20resend`20request`20from`20opponent`20*/
  906. X#define`20NOTIFY`09`0912`09`09/*`20tell`20game`20starter`20when`20game`20ends
  907. V`20*/
  908. X#define`20NOP`09`0913`09`09/*`20number`20of`20possible`20operations`20*/
  909. X
  910. X`09`09/*`20termination`20codes`20for`20state`20ST_GAMEOVER`20*/
  911. X#define`20T_ICONCEDE`091`09`09/*`20I`20gave`20up`20*/
  912. X#define`20T_IDECLINE`092`09`09/*`20I`20declined`20double`20*/
  913. X#define`20T_ILOSE`09`093`09`09/*`20opponent`20moved`20all`20pieces`20off`20*/
  914. X#define`20T_OPCONCEDE`094`09`09/*`20opponent`20gave`20up`20*/
  915. X#define`20T_OPDECLINE`095`09`09/*`20opponent`20declined`20double`20*/
  916. X#define`20T_IWIN`09`096`09`09/*`20I`20moved`20all`20pieces`20off`20*/
  917. X
  918. X`09`09/*`20flags`20passed`20to`20apply`20*/
  919. X#define`20A_REDRAW`091`09/*`20redraw`20the`20pieces`20moved`20*/
  920. X#define`20A_CHKONLY`092`09/*`20check`20move`20but`20don't`20move`20pieces`20*/
  921. V
  922. X
  923. X`09`09/*`20codes`20returned`20by`20apply`20*/
  924. X#define`20MVOK`09`090`09/*`20move`20was`20accepted`20by`20apply()`20*/
  925. X#define`20RJ_NOROLL`09-1`09/*`20move`20does`20not`20contain`20valid`20roll`20*
  926. V/
  927. X#define`20RJ_NOOFF`09-2`09/*`20all`20pcs`20not`20in`20inner`20tbl,`20can't`20t
  928. Vhrow`20off`20*/
  929. X#define`20RJ_NOPIECE`09-3`09/*`20no`20piece`20at`20specified`20point`20*/
  930. X#define`20RJ_OCC`09`09-4`09/*`20destination`20occupied`20*/
  931. X#define`20RJ_ONBAR`09-5`09/*`20can't`20move,`20pieces`20are`20on`20bar`20*/
  932. X#define`20RJ_NOTYOURS`09-6`09/*`20wrong`20color,`20dummy`20*/
  933. X#define`20RJ_EXACT`09-7`09/*`20must`20use`20exact`20roll`20except`20for`20oute
  934. Vr`20pc`20*/
  935. X
  936. X`09`09/*`20bits`20for`20flags`20field`20of`20game`20struct`20*/
  937. X#define`20F_IDOUBLED`091`09/*`20I`20doubled`20last`20*/
  938. X#define`20F_SENTNAME`092`09/*`20I've`20sent`20my`20name`20*/
  939. X#define`20F_INVERT`094`09/*`20I`20want`20my`20board`20upside`20down`20*/
  940. X#define`20F_DELETE`098`09/*`20this`20game`20is`20deleted`20*/
  941. X#define`20F_JACOBY`0916`09/*`20jacoby`20rule`20in`20effect`20for`20this`20game
  942. V`20*/
  943. X#define`20F_CRAWFORD`0932`09/*`20crawford`20rule`20in`20effect`20for`20this
  944. V`20game`20*/
  945. X#define`20F_PERM`09`0964`09/*`20permanent`20game`20*/
  946. X#define`20F_EUROPE`09128`09/*`20european`20rule`20(backgammons`20count`20doubl
  947. Ve)`20*/
  948. X#define`20F_DISPLAYED`09256`09/*`20Game`20over,`20keeping`20in`20case`20need
  949. V`20resend`20*/
  950. X#define`20F_CRGAME`09512`09/*`20This`20game`20is`20the`20crawford`20rule`20gam
  951. Ve`20*/
  952. X#define`20F_CRDONE`091024`09/*`20The`20crawford`20rule`20game`20has`20been`20p
  953. Vlayed`20*/
  954. X
  955. X`09`09/*`20field`20types`20for`20reading`20name/value`20files`20*/
  956. X#define`20FT_CHAR`09`091`09/*`20store`20a`20single`20character`20*/
  957. X#define`20FT_INT`09`092`09/*`20store`20a`20single`20integer`20*/
  958. X#define`20FT_STRING`093`09/*`20store`20a`20char`20*`20(use`20save())`20*/
  959. X#define`20FT_MOVE`09`094`09/*`20a`20struct`20mv`20*/
  960. X#define`20FT_BOARD`095`09/*`20a`20board`20image`20*/
  961. X#define`20FT_STRLKUP`096`09/*`20lookup`20string`20in`20table`20`26`20store`20i
  962. Vndex`20*/
  963. X#define`20FT_TIME`09`097`09/*`20a`20timestamp`20*/
  964. X#define`20FT_INTARRAY`098`09/*`20array`20of`20integers`20*/
  965. X#define`20FT_END`09`0999`09/*`20end`20of`20structure`20*/
  966. X
  967. X`09`09/*`20which`20board`20is`20currently`20displayed`20(g->curbd)`20*/
  968. X#define`20BD_BEFOP`090`09/*`20before`20op's`20move`20(after`20my`20previous)
  969. V`20*/
  970. X#define`20BD_AFTOP`091`09/*`20after`20op's`20move`20(before`20my`20next)`20*/
  971. X#define`20BD_CUR`09`092`09/*`20current`20(with`20any`20moves`20I've`20made`20s
  972. Vo`20far)`20*/
  973. X
  974. X`09`09/*`20these`20are`20the`20command`20line`20options`20*/
  975. X#define`20OPT_START`091`09/*`20start`20a`20game`20*/
  976. X#define`20OPT_READ`092`09/*`20read`20incoming`20mail`20*/
  977. X#define`20OPT_PLAY`093`09/*`20play`20any`20games`20that`20are`20waiting`20for
  978. V`20me`20*/
  979. X#define`20OPT_COLOR`094`09/*`20set`20the`20color`20for`20created`20games`20*/
  980. X#define`20OPT_DIRECTION`095`09/*`20set`20the`20direction`20for`20created`20gam
  981. Ves`20*/
  982. X#define`20OPT_RSTART`096`09/*`20remote`20start`20a`20game`20*/
  983. X#define`20OPT_HELP`097`09/*`20print`20long`20help`20*/
  984. X#define`20OPT_CONTROL`098`09/*`20go`20into`20control`20mode`20*/
  985. X#define`20OPT_MYADDR`099`09/*`20set`20my`20e-mail`20address`20(override`20.ldb
  986. Vrc)`20*/
  987. X#define`20OPT_BCAST`0910`09/*`20send`20a`20mail`20message`20to`20all`20opponen
  988. Vts`20*/
  989. X#define`20OPT_JACOBY`0911`09/*`20enable`20the`20jacoby`20rule`20*/
  990. X#define`20OPT_CRAWFORD`0912`09/*`20enable`20the`20crawford`20rule`20*/
  991. X#define`20OPT_PERM`0913`09/*`20make`20game`20permanent`20*/
  992. X#define`20OPT_MATCH`0914`09/*`20set`20number`20of`20points`20in`20match`20*/
  993. X#define`20OPT_EUROPE`0915`09/*`20enable`20european`20rule`20*/
  994. X#define`20OPT_RECONS`0916`09/*`20reconstruct`20a`20game`20from`20opponent's
  995. V`20data`20*/
  996. X#define`20OPT_SCORE`0917`09/*`20print`20cumulative`20scores`20*/
  997. X#define`20OPT_NOTIFY`0918`09/*`20set`20notify`20address`20*/
  998. X
  999. X`09`09/*`20these`20are`20the`20different`20game`20states`20for`20the`20help
  1000. V`20call`20*/
  1001. X#define`20STATE_CONTROL`091`09/*`20Invoked`20with`20the`20control`20option`20*
  1002. V/
  1003. X#define`20STATE_MYTURN`092`09/*`20Waiting`20for`20user`20to`20move`20*/
  1004. X#define`20STATE_MYMOVE`093`09/*`20User`20has`20rolled`20but`20needs`20to`20mov
  1005. Ve`20*/
  1006. X#define`20STATE_MYACPT`094`09/*`20Accept`20or`20decline`20the`20double`20*/
  1007. X#define`20STATE_GAMEOVER`095`09/*`20The`20game`20is`20over`20*/
  1008. X
  1009. X#define`20WHO_ME`09`090`09/*`20used`20to`20mean`20local`20player`20*/
  1010. X#define`20WHO_OPP`09`091`09/*`20used`20to`20mean`20opponent`20*/
  1011. X
  1012. X`09/*`20these`20bits`20are`20passed`20to`20findppl`20to`20specify`20whether
  1013. V`09*/
  1014. X`09/*`20we`20want`20to`20look`20up`20an`20address,`20an`20alias,`20or`20both
  1015. V`09*/
  1016. X#define`20P_ADDR`09`091`09/*`20look`20for`20a`20address`20*/
  1017. X#define`20P_ALIAS`09`092`09/*`20look`20for`20an`20alias`20*/
  1018. X
  1019. X`09/*`20these`20are`20the`20bits`20to`20set`20in`20rc.debug`20to`20enable`09*/
  1020. V
  1021. X`09/*`20debug`20messages`20for`20various`20functions.`09`09*/
  1022. X#define`20DB_READFILE`091`09/*`20print`20mail`20files`20scanned`20*/
  1023. X#define`20DB_RWGAMES`092`09/*`20print`20games`20read/written`20*/
  1024. X#define`20DB_GSTART`094`09/*`20print`20games`20started`20*/
  1025. X#define`20DB_RSTART`098`09/*`20trace`20remote`20start`20packets`20*/
  1026. X
  1027. X`09/*`20these`20refer`20to`20the`20elements`20of`20struct`20people->score`20*/
  1028. V
  1029. X#define`20SC_GAMESWON`090`09/*`20number`20of`20games`20won`20against`20this
  1030. V`20guy`20*/
  1031. X#define`20SC_GAMESLOST`091`09/*`20number`20of`20games`20lost`20to`20this`20guy
  1032. V`20*/
  1033. X#define`20SC_PTSWON`092`09/*`20number`20of`20points`20won`20against`20this`20g
  1034. Vuy`20*/
  1035. X#define`20SC_PTSLOST`093`09/*`20number`20of`20points`20lost`20to`20this`20guy
  1036. V`20*/
  1037. X#define`20SC_GMNWON`094`09/*`20number`20of`20gammons`20won`20*/
  1038. X#define`20SC_GMNLOST`095`09/*`20number`20of`20gammons`20lost`20*/
  1039. X#define`20SC_BGWON`096`09/*`20number`20of`20backgammons`20won`20*/
  1040. X#define`20SC_BGLOST`097`09/*`20number`20of`20backgammons`20lost`20*/
  1041. X#define`20SC_MWON`09`098`09/*`20number`20of`20matches`20won`20*/
  1042. X#define`20SC_MLOST`099`09/*`20number`20of`20matches`20lost`20*/
  1043. X
  1044. Xstruct`20opt`20`7B`09`09`09/*`20used`20to`20make`20list`20of`20command`20line
  1045. V`20options`20*/
  1046. X`09char`09*name;`09`09/*`20name`20of`20option`20(as`20used`20on`20command`20li
  1047. Vne)`20*/
  1048. X`09int`09index;`09`09/*`20OPT_*`20*/
  1049. X`09char`09*args;`09`09/*`20arguments`20the`20option`20takes,`20if`20any`20*/
  1050. X`09char`09*help;`09`09/*`201-line`20help`20string`20for`20option`20*/
  1051. X`09`7D;
  1052. X
  1053. Xstruct`20ldbrc`20`7B`09`09/*`20struct`20where`20all`20fields`20from`20.ldbrc
  1054. V`20are`20stored`20*/
  1055. X`09char`09*myaddr;`09/*`20my`20e-mail`20address`20*/
  1056. X`09char`09*myname;`09/*`20my`20name`20*/
  1057. X`09char`09*pfile;`09`09/*`20people`20file`20*/
  1058. X`09char`09*gfile;`09`09/*`20games`20file`20*/
  1059. X`09char`09*gbackup;`09/*`20where`20to`20save`20old`20game`20file`20*/
  1060. X`09char`09*mfile;`09`09/*`20mail`20file`20*/
  1061. X`09char`09*delmail;`09/*`20should`20we`20delete`20mail`20files`20after`20readi
  1062. Vng?*/
  1063. X`09char`09*lockfile;`09/*`20ldb`20mutex`20lock`20file`20*/
  1064. X`09char`09*sendcmd;`09/*`20mail`20send`20command`20*/
  1065. X`09char`09*tempfile;`09/*`20temp`20file`20for`20sendpkt`20*/
  1066. X`09char`09*defclrs;`09/*`20default`20colors`20(2`20from`20`5Brwb`5D)`20*/
  1067. X`09char`09*defdir;`09/*`20default`20direction`20(up/down)`20*/
  1068. X`09char`09*initboard;`09/*`20init.`20brd`20display`20(before/after/current)
  1069. V`20*/
  1070. X`09char`09*autoroll;`09/*`20enable`20autoroll?`20(yes/no)`20*/
  1071. X`09char`09*automove;`09/*`20enable`20automove?`20(yes/no)`20*/
  1072. X`09int`09autodouble;`09/*`20autodouble`20count,`200`20to`20disable`20*/
  1073. X`09char`09*supercmd;`09/*`20command`20to`20run`20to`20fool`20supervisor`20*/
  1074. X`09char`09superkey;`09/*`20key`20to`20activate`20supercmd`20*/
  1075. X`09char`09*chkpt;`09`09/*`20keep`20games`20up`20to`20date?`20*/
  1076. X`09int`09acctime;`09/*`20number`20of`20days`20until`20auto`20resend`20*/
  1077. X`09int`09keepold;`09/*`20number`20of`20days`20to`20keep`20finished`20games`20*
  1078. V/
  1079. X`09int`09debug;`09`09/*`20debug`20level,`200`20=`20none`20*/
  1080. X`09`7D;
  1081. X
  1082. X`09`09/*`20the`20following`20structure`20is`20used`20to`20save/load`20*/
  1083. X`09`09/*`20the`20games`20file,`20the`20.ldbrc,`20and`20to`20send`09*/
  1084. X`09`09/*`20packets`20between`20the`20players.`20`20It`20stores`20a`09*/
  1085. X`09`09/*`20name,`20the`20type`20(see`20FT_*`20above),`20and`20the`09*/
  1086. X`09`09/*`20offset`20into`20a`20structure.`20`20A`20pointer`20to`20the`09*/
  1087. X`09`09/*`20structure`20is`20provided`20at`20runtime.`09`09*/
  1088. Xstruct`20namevalue`20`7B
  1089. X`20`20`20`20`20`20`20char`20*name;`09`09/*`20name`20of`20the`20field`20*/
  1090. X`20`20`20`20`20`20`20char`20type;`09`09/*`20type`20of`20the`20field`20(T_*)
  1091. V`20*/
  1092. X`20`20`20`20`20`20`20int`20offset;`09`09/*`20where`20to`20store`20value`20*/
  1093. X`20`20`20`20`20`20`20int`20dflt;`09`09/*`20default`20value`20*/
  1094. X`20`20`20`20`20`20`20`7D;
  1095. X
  1096. Xunion`20nvtypes`20`7B`09`09`09/*`20convert`20char*`20to/from`20FT_*`20*/
  1097. X`09char`09*nvchar;`09/*`20FT_CHAR`20*/
  1098. X`09int`09*nvint;`09`09/*`20FT_INT`20*/
  1099. X`09long`09*nvtime;`09/*`20FT_TIME`20*/
  1100. X`09char`09**nvstring;`09/*`20FT_STRING`20*/
  1101. X`09struct`20mv`20*nvmove;`09/*`20FT_MOVE`20*/
  1102. X`09struct`20point`20*nvboard;`09/*`20FT_BOARD`20*/
  1103. X`09`7D;
  1104. X
  1105. Xstruct`20flist`20`7B`09`09`09/*`20list`20returned`20by`20filelist()`20*/
  1106. X`09char`09*name;`09`09/*`20file`20name`20*/
  1107. X`09struct`20flist`20*next;`09/*`20forward`20link`20*/
  1108. X`09`7D;
  1109. X
  1110. Xstruct`20mv`20`7B
  1111. X`09char`09roll;`09`09`09/*`20#`20on`201`20die,`200`20=`20DOUBLE,`20-1=empty
  1112. V`20*/
  1113. X`09char`09pt;`09`09`09/*`20point`20move`20is`20from,`20-1=UNUSED`20*/
  1114. X`09`7D;
  1115. X
  1116. Xstruct`20point`20`7B
  1117. X`09char`09qty;`09`09`09/*`20number`20of`20pieces`20on`20this`20point`20*/
  1118. X`09char`09color;`09`09`09/*`20color`20of`20pieces`20on`20this`20point`20*/
  1119. X`09`7D;
  1120. X
  1121. Xtypedef`20struct`20point`20board`5BBOARDSIZE`5D;`09/*`20board`20is`20array`20o
  1122. Vf`20points`20*/
  1123. X
  1124. Xstruct`20game`20`7B`09`09`09`09/*`20all`20info`20about`20a`20game`20in`20progr
  1125. Vess`20*/
  1126. X`09char`09*gameid;`09`09/*`20unique`20game`20id`20*/
  1127. X`09char`09*opaddr;`09`09/*`20email`20path`20to`20opponent`20*/
  1128. X`09char`09*opname;`09`09/*`20full`20name`20of`20opponent`20*/
  1129. X`09char`09*myaddr;`09`09/*`20my`20address`20for`20this`20user`20*/
  1130. X`09char`09mycolor;`09`09/*`20char`20to`20represent`20my`20pieces`20*/
  1131. X`09char`09opcolor;`09`09/*`20opponent's`20pieces`20*/
  1132. X`09char`09mydir;`09`09`09/*`201/-1`20direction`20I`20am`20moving`20*/
  1133. +-+-+-+-+-+-+-+-  END  OF PART 14 +-+-+-+-+-+-+-+-
  1134.