1 2006-01-14 Carl Worth <cworth@cworth.org>
3 * src/test-board.c (main): Remove bogus line of code which didn't
6 2006-01-14 Carl Worth <cworth@cworth.org>
10 * kub/Makefile.am: Add kub directory to build system.
12 * src/ttt-board.c: (ttt_board_is_won): Fix whitespace.
14 2005-12-14 Carl Worth <cworth@cworth.org>
16 * src/ttt-server.h: Update the documentation of these functions to
17 be more precise about what happens to client mutexes.
19 * src/ttt-board.c: (ttt_board_is_won): And some white space to
20 make things more readable.
22 2005-12-13 Bryan Worth <bryan@theworths.org>
23 * src/ttt-curses-client: Cleaned up text-entry code. Added support
24 for HOME, END, DELETE, and ARROW keys
27 2005-12-13 Carl Worth <cworth@cworth.org>
29 * TODO: Note that ttt-server should retry a couple times if its
30 port is not available.
32 * src/test-board.c: (main): Remove debug print messages.
34 * src/ttt-board.c: (ttt_board_make_move): Tighten up the code just
37 2005-12-10 Richard D. Worth <richard@theworths.org>
39 * TODO: check off INVITE, RETRACT, DECLINE, Game Invitation
40 notices, Connection setup errors, NO_INVITE, User information
43 * src/ttt-client.c: (_ttt_client_execute_helo),
44 (_ttt_client_execute_statistics), (_ttt_client_execute_message),
45 (_ttt_client_execute_help), (_ttt_client_execute_version),
46 (_ttt_client_execute_quit), (_ttt_client_execute_invite),
47 (_ttt_client_execute_accept), (_ttt_client_execute_retract),
48 (_ttt_client_execute_decline), (_read_request),
50 (_handle_requests_thread): Whitespace changes. Use exported get
51 methods (get_username, get_num_wins). Use strcasecmp in place of
52 toupper. Finish RETRACT, DECLINE.
56 * src/ttt-server.c: (ttt_server_init),
57 (ttt_server_register_client), (ttt_server_unregister_client),
58 (ttt_server_verify_username),
59 (ttt_server_get_client_from_username), (ttt_server_add_invite),
60 (ttt_server_remove_invite): Add invite struct. Make username case
61 insensitive (missed in register_client). Implement add_invite,
62 remove_invite. Moved statistics to ttt-client.c
64 2005-12-09 Carl Worth <cworth@cworth.org>
66 * src/ttt-server.c (ttt_server_unregister_client): Move client has
67 left message to stderr so it makes it to the log file too.
69 2005-12-09 Carl Worth <cworth@cworth.org>
71 * src/ttt-server.c (main): Put the initial server started message
72 in the log file as well.
74 2005-12-09 Carl Worth <cworth@cworth.org>
77 * src/ttt-args.c: (ttt_args_help), (ttt_args_parse): Add a -u,
78 --user option for controlling the uid under which the server
82 * src/ttt-server.c: (ttt_server_register_client), (main): Recert
83 the dup of stdout which wasn't working. Instead just print client
84 join information on stderr so that it goes into the log. Implement
85 support for the user option by calling setuid to drop root
86 privileges the process might start out with.
88 2005-12-09 Bryan Worth <bryan@theworths.org>
89 * src/ttt-curses-client.c: added error checking to ttt_create_client
90 call. Added ability to escape server commands by prepending with "/".
91 Added ability so override port number with port=xxxx entry in
94 2005-12-08 Carl Worth <cworth@cworth.org>
96 * src/ttt-server.c (main): When detached dup stdout to stderr so
97 that everything appears in the log file.
99 2005-12-08 Carl Worth <cworth@cworth.org>
102 * src/ttt-args.c: (ttt_args_help), (ttt_args_parse): Add
103 -d,--detach and --pid-file=FILE options for running the server as
106 * src/ttt-server.c: (ttt_server_statistics),
107 (ttt_server_verify_username), (_detach_and_write_child_pid_to),
108 (main): Add support for detaching and writing out the child PID to
112 * src/x.c: (xfopen), (xdup2): Two new x-functions.
114 2005-12-08 Carl Worth <cworth@cworth.org>
116 * src/ttt-args.c: (ttt_args_help), (ttt_args_parse):
118 * src/ttt-server.c: (ttt_server_statistics),
119 (ttt_server_verify_username), (_detach_and_write_child_pid_to),
121 * src/x.c: (xfopen), (xdup2):
124 2005-12-08 Bryan Worth <bryan@theworths.org>
125 * src/ttt-curses-client.c: Multiple improvements!
126 Username taken from USER environment variable and stored as
127 preference in ~/.ttt/client.conf (username=xxxxxx). Backspace
128 should now work correctly with all term types. Status messages
129 display in seperate area. "MESSAGE" reply from server is
130 suppressed. Eliminated most global variables.
133 2005-12-08 Carl Worth <cworth@cworth.org>
135 * src/Makefile.am: Fix rule to auto-generate ttt-lex.h.
137 * src/ttt-lex.h: Remove generated file from revision control.
139 * src/ttt-lex.l: Add copyright/license blurb.
142 * src/ttt-client.c: (yy_init_globals), (use_yy_init_globals):
143 Shut off some annoying compiler warnings due to flex bugs (only
146 2005-12-07 Richard D. Worth <richard@theworths.org>
148 * PROTOCOL: Remove unused error NOT_IN_GAME. Add error
151 * TODO: Add error NOT_VALID_MOVE.
154 * src/ttt-error.c: (ttt_error_string): Add section comments. Add
155 error NOT_VALID_MOVE.
157 2005-12-06 Bryan Worth <bryan@theworths.org>
158 * src/ttt-error.c: fixed missing errors (NO_INVITE, NO_GAME)
160 2005-12-06 Richard D. Worth <richard@theworths.org>
162 * PROTOCOL: Add error NO_INVITE
164 * TODO: Uncheck INVITE, ACCEPT
166 * src/ttt-error.c: (ttt_error_string): Add errors NO_INVITE,
169 * src/ttt-client.c: (_ttt_client_execute_message),
170 (_ttt_client_execute_help), (_ttt_client_execute_version),
171 (_ttt_client_execute_invite), (_ttt_client_execute_accept),
172 (_ttt_client_execute_retract), (_ttt_client_execute_decline):
173 Whitespace changes. Partially implement RETRACT, DECLINE.
175 2005-12-05 Richard D. Worth <richard@theworths.org>
177 * PROTOCOL: Fill some missing possible error occurrences.
179 * TODO: Check off INVITE, ACCEPT, ERROR COMMAND, ERROR NO_USER
182 * src/ttt-server.c: (ttt_server_verify_username):
183 * src/ttt-client.c: (_ttt_client_execute_help),
184 (_ttt_client_execute_invite), (_ttt_client_execute_accept):
185 Implement INVITE, ACCEPT
187 2005-12-05 Richard D. Worth <richard@theworths.org>
189 * src/ttt-curses-client.c: (mvprintstr), (mvwprintstr), (wprint),
190 (main), (finish): Whitespace changes.
192 2005-12-04 Bryan Worth <bryan@theworths.org>
193 * src/ttt-socket.c: (ttt_socket_create_client) fixed socket to be
194 non-blocking. (ttt_socket_read) added return value for number
196 * Makefile.am: added necessary code for new curses-client program.
197 * src/ttt-curses-client: new ncurses based client
199 2005-12-03 Richard D. Worth <richard@theworths.org>
201 * PROTOCOL: Add RETRACT, DECLINE. Add game identifier for all game
204 * TODO: Add RETRACT, DECLINE, notices.
206 2005-12-03 Richard D. Worth <richard@theworths.org>
208 * PROTOCOL: Add underscores to error codes. Add STATISTICS
209 command. Remove statistics from WHO.
211 * TODO: Add STATISTICS. Check off STATISTICS.
213 * src/ttt.h: Define TTT_SERVER_PROTOCOL_VERSION for VERSION.
215 * src/ttt-error.c: (ttt_error_string): Add underscores to error
219 * src/ttt-client.c: (_ttt_client_execute_helo),
220 (_ttt_client_execute_statistics), (_ttt_client_execute_message),
221 (_ttt_client_execute_version), (_ttt_client_execute_quit),
222 (_ttt_client_init), (_ttt_client_fini), (ttt_client_get_username),
223 (ttt_client_set_username): Rename client->name to
224 client->username. Implement STATISTICS. Complete implementation of
228 * src/ttt-server.c: (ttt_server_register_client),
229 (ttt_server_unregister_client), (ttt_server_who),
230 (ttt_server_statistics): Track rename of client->name to
231 client->username. Add server helper for STATISTICS.
233 2005-12-02 Richard D. Worth <richard@theworths.org>
235 * TODO: Check off Global commands, HELP, VERSION.
237 * src/ttt-client.c: (_ttt_client_execute_message),
238 (_ttt_client_execute_help), (_execute_request): Whitespace
239 changes. Implement HELP with usage and short description.
241 * src/ttt-server.c: Update the server welcome message.
243 2005-12-01 Richard D. Worth <richard@theworths.org>
245 * TODO: Check off NOTICE MESSAGE, ERROR NONAMESET.
247 * PROTOCOL: Add NONAMESET error in possible errors where
248 applicable. Add description for MESSAGE.
250 * src/ttt-token.h: Add token typedef. Rename token type enum.
252 * src/ttt-lex.l: Add support for quoted string as single token.
253 * src/ttt-lex.h: Autogenerated.
255 * src/ttt-client.c: (_ttt_client_execute_helo),
256 (_ttt_client_execute_who), (_ttt_client_execute_message),
257 (_ttt_client_execute_help), (_ttt_client_execute_version),
258 (_ttt_client_execute_quit), (_ttt_client_init), (_read_request),
259 (_execute_request): Whitespace changes. Implement VERSION,
260 HELP. Change args_required back to args_min and args_max (see
261 PROTOCOL\HELP). Modify MESSAGE to accept one token arg and quote
262 output. Return NONAMESET error where applicable.
264 2005-11-29 Carl Worth <cworth@cworth.org>
267 * src/ttt-socket.c: (ttt_socket_create_client): New function for
268 creating a client socket.
271 * src/x.c: (xconnect): Add xconnect. Return a couple of useful
272 error status values so that callers can recover on connection
273 refused or host unreachable.
275 * src/ttt.h: Add TTT_STATUS_CONNECTION_REFUSED and
276 TTT_STATUS_NETWORK_UNREACHABLE.
278 2005-11-28 Kevin Worth <kevin@theworths.org>
280 * PROTOCOL: Changed board cell numbering to start with zero
284 * src/test-board.c: (main): Added new file for testing.
286 * src/ttt-board.c: (ttt_board_init), (ttt_board_to_string):
287 * src/ttt-board.h: Implemented board_to_string.
289 2005-11-28 kevin worth <kevin@theworths.org>
292 * src/ttt-board.h: Moved struct def from ttt-board.h into
293 ttt-board.c to make it private
298 2005-11-28 Carl Worth <cworth@cworth.org>
300 * TODO: Add instructions on using the first letter of our names to
301 indicate we are working on something.
303 2005-11-25 Bryan Worth <bryan@theworths.org>
304 * ttt-client.c, ttt-server.c, ttt-error.c changed line breaks to
305 <crlf> (\r\n) for network compatibility
307 2005-11-25 Bryan Worth <bryan@theworths.org>
308 * TODO: checked off NOTICE USER and NOTICE QUIT
309 *src/ttt-client.c: (_ttt_client_execute_helo): implement NOTICE USER
310 *(_ttt_client_execute_quit): implement NOTICE QUIT
312 2005-11-25 Bryan Worth <bryan@theworths.org>
313 * TODO: checked off MESSAGE
315 *src/ttt-client.c: (_ttt_client_execute_message): Implement MESSAGE
316 *(_execute_request): changed arg_required to behave as a minimum
317 instead of an absolute number to allow optional arguments such as
320 2005-11-25 Richard D. Worth <richard@theworths.org>
322 * TODO: checked off WHO, QUIT, ERROR SYNTAX
324 * src/ttt-client.c: (_ttt_client_execute_helo), (_ttt_client_init),
325 (ttt_client_get_num_wins):
327 * src/ttt-server.c: (ttt_server_who): Whitespace changes. Add
328 missing player win count for WHO.
330 2005-11-24 Richard D. Worth <richard@theworths.org>
332 * AUTHORS: Add Richard D. Worth
333 * TODO: Add newline before EOF
335 * src/ttt-client.c: (_ttt_client_execute_who):
337 * src/ttt-server.c: (ttt_server_who): Implement WHO.
339 2005-11-24 Carl Worth <cworth@cworth.org>
341 * PROTOCOL: Document QUIT.
343 * src/ttt-client.c: (_ttt_client_execute_helo),
344 (_ttt_client_execute_quit), (_ttt_client_init), (_ttt_client_fini),
345 (_execute_request), (_handle_requests_thread): Implement QUIT. Add
346 client->registered flag and unregister only if registered. Change
347 from args_min and args_max to args_required.
350 * src/ttt-error.c: (ttt_error_string):
351 * src/ttt-server.c: (ttt_server_register_client): Put underscores
352 in TTT_ERRROR names for better readability.
354 2005-11-24 Carl Worth <cworth@cworth.org>
357 * src/ttt-server.c: (ttt_server_init),
358 (ttt_server_register_client): Remove unique-name generation from
359 the server. The client is going to have to have code to do this
362 * src/ttt-client.c: Change minimum arguments for HELO from 0 to 1.
364 * TODO: Note that HELO and ERROR INVALIDNAME are implemented in
367 2005-11-23 Richard D. Worth <richard@theworths.org>
369 * PROTOCOL: Remove unused servername
371 * src/ttt-client.h: * src/ttt-client.c:
372 (_ttt_client_execute_helo), (_ttt_client_init),
373 (_ttt_client_fini), (_execute_request), (ttt_client_get_name),
374 (ttt_client_set_name): Added command descriptions structure. Match
375 command case-insensitively, dispatch to execute
376 function. Implement HELO command. Register on HELO instead of on
379 * src/ttt-server.h: * src/ttt-server.c: (ttt_server_init),
380 (ttt_server_register_client), (ttt_server_unregister_client),
381 (ttt_server_get_host), (ttt_server_get_port), (main): Added host
382 and port to server. Make client registration name-based rather
385 * src/x.c: (xstrdup): Return NULL on NULL
387 * src/ttt-lex.h: Regenerated
389 2005-11-22 Carl Worth <cworth@cworth.org>
391 * TODO: Add TODO file listing all the stuff from the protocol that
392 needs to be implemented.
399 * src/ttt-token.h: Add support for a flex-based tokenizer which
400 tokenizes newlines and space-separated strings.
402 * src/ttt-client.c: (_ttt_client_init), (_ttt_client_fini),
403 (_append_to_request), (_free_request), (_read_request),
404 (_execute_request): Use new tokenizer to tokenize input into an
405 array of request strings.
407 2005-11-15 Carl Worth <cworth@cworth.org>
411 * src/ttt-error.c: (ttt_error_string): Add error values and error
412 strings from protocol.
414 * src/ttt.h: Add typedefs for ttt_client_t and ttt_server_t so
415 that there's no problem with ttt-client.h and ttt-server.h needing
416 to mutually include each other.
419 * src/ttt-server.c: (ttt_server_register_client),
420 (ttt_server_unregister_client), (_ttt_server_accept), (main): Push
421 the client request handling thread back down into ttt-client.c
422 where it really does belong. The server code no longer ever
423 reaches down inside the ttt_client_t structure. Export
424 ttt_server_register_client and ttt_server_unregister_client. Add
425 documentation for ttt_server_broadcast. Document locking semantics
426 for all functions which acquire the server lock.
429 * src/ttt-client.c: (_ttt_client_create), (_ttt_client_destroy),
430 (_read_into_request_until), (_read_request), (_execute_request),
431 (_handle_requests_thread), (ttt_client_new), (ttt_client_get_id):
432 Pull the ttt_client structure definition back down inside the
433 ttt-client.c file. Don't export ttt_client_create and
434 ttt_client_destroy anymore, but instead just use static
435 _ttt_client_init and _ttt_client_fini. Implement the broadcast by
436 just passing a client pointer around and using client->request
437 rather than passing char *request all over. Document new
438 ttt_client_new and remove ttt_client_read_line. Add locking to
439 ttt_client_send and document it. Add ttt_client_get_id.
441 2005-11-14 Carl Worth <cworth@cworth.org>
443 Server now acts as a very simple chat server.
446 * src/ttt-client.c: (ttt_client_create), (ttt_client_destroy),
447 (_append_to_request), (ttt_client_read_into_request_until),
448 (ttt_client_read_line), (ttt_client_send): Add support to do a
449 buffering read within the client and to reuse the buffer (which
450 grows by doubling) from one request to the next. Add function to
451 send a message to a client.
453 * src/ttt-server.c: (ttt_server_init), (ttt_server_create_client):
454 Add support for a client idea. Resize the server's client list by
456 * src/ttt-server.c: (ttt_server_destroy_client): Add support to
458 * src/ttt-server.c: (_handle_client_requests_thread),
459 (_accept_client): Move handling of client requests up to
460 ttt-server.c from ttt-client.c. Use threads rather than a fork per
463 * src/ttt-server.h: (ttt_server_broadcast): Add function to send a
464 message to all connected clients.
467 * src/ttt-socket.c: (ttt_socket_read),
468 (ttt_socket_write): Add functions to do blocking read or write of
469 the specified number of bytes.
471 * src/ttt-socket.c: (ttt_socket_accept): Remove fork, so that the
472 accept function call can take care of anything like that itself.
475 * src/x.c: (xread), (xwrite): New wrappers for read and write.
477 * src/ttt.h: Add TTT_STATUS_EOF, TRUE, and FALSE.
479 * src/ttt.c: Need to include ttt-args.h explicitly now.
481 2005-11-11 Carl Worth <cworth@cworth.org>
484 * src/ttt-server.c: (ttt_server_init), (ttt_server_add_client),
485 (_accept_client), (main): Add a new ttt_server_t object with a
486 mutex-protected list of clients. Move client handling code down
487 into new ttt-client.c.
490 * src/ttt-client.c: (ttt_client_create), (ttt_client_destroy),
491 (ttt_client_handle_requests): New ttt_client_t object that simply
492 holds a pointer back to the server as well as the client socket
496 * src/ttt-socket.c: (ttt_socket_accept): Add closure argument. Add
497 a call to fork before calling the accept callback.
499 * src/ttt-args.c: Hide unused ttt_args_usage from the compiler to
500 keep it from complaining.
502 * src/ttt.c: (main): Rename the client main program from
503 ttt-client to ttt.c, (since the server code now has its own
507 * src/Makefile.am: Include and link with pthread now that we have
508 pthread-based mutex locking.
510 2005-11-11 Carl Worth <cworth@pippin.local>
512 * src/ttt-server.c: (main): Don't assign to stderr which is
513 apparently an invalid lvalue on Mac OS X.
516 * src/x.c: (xfreopen): Change return type to void.
518 * src/ttt-board.c: (ttt_board_to_string): Add missing return
521 2005-11-11 Carl Worth <cworth@cworth.org>
523 * configure.in: Key off of src/ttt.h instead of src/ttt.c which no
526 2005-11-11 Carl Worth <cworth@cworth.org>
530 * src/x.h: Move include of stdarg.h from x.c to ttt.h.
532 2005-11-11 Carl Worth <cworth@cworth.org>
534 * src/ttt-board.h: Include ttt.h to get standard includes.
536 * src/ttt-socket.c: Replace include of netinet/ip.h with
537 netinet/in.h which seems to be necessary for BSD libc, (eg. Mac OS
540 2005-11-09 Carl Worth <cworth@cworth.org>
544 * src/ttt-server.c: (ttt_dispatch), (main):
546 * src/ttt-socket.c: (_sockaddr_init), (_wait_for_connection),
547 (ttt_socket_create_server), (ttt_socket_accept): Push a lot of
548 code out of ttt-server.c down into a new ttt_socket abstraction
549 layer. The code is much easier to read now. The server also no
550 longer exits when the first client exits, but continues to listen
551 for more connections.
553 2005-11-09 Carl Worth <cworth@cworth.org>
556 * src/ttt-args.c: (ttt_args_help), (ttt_args_parse): Add support
557 for -h,--host, -p,--port, and --log-file command-line arguments.
559 * src/ttt-server.c: (main): Use host, port, and log-file
560 command-line arguments.
562 * src/ttt-client.c: (main): Track change in signature of
566 * src/x.c: (xfdopen), (xfreopen): More wrappers.
568 2005-11-08 Carl Worth <cworth@cworth.org>
571 * src/ttt-server.c: (_sockaddr_init), (_wait_for_connection),
572 (main): Add socket, bind, listen, accept calls to provide a
573 simple, functional, one-shot server demonstration.
576 * src/x.c: (xsocket), (xbind), (xlisten), (xfcntl), (xselect): Add
577 more wrapped system calls.
579 2005-11-07 Carl Worth <cworth@cworth.org>
581 * src/ttt.h: Grab some useful definitions from wdo.h:
582 ASSERT_NOT_REACHEED and TTT_PRINTF_FORMAT. Add several needed
585 * src/Makefile.am: Rip out not-yet existing ttt-command and
588 * src/ttt-args.c: (ttt_args_parse): Track name change from
589 args_help to ttt_args_help.
591 * src/ttt.c: Remove in favor of ttt-server.c and ttt-client.c.
593 * src/x.h: Add prototype for xfwrite.
595 2005-11-05 Richard D. Worth <richard@theworths.org>
597 * src/ttt-board.c: (ttt_board_init): Added for loop counter init.
598 * src/ttt-board.h: Added prototypes.
600 2005-11-05 Richard D. Worth <richard@theworths.org>
602 * src/args.c: Renamed ttt-args.c
603 * src/args.h: Renamed ttt-args.h
604 * src/ttt-args.c: (ttt_args_help), (ttt_args_usage),
605 (ttt_args_parse): Added ttt_ prefix.
606 * src/ttt-args.h: Added ttt_, TTT_ prefix.
608 2005-11-05 Kevin Worth <kevin@cworth.org>
610 * src/ttt-board.c: (ttt_board_init): Implemented board_init.
611 * src/ttt-board.h: (ttt_board_t): Added cells array.
613 2005-11-05 Carl Worth <cworth@cworth.org>
615 * src/Makefile.am: Add ttt-board.[ch] and x.[ch]
618 * src/ttt-board.c: (ttt_board_init), (ttt_board_init_from_string),
619 (ttt_board_to_string), (ttt_board_write): Add some stub functions
620 for Richard and Kevin to have some practice
621 implementing. Functions to represent a board and to go to/from a
625 * src/x.c: (xasprintf), (xvasprintf), (xpipe), (xfork), (xmalloc),
626 (xcalloc), (xrealloc), (xfdopen), (xstrdup), (xfwrite): Several
627 utility functions that make system calls, check the result, and
628 exit on any error. This will simplify the error checking needed in
629 programs using these functions.
631 2005-11-05 Carl Worth <cworth@cworth.org>
633 * src/Makefile.am: Break things up for separate ttt-client and
634 ttt-server and programs.