home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / volume14 / okbrdge2 / part14 < prev    next >
Encoding:
Internet Message Format  |  1993-01-26  |  23.2 KB

  1. Path: uunet!zephyr.ens.tek.com!master!saab!billr
  2. From: billr@saab.CNA.TEK.COM (Bill Randle)
  3. Newsgroups: comp.sources.games
  4. Subject: v14i092:  okbridge2 - computer-mediated bridge game, Part14/14
  5. Message-ID: <3531@master.CNA.TEK.COM>
  6. Date: 7 Sep 92 21:43:27 GMT
  7. Sender: news@master.CNA.TEK.COM
  8. Lines: 696
  9. Approved: billr@saab.CNA.TEK.COM
  10.  
  11. Submitted-by: mclegg@cs.UCSD.EDU (Matthew Clegg)
  12. Posting-number: Volume 14, Issue 92
  13. Archive-name: okbridge2/Part14
  14. Supersedes: okbridge: Volume 13, Issue 16-22
  15. Environment: BSD-derived Unix, NeXT, curses, sockets
  16.  
  17.  
  18.  
  19. #! /bin/sh
  20. # This is a shell archive.  Remove anything before this line, then unpack
  21. # it by saving it into a file and typing "sh file".  To overwrite existing
  22. # files, type "sh file -c".  You can also feed this as standard input via
  23. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  24. # will see the following message at the end:
  25. #        "End of archive 14 (of 14)."
  26. # Contents:  COPYRIGHT Revisions cipher.h conversation.h cs.h fds.h
  27. #   log.h nonstd.c okshuffle.man
  28. # Wrapped by billr@saab on Mon Sep  7 14:33:39 1992
  29. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  30. if test -f 'COPYRIGHT' -a "${1}" != "-c" ; then 
  31.   echo shar: Will not clobber existing file \"'COPYRIGHT'\"
  32. else
  33. echo shar: Extracting \"'COPYRIGHT'\" \(831 characters\)
  34. sed "s/^X//" >'COPYRIGHT' <<'END_OF_FILE'
  35. X                Copyright Notice
  36. X                    --------- ------
  37. X
  38. X          Copyright (C) 1990-1992 by Matthew Clegg
  39. X           All Rights Reserved
  40. X
  41. XOKbridge is made available as a free service to the Internet.
  42. XAccordingly, the following restrictions are placed on its use:
  43. X
  44. X1.  OKbridge may not be modified in any way without the explicit 
  45. X    permission of Matthew Clegg.  
  46. X
  47. X2.  OKbridge may not be used in any way for commercial advantage.
  48. X    It may not be placed on for-profit networks or on for-profit
  49. X    computer systems.  It may not be bundled as part of a package
  50. X    or service provided by a for-profit organization.
  51. X
  52. XIf you have questions about restrictions on the use of OKbridge,
  53. Xwrite to mclegg@cs.ucsd.edu.
  54. X
  55. XDISCLAIMER:  The user of OKbridge accepts full responsibility for any
  56. Xdamage which may be caused by OKbridge.
  57. X
  58. END_OF_FILE
  59. if test 831 -ne `wc -c <'COPYRIGHT'`; then
  60.     echo shar: \"'COPYRIGHT'\" unpacked with wrong size!
  61. fi
  62. # end of 'COPYRIGHT'
  63. fi
  64. if test -f 'Revisions' -a "${1}" != "-c" ; then 
  65.   echo shar: Will not clobber existing file \"'Revisions'\"
  66. else
  67. echo shar: Extracting \"'Revisions'\" \(2555 characters\)
  68. sed "s/^X//" >'Revisions' <<'END_OF_FILE'
  69. XThis file notes the changes that have been made for each revision
  70. Xof okbridge.  
  71. X
  72. X1.7-beta.1.  NeXT version completed August 4, 1992.
  73. X1.7-beta.2.  Corrected inconsistencies between system header files for Sun.
  74. X             First release to the next, August 5.
  75. X
  76. X ...
  77. X
  78. X1.7A         Released Friday, August 14, 1992.
  79. X
  80. X1.7B         Released Wednesday, August 19, 1992.
  81. X  - The install option now uses 'strip' to reduce the size of the executable.
  82. X  - The name of the install program is now a make variable.
  83. X  - Entering practice mode when no one has a seat does not cause a crash.
  84. X  - All players are removed from the spectator list when the last play is made.
  85. X  - The convention card is not repeated twice when using /setcc.
  86. X  - /opp messages are not repeated twice.
  87. X  - OKtally can now compute total score by player.
  88. X  - The fullname field is not re-initialized when entering server mode.
  89. X  - The /results display now highlights the record of the local player.
  90. X  - Added a /scoreboard command for displaying the OKbridge scoreboard.
  91. X  - The players who are credited for the play of a hand are those who were
  92. X    sitting at the table when the bidding ended.
  93. X  - Compiles without errors on the NeXT, 4.3 BSD Reno and some others.
  94. X  - Altered the IMP scoring so that for each board it averages the IMPs.
  95. X  - Displays the opening lead incorrectly in the log.
  96. X  - Displays the names of the players in the play correctly in the log.
  97. X  - "CLAIM OFFER DECLINED MESSAGE" is now displayed to declarer.
  98. X  - Using the /DUP command when the GPS is not available will not cause
  99. X    a core dump.
  100. X  - Removed extraneous semicolons which generated compiler warnings.
  101. X
  102. X1.7C
  103. X  - The GPS is now always informed when a player leaves duplicate mode.
  104. X  - Eliminated a bug which could allow a player to play the same card twice.
  105. X  - Eliminated a bug in the GPS which caused a core dump if the player tries
  106. X    to upload results of play at the wrong time.
  107. X  - Corrected a bug in the supplied version of bcopy.
  108. X  - Modified terminal.c to compile on systems which do not have TIOCGWINSZ.
  109. X  - If a spectator redraws the screen during bidding, the player's cards are
  110. X    displayed correctly.
  111. X  - Does not allow doubles when a contract bid has not yet been made.
  112. X  - Name changes are now recorded in the GPS.
  113. X  - Now requests the server to press <ESC> before dealing the first hand.
  114. X  - When the esc key is set to <CR>, extranoues PASS bids are no longer
  115. X    generated at the end of the bidding.
  116. X  - Observers may not use the /skip command now.
  117. X  - New players always join as observers.
  118. END_OF_FILE
  119. if test 2555 -ne `wc -c <'Revisions'`; then
  120.     echo shar: \"'Revisions'\" unpacked with wrong size!
  121. fi
  122. # end of 'Revisions'
  123. fi
  124. if test -f 'cipher.h' -a "${1}" != "-c" ; then 
  125.   echo shar: Will not clobber existing file \"'cipher.h'\"
  126. else
  127. echo shar: Extracting \"'cipher.h'\" \(2613 characters\)
  128. sed "s/^X//" >'cipher.h' <<'END_OF_FILE'
  129. X/* cipher.h
  130. X *
  131. X ! Copyright (C) 1990-1992 by Matthew Clegg.  All Rights Reserved
  132. X ! 
  133. X ! OKbridge is made available as a free service to the Internet.
  134. X ! Accordingly, the following restrictions are placed on its use:
  135. X ! 
  136. X ! 1.  OKbridge may not be modified in any way without the explicit 
  137. X !     permission of Matthew Clegg.  
  138. X ! 
  139. X ! 2.  OKbridge may not be used in any way for commercial advantage.
  140. X !     It may not be placed on for-profit networks or on for-profit
  141. X !     computer systems.  It may not be bundled as part of a package
  142. X !     or service provided by a for-profit organization.
  143. X ! 
  144. X ! If you have questions about restrictions on the use of OKbridge,
  145. X ! write to mclegg@cs.ucsd.edu.
  146. X ! 
  147. X ! DISCLAIMER:  The user of OKbridge accepts full responsibility for any
  148. X ! damage which may be caused by OKbridge.
  149. X *
  150. X * This file provides definitions for a module which implements a
  151. X * very simple cipher that is used to encode crucial parts of the
  152. X * email duplicate files.  The purpose of the cipher is to allow
  153. X * email duplicate files to be manipulated easily without revealing
  154. X * their contents.  For details about how the cipher is implemented,
  155. X * see the file code.c.
  156. X *
  157. X*/
  158. X
  159. X#define CIPHER_INCLUDED
  160. X
  161. X#define CIPHER_SIZE    64
  162. X#define CIPHER_SIZE1    65
  163. X
  164. Xtypedef struct Cipher_struct {
  165. X  /* For more information about the meanings of these fields, see the
  166. X     header of file code.c */
  167. X  int encoding  [CIPHER_SIZE1];  /* The permutation p */
  168. X  int decoding  [CIPHER_SIZE1];
  169. X} Cipher, *Cipher_ptr;
  170. X
  171. X
  172. Xint Read_Cipher_Descriptor ();
  173. X/*  Reads a cipher descriptor from the file f.  Returns 0 if successful
  174. X    or 1 if an error occurred. */
  175. X
  176. Xvoid Write_Cipher_Descriptor ();
  177. X/* Writes the cipher descriptor c to the file f. */
  178. X
  179. Xvoid Create_Cipher_Descriptor ();
  180. X/* Fills the structure c with a randomly generated cipher descriptor. */
  181. X
  182. Xvoid Encode_String ();
  183. X/* Encodes the string in source, placing the result in dest.
  184. X   If c == NULL, then simply copies source to dest. */
  185. X
  186. Xvoid Decode_String ();
  187. X/* Decodes the string in source, placing the result in dest.
  188. X   If c == NULL, then simply copies source to dest. */
  189. X
  190. Xvoid Write_Ciphered_Line ();
  191. X/* Encodes buf using the cipher c and writes it to the file f. 
  192. X   The first character written to the file is an exclamation point '!' */
  193. X
  194. Xint Read_Ciphered_Line ();
  195. X/* Reads a line of up to buflen characters from the file f and decodes
  196. X   the line using the cipher c.  If the first character of the line
  197. X   is not an exclamation point '!', then the line is assumed to be
  198. X   in plain text.  Returns the number of characters read or -1 if
  199. X   end of file is reached.
  200. X*/
  201. END_OF_FILE
  202. if test 2613 -ne `wc -c <'cipher.h'`; then
  203.     echo shar: \"'cipher.h'\" unpacked with wrong size!
  204. fi
  205. # end of 'cipher.h'
  206. fi
  207. if test -f 'conversation.h' -a "${1}" != "-c" ; then 
  208.   echo shar: Will not clobber existing file \"'conversation.h'\"
  209. else
  210. echo shar: Extracting \"'conversation.h'\" \(2564 characters\)
  211. sed "s/^X//" >'conversation.h' <<'END_OF_FILE'
  212. X/* conversation.h -- process messages at conversation level.
  213. X *
  214. X ! Copyright (C) 1990-1992 by Matthew Clegg.  All Rights Reserved
  215. X ! 
  216. X ! OKbridge is made available as a free service to the Internet.
  217. X ! Accordingly, the following restrictions are placed on its use:
  218. X ! 
  219. X ! 1.  OKbridge may not be modified in any way without the explicit 
  220. X !     permission of Matthew Clegg.  
  221. X ! 
  222. X ! 2.  OKbridge may not be used in any way for commercial advantage.
  223. X !     It may not be placed on for-profit networks or on for-profit
  224. X !     computer systems.  It may not be bundled as part of a package
  225. X !     or service provided by a for-profit organization.
  226. X ! 
  227. X ! If you have questions about restrictions on the use of OKbridge,
  228. X ! write to mclegg@cs.ucsd.edu.
  229. X ! 
  230. X ! DISCLAIMER:  The user of OKbridge accepts full responsibility for any
  231. X ! damage which may be caused by OKbridge.
  232. X *
  233. X */
  234. X
  235. Xtypedef int (* event_signal) ();
  236. X  /* The wait for event routines below take as a parameter a pointer to
  237. X     a function which returns true when the event in question has occurred.
  238. X  */
  239. X
  240. Xvoid Handle_Conversation_Message ();
  241. X/* Processes the message m.  If the message is a conversation message, then
  242. X * takes appropriate action based on the message.  Appends the message
  243. X * to the appropriate conversation queue if further action is warranted.
  244. X */
  245. X
  246. Xvoid Wait_for_event_at_conversation_level ();
  247. X/* Receives incoming messages at all tables.  Handles keyboard characters
  248. X * and messages which arrive on the protocol queues.  Each time a keyboard
  249. X * character is received or a new message is processed, the event_signal
  250. X * routine is called.  If it returns true, then the procedure exits.
  251. X */
  252. X
  253. Xvoid Wait_for_event_at_game_level ();
  254. X/* Receives incoming messages at all tables.  Handles keyboard characters
  255. X * and messages which arrive on the protocol and conversation queues.  Each
  256. X * time a keyboard character is received or a new message is processed, the
  257. X * event_signal e routine is called.  If it returns true, then the procedure
  258. X * exits.  
  259. X */
  260. X
  261. XTable Wait_for_conversation_message ();
  262. X/* Receives incoming message at all tables.  Handles keyboard characters
  263. X * and messages which arrive on the protocol queues.  When a message is
  264. X * placed onto the conversation queue of a table, returns a pointer to
  265. X * the table. */
  266. X
  267. XTable Wait_for_game_message ();
  268. X/* Receives incoming messages at all tables.  Handles keyboard characters
  269. X * and messages which arrive on the protocol and game queues.  When a message
  270. X * is placed onto the game queue of a table, returns a pointer to the table.
  271. X */
  272. X
  273. END_OF_FILE
  274. if test 2564 -ne `wc -c <'conversation.h'`; then
  275.     echo shar: \"'conversation.h'\" unpacked with wrong size!
  276. fi
  277. # end of 'conversation.h'
  278. fi
  279. if test -f 'cs.h' -a "${1}" != "-c" ; then 
  280.   echo shar: Will not clobber existing file \"'cs.h'\"
  281. else
  282. echo shar: Extracting \"'cs.h'\" \(1665 characters\)
  283. sed "s/^X//" >'cs.h' <<'END_OF_FILE'
  284. X/* cs.h -- client/server routines
  285. X *
  286. X ! Copyright (C) 1990-1992 by Matthew Clegg.  All Rights Reserved
  287. X ! 
  288. X ! OKbridge is made available as a free service to the Internet.
  289. X ! Accordingly, the following restrictions are placed on its use:
  290. X ! 
  291. X ! 1.  OKbridge may not be modified in any way without the explicit 
  292. X !     permission of Matthew Clegg.  
  293. X ! 
  294. X ! 2.  OKbridge may not be used in any way for commercial advantage.
  295. X !     It may not be placed on for-profit networks or on for-profit
  296. X !     computer systems.  It may not be bundled as part of a package
  297. X !     or service provided by a for-profit organization.
  298. X ! 
  299. X ! If you have questions about restrictions on the use of OKbridge,
  300. X ! write to mclegg@cs.ucsd.edu.
  301. X ! 
  302. X ! DISCLAIMER:  The user of OKbridge accepts full responsibility for any
  303. X ! damage which may be caused by OKbridge.
  304. X *
  305. X */
  306. X
  307. Xextern void Handle_Protocol_Message_for_Server ();
  308. X/* void Handle_Protocol_Message_for_Server (message m); */
  309. X/* Processes the message m.  If the message is a protocol message, then
  310. X   takes appropriate action based on the message.  Appends the message
  311. X   to the appropriate conversation queue if further action is warranted.
  312. X*/
  313. X
  314. Xextern void Handle_Protocol_Message_for_Client ();
  315. X/* void Handle_Protocol_Message_for_Client (message m); */
  316. X/* Performs the corresponding action as Handle_Protocol_Message_for_Server */
  317. X
  318. Xextern void Clear_Spectators ();
  319. X/* void Clear_Spectators (Table t); */
  320. X/* Clears the spectator mode flag for each of the players at the table t. */
  321. X
  322. Xextern void Assign_seat ();
  323. X/* void Assign_seat (Table t, Connection c, int seat); */
  324. X/* Assigns the given seat to the player with connection c. */
  325. END_OF_FILE
  326. if test 1665 -ne `wc -c <'cs.h'`; then
  327.     echo shar: \"'cs.h'\" unpacked with wrong size!
  328. fi
  329. # end of 'cs.h'
  330. fi
  331. if test -f 'fds.h' -a "${1}" != "-c" ; then 
  332.   echo shar: Will not clobber existing file \"'fds.h'\"
  333. else
  334. echo shar: Extracting \"'fds.h'\" \(1352 characters\)
  335. sed "s/^X//" >'fds.h' <<'END_OF_FILE'
  336. X/* fds.h
  337. X *
  338. X ! Copyright (C) 1990-1992 by Matthew Clegg.  All Rights Reserved
  339. X ! 
  340. X ! OKbridge is made available as a free service to the Internet.
  341. X ! Accordingly, the following restrictions are placed on its use:
  342. X ! 
  343. X ! 1.  OKbridge may not be modified in any way without the explicit 
  344. X !     permission of Matthew Clegg.  
  345. X ! 
  346. X ! 2.  OKbridge may not be used in any way for commercial advantage.
  347. X !     It may not be placed on for-profit networks or on for-profit
  348. X !     computer systems.  It may not be bundled as part of a package
  349. X !     or service provided by a for-profit organization.
  350. X ! 
  351. X ! If you have questions about restrictions on the use of OKbridge,
  352. X ! write to mclegg@cs.ucsd.edu.
  353. X ! 
  354. X ! DISCLAIMER:  The user of OKbridge accepts full responsibility for any
  355. X ! damage which may be caused by OKbridge.
  356. X *
  357. X * This code was contributed by aaron@cie.uoregon.edu (Aaron Putnam).
  358. X *
  359. X * It provides definitions for the FD_ macros for those systems which
  360. X * do not define them.
  361. X */
  362. X
  363. X
  364. X#ifndef FD_SETSIZE
  365. X#  define FD_SETSIZE  64
  366. X#endif
  367. X
  368. X#ifndef FD_ZERO
  369. X#  define FD_ZERO(x) ((x)->fds_bits[0] = 0)
  370. X#endif
  371. X
  372. X#ifndef FD_SET
  373. X#  define FD_SET(y,x) ((*(x)).fds_bits[0] |= (1 << (y)))
  374. X#endif
  375. X
  376. X#ifndef FD_CLR
  377. X#  define FD_CLR(y,x) ((*(x)).fds_bits[0] & (1 << (y)))
  378. X#endif
  379. X
  380. X#ifndef FD_ISSET
  381. X#  define FD_ISSET(y,x) ((*(x)).fds_bits[0] & (1 << (y)))
  382. X#endif
  383. X
  384. END_OF_FILE
  385. if test 1352 -ne `wc -c <'fds.h'`; then
  386.     echo shar: \"'fds.h'\" unpacked with wrong size!
  387. fi
  388. # end of 'fds.h'
  389. fi
  390. if test -f 'log.h' -a "${1}" != "-c" ; then 
  391.   echo shar: Will not clobber existing file \"'log.h'\"
  392. else
  393. echo shar: Extracting \"'log.h'\" \(1817 characters\)
  394. sed "s/^X//" >'log.h' <<'END_OF_FILE'
  395. X/* log.h -- routines for writing log files.
  396. X *
  397. X ! Copyright (C) 1990-1992 by Matthew Clegg.  All Rights Reserved
  398. X ! 
  399. X ! OKbridge is made available as a free service to the Internet.
  400. X ! Accordingly, the following restrictions are placed on its use:
  401. X ! 
  402. X ! 1.  OKbridge may not be modified in any way without the explicit 
  403. X !     permission of Matthew Clegg.  
  404. X ! 
  405. X ! 2.  OKbridge may not be used in any way for commercial advantage.
  406. X !     It may not be placed on for-profit networks or on for-profit
  407. X !     computer systems.  It may not be bundled as part of a package
  408. X !     or service provided by a for-profit organization.
  409. X ! 
  410. X ! If you have questions about restrictions on the use of OKbridge,
  411. X ! write to mclegg@cs.ucsd.edu.
  412. X ! 
  413. X ! DISCLAIMER:  The user of OKbridge accepts full responsibility for any
  414. X ! damage which may be caused by OKbridge.
  415. X *
  416. X */
  417. X
  418. Xvoid Write_hand ();
  419. X/* Writes the board b with play record p to the file f in an expanded
  420. X * format which is similar to that found in bridge books.
  421. X */
  422. X
  423. Xvoid Write_hand_compactly 
  424. X  ();
  425. X/* Writes the board b with play record p to the file f in a brief format
  426. X * which was introduced by S. Zhang.
  427. X */
  428. X
  429. Xvoid sprint_summary_header ();
  430. X/* Writes to the buffer buf the header which is used in the scoring
  431. X * summaries. 
  432. X */
  433. X
  434. Xvoid sprint_summary_record ();
  435. X/* Writes to the buffers buf1 and buf2 the scoring summary for the board b
  436. X * and play record p.
  437. X */
  438. X
  439. Xvoid Write_summary_of_play ();
  440. X/* For each play record associated to the board b, writes a single line
  441. X * summary describing the result of play.
  442. X */
  443. X
  444. Xvoid Sort_play_records_by_matchpoints ();
  445. X/* Sorts the set of play records for the board b according to the match
  446. X * point scores.
  447. X */
  448. X
  449. Xvoid Sort_play_records_by_imps ();
  450. X/* Sorts the set of play records for the board b according to the
  451. X * imp scores.
  452. X */
  453. END_OF_FILE
  454. if test 1817 -ne `wc -c <'log.h'`; then
  455.     echo shar: \"'log.h'\" unpacked with wrong size!
  456. fi
  457. # end of 'log.h'
  458. fi
  459. if test -f 'nonstd.c' -a "${1}" != "-c" ; then 
  460.   echo shar: Will not clobber existing file \"'nonstd.c'\"
  461. else
  462. echo shar: Extracting \"'nonstd.c'\" \(2554 characters\)
  463. sed "s/^X//" >'nonstd.c' <<'END_OF_FILE'
  464. X/* nonstd.c -- nonstandard routines.
  465. X *
  466. X ! Copyright (C) 1990-1992 by Matthew Clegg.  All Rights Reserved
  467. X ! 
  468. X ! OKbridge is made available as a free service to the Internet.
  469. X ! Accordingly, the following restrictions are placed on its use:
  470. X ! 
  471. X ! 1.  OKbridge may not be modified in any way without the explicit 
  472. X !     permission of Matthew Clegg.  
  473. X ! 
  474. X ! 2.  OKbridge may not be used in any way for commercial advantage.
  475. X !     It may not be placed on for-profit networks or on for-profit
  476. X !     computer systems.  It may not be bundled as part of a package
  477. X !     or service provided by a for-profit organization.
  478. X ! 
  479. X ! If you have questions about restrictions on the use of OKbridge,
  480. X ! write to mclegg@cs.ucsd.edu.
  481. X ! 
  482. X ! DISCLAIMER:  The user of OKbridge accepts full responsibility for any
  483. X ! damage which may be caused by OKbridge.
  484. X *
  485. X * This file contains routines which are not available on all systems.
  486. X */
  487. X
  488. X#include <stdio.h>
  489. X#include <ctype.h>
  490. X#include <string.h>
  491. X
  492. X#ifdef HPUX
  493. X#define NO_BCOPY
  494. X#define NO_INDEX
  495. X#endif
  496. X
  497. Xextern char *malloc ();
  498. X
  499. Xchar *strdup (s)
  500. X    char *s;
  501. X{
  502. X    char *p, *q;
  503. X
  504. X    if (s == NULL)
  505. X      return (NULL);
  506. X
  507. X    q = p = (char *) malloc (strlen(s) + 1);
  508. X    while (*s != '\0')
  509. X        *(q++) = *(s++);
  510. X    *q = '\0';
  511. X    return (p);
  512. X}
  513. X
  514. X#ifdef NO_ISSPACE
  515. Xint isspace (ch)
  516. X     char ch;
  517. X{
  518. X  return ((ch == ' ') || (ch == '\t') || (ch == '\n'));
  519. X}
  520. X#endif
  521. X
  522. X#ifdef NO_BCOPY
  523. Xvoid bcopy (from, to, len)
  524. X     char *from, *to; int len;
  525. X{
  526. X  while (--len >= 0)
  527. X    *(to++) = *(from++);
  528. X}
  529. X#endif
  530. X
  531. X#ifdef NO_INDEX
  532. Xchar *index (s, c)
  533. X     char *s, c;
  534. X{
  535. X  return (strchr(s,c));
  536. X}
  537. X#endif
  538. X
  539. X#ifdef NO_STRCASECMP
  540. Xint strcasecmp (s1, s2)
  541. X     char *s1, *s2;
  542. X{
  543. X  char c1, c2;
  544. X
  545. X  c1 = *(s1++); c2 = *(s2++);
  546. X  while (c1 && c2) {
  547. X    if (('a' <= c1) && (c1 <= 'z')) c1 = c1 - 'a' + 'A';
  548. X    if (('a' <= c2) && (c2 <= 'z')) c2 = c2 - 'a' + 'A';
  549. X    if (c1 < c2)
  550. X      return (-1);
  551. X    else if (c2 < c1)
  552. X      return (1);
  553. X    c1 = *(s1++); c2 = *(s2++);
  554. X  }
  555. X  if ((c1 == 0) && (c2 == 0))
  556. X    return (0);
  557. X  else if (c1 == 0)
  558. X    return (-1);
  559. X  else
  560. X    return (1);
  561. X    
  562. X}
  563. X
  564. Xint strncasecmp (s1, s2, count)
  565. X     char *s1, *s2; int count;
  566. X{
  567. X  int i, c1, c2;
  568. X
  569. X  for (i = 0; i < count; i++) {
  570. X    c1 = *(s1++); c2 = *(s2++);
  571. X    if ((c1 == 0) && (c2 == 0))
  572. X      return (0);
  573. X    else if (c1 == 0)
  574. X      return (-1);
  575. X    else if (c2 == 0)
  576. X      return (1);
  577. X    if (('a' <= c1) && (c1 <= 'z')) c1 = c1 - 'a' + 'A';
  578. X    if (('a' <= c2) && (c2 <= 'z')) c2 = c2 - 'a' + 'A';
  579. X    if (c1 < c2)
  580. X      return (-1);
  581. X    else if (c2 < c1)
  582. X      return (1);
  583. X  }
  584. X  return (0);
  585. X}
  586. X#endif
  587. END_OF_FILE
  588. if test 2554 -ne `wc -c <'nonstd.c'`; then
  589.     echo shar: \"'nonstd.c'\" unpacked with wrong size!
  590. fi
  591. # end of 'nonstd.c'
  592. fi
  593. if test -f 'okshuffle.man' -a "${1}" != "-c" ; then 
  594.   echo shar: Will not clobber existing file \"'okshuffle.man'\"
  595. else
  596. echo shar: Extracting \"'okshuffle.man'\" \(2509 characters\)
  597. sed "s/^X//" >'okshuffle.man' <<'END_OF_FILE'
  598. X.\"
  599. X.\" Adapted from README.Playing -- how to operate the okbridge program
  600. X.\" Matthew Clegg.  September 1990.  Updated May 1991, May 1992.
  601. X.\"
  602. X.TH "OKSHUFFLE" 6 "4 Aug 1992"
  603. X.SH NAME
  604. Xokshuffle \- create unplayed shuffled boards for okbridge
  605. X.br
  606. Xoktally \- merge played boards for okbridge
  607. X.SH SYNPOSIS
  608. X.in +10n
  609. X.ti -10n
  610. Xokshuffle
  611. X.I nboards
  612. X[\fB\-dimr\fP]
  613. X[\fB\-n\fP \fIname\fP]
  614. X.in -10n
  615. X.in +8n
  616. X.ti -8n
  617. Xoktally
  618. X[\fB\-c\fP]
  619. X[\fB\-i\fP]
  620. X[\fB\-l\fP]
  621. X[\fB\-m\fP]
  622. X[\fB\-p\fP \fIplayername\fP]
  623. X[\fB\-sn\fP]
  624. X[\fB\-t[b]\fP]
  625. X[\fB\-z\fP] files
  626. X.in -8n
  627. X.SH DESCRIPTION
  628. X.I Okshuffle
  629. Xcreates a set of unplayed shuffled boards for use with
  630. X.IR okbridge (6).
  631. XThe
  632. X.I nboards  
  633. Xparameter is the number of boards to shuffle.  If this is omitted,
  634. Xthen 4 is assumed. Output is to stdout.
  635. X.PP
  636. X.I Oktally
  637. Xmerges a number of boards that have already been played.
  638. XIt reads each of the given files; if one of the file names is
  639. X"-", then standard input is read instead.  It then merges the boards
  640. Xfrom these files and totals the match points for each pair.  It writes
  641. Xthe merged set of boards to standard output.  By default, the output
  642. Xformat displays only the results of play for each board.
  643. X.SH "OKSHUFFLE OPTIONS"
  644. X.IP "\fB-dimr\fP"
  645. XSpecifies a scoring mode respectively of duplicate, IMP, match point
  646. Xor rubber scoring.
  647. X.IP "\fB-n\fP \fIname\fP"
  648. XSpecifies a brief (10 character) name which will be used for identifying
  649. Xthe set of boards.
  650. X.SH "OKTALLY OPTIONS"
  651. X.IP "\fB-c\fP
  652. XIf given, writes an encoded email duplicate file as output.
  653. X.IP "\fB-i\fP
  654. XSorts the output play records by IMPs.  The default is to sort by match
  655. Xpoints.
  656. X.IP "\fB-l\fP
  657. XWrites each board in a long format which is similar to that found in
  658. Xbridge literature.
  659. X.IP "\fB-m\fP
  660. XDoes a selective merge.  Boards appearing in the second and succeeding
  661. Xfiles which do not appear in the first file are ignored.
  662. X.IP "\fB\-p\fP \fIplayername\fP"
  663. XOnly considers boards which have been played by \fIplayername\fP.
  664. X.IP "\fB-s\fP\fIn\fP"
  665. XIf given, then \fIn\fP is read as a positive integer which specifies
  666. Xthe number of boards to skip in the input files.
  667. X.IP "\fB\-t[b]\fP"
  668. XOutput the total scores by player, sorted in decreasing order.
  669. XIf the \fBb\fP option is given, then both match point and IMP scores
  670. Xare printed.
  671. X.IP "\fB-z\fP"
  672. XWrites each board out in a compact format which was first introduced by
  673. XShangyou Zhang.
  674. X
  675. X.SH "SEE ALSO"
  676. Xokbridge(6)
  677. X.SH AUTHOR
  678. X.PP
  679. XMatthew Clegg, mclegg@cs.ucsd.edu.
  680. X.PP
  681. XMan pages adapted by George Ferguson,
  682. X.br
  683. Xferguson@cs.rochester.edu.
  684. END_OF_FILE
  685. if test 2509 -ne `wc -c <'okshuffle.man'`; then
  686.     echo shar: \"'okshuffle.man'\" unpacked with wrong size!
  687. fi
  688. # end of 'okshuffle.man'
  689. fi
  690. echo shar: End of archive 14 \(of 14\).
  691. cp /dev/null ark14isdone
  692. MISSING=""
  693. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 ; do
  694.     if test ! -f ark${I}isdone ; then
  695.     MISSING="${MISSING} ${I}"
  696.     fi
  697. done
  698. if test "${MISSING}" = "" ; then
  699.     echo You have unpacked all 14 archives.
  700.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  701. else
  702.     echo You still need to unpack the following archives:
  703.     echo "        " ${MISSING}
  704. fi
  705. ##  End of shell archive.
  706. exit 0
  707.