summary |
shortlog | log |
commit |
commitdiff |
tree
first ⋅ prev ⋅ next
Carl Worth [Sat, 14 Jan 2006 17:18:14 +0000 (17:18 +0000)]
2006-01-14 Carl Worth <cworth@cworth.org>
* src/test-board.c (main): Remove bogus line of code which didn't
compile.
Carl Worth [Sat, 14 Jan 2006 17:11:34 +0000 (17:11 +0000)]
2006-01-14 Carl Worth <cworth@cworth.org>
* Makefile.am:
* configure.in:
* kub/Makefile.am: Add kub directory to build system.
* src/ttt-board.c: (ttt_board_is_won): Fix whitespace.
Kevin Worth [Sat, 14 Jan 2006 17:01:24 +0000 (17:01 +0000)]
Add kub program
Kevin Worth [Fri, 16 Dec 2005 01:27:15 +0000 (01:27 +0000)]
Prevented random memory corruption and other cleanup
Kevin Worth [Thu, 15 Dec 2005 07:07:46 +0000 (07:07 +0000)]
Kevin learning C maintenance
Kevin Worth [Thu, 15 Dec 2005 06:49:52 +0000 (06:49 +0000)]
Implemented Cat's Game
Kevin Worth [Thu, 15 Dec 2005 05:59:23 +0000 (05:59 +0000)]
General Maintenance
Carl Worth [Thu, 15 Dec 2005 05:48:54 +0000 (05:48 +0000)]
2005-12-14 Carl Worth <cworth@cworth.org>
* src/ttt-server.h: Update the documentation of these functions to
be more precise about what happens to client mutexes.
* src/ttt-board.c: (ttt_board_is_won): And some white space to
make things more readable.
Carl Worth [Thu, 15 Dec 2005 05:48:11 +0000 (05:48 +0000)]
2005-12-14 Carl Worth <cworth@cworth.org>
* src/ttt-server.h: Update the documentation of these functions to
be more precise about what happens to client mutexes.
* src/ttt-board.c: (ttt_board_is_won): And some white space to
make things more readable.
Kevin Worth [Thu, 15 Dec 2005 03:01:24 +0000 (03:01 +0000)]
Beautified _board_is_won and test_board.c now quits out when won
Kevin Worth [Wed, 14 Dec 2005 05:09:45 +0000 (05:09 +0000)]
A _working_ draft of ttt_board_is_won
Kevin Worth [Wed, 14 Dec 2005 04:57:25 +0000 (04:57 +0000)]
Second draft attempt at ttt_board_is_won
Bryan Worth [Wed, 14 Dec 2005 04:26:47 +0000 (04:26 +0000)]
2005-12-13 Bryan Worth <bryan@theworths.org>
* src/ttt-curses-client: Cleaned up text-entry code. Added support
for HOME, END, DELETE, and ARROW keys
Kevin Worth [Tue, 13 Dec 2005 22:55:10 +0000 (22:55 +0000)]
Corrected typos in ttt_board_is_won
Kevin Worth [Tue, 13 Dec 2005 22:38:58 +0000 (22:38 +0000)]
First draft attempt at ttt_board_is_won
Kevin Worth [Tue, 13 Dec 2005 20:40:23 +0000 (20:40 +0000)]
Fixed board_make_move to use TTT_CELL_EMPTY
Carl Worth [Tue, 13 Dec 2005 20:26:34 +0000 (20:26 +0000)]
2005-12-13 Carl Worth <cworth@cworth.org>
* TODO: Note that ttt-server should retry a couple times if its
port is not available.
* src/test-board.c: (main): Remove debug print messages.
* src/ttt-board.c: (ttt_board_make_move): Tighten up the code just
a little bit more.
Kevin Worth [Tue, 13 Dec 2005 19:46:59 +0000 (19:46 +0000)]
Implemented current_player into board and O's into board_make_move
Kevin Worth [Tue, 13 Dec 2005 00:29:39 +0000 (00:29 +0000)]
Fixed signature of ttt_board_make_move to fit protocol with errors
Kevin Worth [Mon, 12 Dec 2005 21:09:22 +0000 (21:09 +0000)]
Deleted debugging code and changed return errors to fit protocol
Kevin Worth [Mon, 12 Dec 2005 20:42:56 +0000 (20:42 +0000)]
Looped test-board.c to play a full board of X's
Richard Worth [Sat, 10 Dec 2005 13:43:07 +0000 (13:43 +0000)]
2005-12-10 Richard D. Worth <richard@theworths.org>
* TODO: check off INVITE, RETRACT, DECLINE, Game Invitation
notices, Connection setup errors, NO_INVITE, User information
errors.
* src/ttt-client.c: (_ttt_client_execute_helo),
(_ttt_client_execute_statistics), (_ttt_client_execute_message),
(_ttt_client_execute_help), (_ttt_client_execute_version),
(_ttt_client_execute_quit), (_ttt_client_execute_invite),
(_ttt_client_execute_accept), (_ttt_client_execute_retract),
(_ttt_client_execute_decline), (_read_request),
(_execute_request),
(_handle_requests_thread): Whitespace changes. Use exported get
methods (get_username, get_num_wins). Use strcasecmp in place of
toupper. Finish RETRACT, DECLINE.
* src/ttt.h:
* src/ttt-server.h:
* src/ttt-server.c: (ttt_server_init),
(ttt_server_register_client), (ttt_server_unregister_client),
(ttt_server_verify_username),
(ttt_server_get_client_from_username), (ttt_server_add_invite),
(ttt_server_remove_invite): Add invite struct. Make username case
insensitive (missed in register_client). Implement add_invite,
remove_invite. Moved statistics to ttt-client.c
Carl Worth [Fri, 9 Dec 2005 17:25:11 +0000 (17:25 +0000)]
2005-12-09 Carl Worth <cworth@cworth.org>
* src/ttt-server.c (ttt_server_unregister_client): Move client has
left message to stderr so it makes it to the log file too.
Carl Worth [Fri, 9 Dec 2005 17:19:58 +0000 (17:19 +0000)]
2005-12-09 Carl Worth <cworth@cworth.org>
* src/ttt-server.c (main): Put the initial server started message
in the log file as well.
Carl Worth [Fri, 9 Dec 2005 17:10:08 +0000 (17:10 +0000)]
2005-12-09 Carl Worth <cworth@cworth.org>
* src/ttt-args.h:
* src/ttt-args.c: (ttt_args_help), (ttt_args_parse): Add a -u,
--user option for controlling the uid under which the server
process runs.
* src/ttt.h:
* src/ttt-server.c: (ttt_server_register_client), (main): Recert
the dup of stdout which wasn't working. Instead just print client
join information on stderr so that it goes into the log. Implement
support for the user option by calling setuid to drop root
privileges the process might start out with.
Bryan Worth [Fri, 9 Dec 2005 16:43:53 +0000 (16:43 +0000)]
2005-12-09 Bryan Worth <bryan@theworths.org>
* src/ttt-curses-client.c: added error checking to ttt_create_client
call. Added ability to escape server commands by prepending with /.
Added ability so override port number with port=xxxx entry in
~/.ttt/client.conf.
Kevin Worth [Fri, 9 Dec 2005 06:57:34 +0000 (06:57 +0000)]
Moved ttt_board_make_move to ttt-board.c with comment added and prototype in ttt-board.h
Kevin Worth [Fri, 9 Dec 2005 06:32:58 +0000 (06:32 +0000)]
Fixed board print bug
Kevin Worth [Fri, 9 Dec 2005 05:51:26 +0000 (05:51 +0000)]
Added ttt_board_make_move
Carl Worth [Thu, 8 Dec 2005 23:49:40 +0000 (23:49 +0000)]
2005-12-08 Carl Worth <cworth@cworth.org>
* src/ttt-server.c (main): When detached dup stdout to stderr so
that everything appears in the log file.
Carl Worth [Thu, 8 Dec 2005 23:42:28 +0000 (23:42 +0000)]
2005-12-08 Carl Worth <cworth@cworth.org>
* src/ttt-args.h:
* src/ttt-args.c: (ttt_args_help), (ttt_args_parse): Add
-d,--detach and --pid-file=FILE options for running the server as
a daemon.
* src/ttt-server.c: (ttt_server_statistics),
(ttt_server_verify_username), (_detach_and_write_child_pid_to),
(main): Add support for detaching and writing out the child PID to
a file.
* src/x.h:
* src/x.c: (xfopen), (xdup2): Two new x-functions.
Bryan Worth [Thu, 8 Dec 2005 21:13:44 +0000 (21:13 +0000)]
* src/ttt-curses-client.c Fixed backspace implementation
Bryan Worth [Thu, 8 Dec 2005 20:34:02 +0000 (20:34 +0000)]
2005-12-08 Bryan Worth <bryan@theworths.org>
* src/ttt-curses-client.c: Multiple improvements!
Username taken from USER environment variable and stored as
preference in ~/.ttt/client.conf (username=xxxxxx). Backspace
should now work correctly with all term types. Status messages
display in seperate area. MESSAGE reply from server is
suppressed. Eliminated most global variables.
Carl Worth [Thu, 8 Dec 2005 14:49:54 +0000 (14:49 +0000)]
Ignore ttt-lex.h
Carl Worth [Thu, 8 Dec 2005 14:48:50 +0000 (14:48 +0000)]
2005-12-08 Carl Worth <cworth@cworth.org>
* src/Makefile.am: Fix rule to auto-generate ttt-lex.h.
* src/ttt-lex.h: Remove generated file from revision control.
* src/ttt-lex.l: Add copyright/license blurb.
* src/ttt-lex.l:
* src/ttt-client.c: (yy_init_globals), (use_yy_init_globals):
Shut off some annoying compiler warnings due to flex bugs (only
one still remains).
Carl Worth [Thu, 8 Dec 2005 13:55:48 +0000 (13:55 +0000)]
Ignore ttt-curses-client
Richard Worth [Wed, 7 Dec 2005 12:48:54 +0000 (12:48 +0000)]
2005-12-07 Richard D. Worth <richard@theworths.org>
* PROTOCOL: Remove unused error NOT_IN_GAME. Add error
NOT_VALID_MOVE.
* TODO: Add error NOT_VALID_MOVE.
* src/ttt-error.h:
* src/ttt-error.c: (ttt_error_string): Add section comments. Add
error NOT_VALID_MOVE.
Bryan Worth [Tue, 6 Dec 2005 19:05:22 +0000 (19:05 +0000)]
2005-12-06 Bryan Worth <bryan@theworths.org>
* src/ttt-error.c: fixed missing errors (NO_INVITE, NO_GAME)
Richard Worth [Tue, 6 Dec 2005 15:27:01 +0000 (15:27 +0000)]
2005-12-06 Richard D. Worth <richard@theworths.org>
* PROTOCOL: Add error NO_INVITE
* TODO: Uncheck INVITE, ACCEPT
* src/ttt-error.c: (ttt_error_string): Add errors NO_INVITE,
NO_GAME
* src/ttt-client.c: (_ttt_client_execute_message),
(_ttt_client_execute_help), (_ttt_client_execute_version),
(_ttt_client_execute_invite), (_ttt_client_execute_accept),
(_ttt_client_execute_retract), (_ttt_client_execute_decline):
Whitespace changes. Partially implement RETRACT, DECLINE.
Richard Worth [Tue, 6 Dec 2005 02:50:42 +0000 (02:50 +0000)]
2005-12-05 Richard D. Worth <richard@theworths.org>
* PROTOCOL: Fill some missing possible error occurrences.
* TODO: Check off INVITE, ACCEPT, ERROR COMMAND, ERROR NO_USER
* src/ttt-server.h:
* src/ttt-server.c: (ttt_server_verify_username):
* src/ttt-client.c: (_ttt_client_execute_help),
(_ttt_client_execute_invite), (_ttt_client_execute_accept):
Implement INVITE, ACCEPT
Richard Worth [Mon, 5 Dec 2005 14:16:41 +0000 (14:16 +0000)]
2005-12-05 Richard D. Worth <richard@theworths.org>
* src/ttt-curses-client.c: (mvprintstr), (mvwprintstr), (wprint),
(main), (finish): Whitespace changes.
Bryan Worth [Mon, 5 Dec 2005 12:34:13 +0000 (12:34 +0000)]
2005-12-04 Bryan Worth <bryan@theworths.org>
* src/ttt-socket.c: (ttt_socket_create_client) fixed socket to be
non-blocking. (ttt_socket_read) added return value for number
of bytes read
* Makefile.am: added necessary code for new curses-client program.
* src/ttt-curses-client: new ncurses based client
Richard Worth [Sun, 4 Dec 2005 03:02:03 +0000 (03:02 +0000)]
2005-12-03 Richard D. Worth <richard@theworths.org>
* PROTOCOL: Add RETRACT, DECLINE. Add game identifier for all game
commands.
* TODO: Add RETRACT, DECLINE, notices.
Richard Worth [Sat, 3 Dec 2005 05:36:42 +0000 (05:36 +0000)]
2005-12-03 Richard D. Worth <richard@theworths.org>
* PROTOCOL: Add underscores to error codes. Add STATISTICS
command. Remove statistics from WHO.
* TODO: Add STATISTICS. Check off STATISTICS.
* src/ttt.h: Define TTT_SERVER_PROTOCOL_VERSION for VERSION.
* src/ttt-error.c: (ttt_error_string): Add underscores to error
codes.
* src/ttt-client.h:
* src/ttt-client.c: (_ttt_client_execute_helo),
(_ttt_client_execute_statistics), (_ttt_client_execute_message),
(_ttt_client_execute_version), (_ttt_client_execute_quit),
(_ttt_client_init), (_ttt_client_fini), (ttt_client_get_username),
(ttt_client_set_username): Rename client->name to
client->username. Implement STATISTICS. Complete implementation of
VERSION.
* src/ttt-server.h:
* src/ttt-server.c: (ttt_server_register_client),
(ttt_server_unregister_client), (ttt_server_who),
(ttt_server_statistics): Track rename of client->name to
client->username. Add server helper for STATISTICS.
Richard Worth [Fri, 2 Dec 2005 13:20:42 +0000 (13:20 +0000)]
2005-12-02 Richard D. Worth <richard@theworths.org>
* TODO: Check off Global commands, HELP, VERSION.
* src/ttt-client.c: (_ttt_client_execute_message),
(_ttt_client_execute_help), (_execute_request): Whitespace
changes. Implement HELP with usage and short description.
* src/ttt-server.c: Update the server welcome message.
Richard Worth [Fri, 2 Dec 2005 01:38:34 +0000 (01:38 +0000)]
2005-12-01 Richard D. Worth <richard@theworths.org>
* TODO: Check off NOTICE MESSAGE, ERROR NONAMESET.
* PROTOCOL: Add NONAMESET error in possible errors where
applicable. Add description for MESSAGE.
* src/ttt-token.h: Add token typedef. Rename token type enum.
* src/ttt-lex.l: Add support for quoted string as single token.
* src/ttt-lex.h: Autogenerated.
* src/ttt-client.c: (_ttt_client_execute_helo),
(_ttt_client_execute_who), (_ttt_client_execute_message),
(_ttt_client_execute_help), (_ttt_client_execute_version),
(_ttt_client_execute_quit), (_ttt_client_init), (_read_request),
(_execute_request): Whitespace changes. Implement VERSION,
HELP. Change args_required back to args_min and args_max (see
PROTOCOL\HELP). Modify MESSAGE to accept one token arg and quote
output. Return NONAMESET error where applicable.
Carl Worth [Tue, 29 Nov 2005 13:44:54 +0000 (13:44 +0000)]
2005-11-29 Carl Worth <cworth@cworth.org>
* src/ttt-socket.h:
* src/ttt-socket.c: (ttt_socket_create_client): New function for
creating a client socket.
* src/x.h:
* src/x.c: (xconnect): Add xconnect. Return a couple of useful
error status values so that callers can recover on connection
refused or host unreachable.
* src/ttt.h: Add TTT_STATUS_CONNECTION_REFUSED and
TTT_STATUS_NETWORK_UNREACHABLE.
Kevin Worth [Mon, 28 Nov 2005 18:51:44 +0000 (18:51 +0000)]
2005-11-28 Kevin Worth <kevin@theworths.org>
* PROTOCOL: Changed board cell numbering to start with zero
instead of one.
* src/Makefile.am:
* src/test-board.c: (main): Added new file for testing.
* src/ttt-board.c: (ttt_board_init), (ttt_board_to_string):
* src/ttt-board.h: Implemented board_to_string.
Kevin Worth [Mon, 28 Nov 2005 17:48:06 +0000 (17:48 +0000)]
2005-11-28 kevin worth <kevin@theworths.org>
* src/ttt-board.c:
* src/ttt-board.h: Moved struct def from ttt-board.h into
ttt-board.c to make it private
* src/ttt-lex.h:
Autogenerated
Carl Worth [Mon, 28 Nov 2005 17:08:47 +0000 (17:08 +0000)]
2005-11-28 Carl Worth <cworth@cworth.org>
* TODO: Add instructions on using the first letter of our names to
indicate we are working on something.
Bryan Worth [Fri, 25 Nov 2005 20:18:28 +0000 (20:18 +0000)]
2005-11-25 Bryan Worth <bryan@theworths.org>
* ttt-client.c, ttt-server.c, ttt-error.c changed line breaks to
<crlf> (\r\n) for network compatibility
Bryan Worth [Fri, 25 Nov 2005 18:04:24 +0000 (18:04 +0000)]
2005-11-25 Bryan Worth <bryan@theworths.org>
* TODO: checked off NOTICE USER and NOTICE QUIT
*src/ttt-client.c: (_ttt_client_execute_helo): implement NOTICE USER
*(_ttt_client_execute_quit): implement NOTICE QUIT
Bryan Worth [Fri, 25 Nov 2005 16:12:11 +0000 (16:12 +0000)]
2005-11-25 Bryan Worth <bryan@theworths.org>
* TODO: checked off MESSAGE
*src/ttt-client.c: (_ttt_client_execute_message): Implement MESSAGE
*(_execute_request): changed arg_required to behave as a minimum
instead of an absolute number to allow optional arguments such as
multi-word messages
Richard Worth [Fri, 25 Nov 2005 14:33:10 +0000 (14:33 +0000)]
* TODO: checked off WHO, QUIT, ERROR SYNTAX
* src/ttt-client.c: (_ttt_client_execute_helo), (_ttt_client_init),
(ttt_client_get_num_wins):
* src/ttt-client.h:
* src/ttt-server.c: (ttt_server_who): Whitespace changes. Add
missing player win count for WHO.
Richard Worth [Thu, 24 Nov 2005 16:42:21 +0000 (16:42 +0000)]
* AUTHORS: Add Richard D. Worth
* TODO: Add newline before EOF
* src/ttt-client.c: (_ttt_client_execute_who):
* src/ttt-server.h:
* src/ttt-server.c: (ttt_server_who): Implement WHO.
Carl Worth [Thu, 24 Nov 2005 16:18:18 +0000 (16:18 +0000)]
2005-11-24 Carl Worth <cworth@cworth.org>
* PROTOCOL: Document QUIT.
* src/ttt-client.c: (_ttt_client_execute_helo),
(_ttt_client_execute_quit), (_ttt_client_init), (_ttt_client_fini),
(_execute_request), (_handle_requests_thread): Implement QUIT. Add
client->registered flag and unregister only if registered. Change
from args_min and args_max to args_required.
* src/ttt-error.h:
* src/ttt-error.c: (ttt_error_string):
* src/ttt-server.c: (ttt_server_register_client): Put underscores
in TTT_ERRROR names for better readability.
Carl Worth [Thu, 24 Nov 2005 15:34:08 +0000 (15:34 +0000)]
2005-11-24 Carl Worth <cworth@cworth.org>
* PROTOCOL:
* src/ttt-server.c: (ttt_server_init),
(ttt_server_register_client): Remove unique-name generation from
the server. The client is going to have to have code to do this
anyway.
* src/ttt-client.c: Change minimum arguments for HELO from 0 to 1.
* TODO: Note that HELO and ERROR INVALIDNAME are implemented in
the server.
Richard Worth [Thu, 24 Nov 2005 15:23:02 +0000 (15:23 +0000)]
* Missing files from rev235
Richard Worth [Wed, 23 Nov 2005 22:11:28 +0000 (22:11 +0000)]
* PROTOCOL: Removed unused servername
* src/ttt-client.h: * src/ttt-client.c:
(_ttt_client_execute_helo), (_ttt_client_init),
(_ttt_client_fini), (_execute_request), (ttt_client_get_name),
(ttt_client_set_name): Added command descriptions structure. Match
command case-insensitively, dispatch to execute
function. Implement HELO command. Register on HELO instead of on
connect.
* src/ttt-server.h: * src/ttt-server.c: (ttt_server_init),
(ttt_server_register_client), (ttt_server_unregister_client),
(ttt_server_get_host), (ttt_server_get_port), (main): Added host
and port to server. Make client registration name-based rather
than id-based.
* src/x.c: (xstrdup): Return NULL on NULL
* src/ttt-lex.h: Regenerated
Carl Worth [Tue, 22 Nov 2005 23:54:09 +0000 (23:54 +0000)]
2005-11-22 Carl Worth <cworth@cworth.org>
* TODO: Add TODO file listing all the stuff from the protocol that
needs to be implemented.
* src/Makefile.am:
* configure.in:
* ylwrap:
* src/ttt-lex.h:
* src/ttt-lex.l:
* src/ttt-token.h: Add support for a flex-based tokenizer which
tokenizes newlines and space-separated strings.
* src/ttt-client.c: (_ttt_client_init), (_ttt_client_fini),
(_append_to_request), (_free_request), (_read_request),
(_execute_request): Use new tokenizer to tokenize input into an
array of request strings.
Carl Worth [Tue, 15 Nov 2005 17:56:28 +0000 (17:56 +0000)]
2005-11-15 Carl Worth <cworth@cworth.org>
* src/Makefile.am:
* src/ttt-error.h:
* src/ttt-error.c: (ttt_error_string): Add error values and error
strings from protocol.
* src/ttt.h: Add typedefs for ttt_client_t and ttt_server_t so
that there's no problem with ttt-client.h and ttt-server.h needing
to mutually include each other.
* src/ttt-server.h:
* src/ttt-server.c: (ttt_server_register_client),
(ttt_server_unregister_client), (_ttt_server_accept), (main): Push
the client request handling thread back down into ttt-client.c
where it really does belong. The server code no longer ever
reaches down inside the ttt_client_t structure. Export
ttt_server_register_client and ttt_server_unregister_client. Add
documentation for ttt_server_broadcast. Document locking semantics
for all functions which acquire the server lock.
* src/ttt-client.h:
* src/ttt-client.c: (_ttt_client_create), (_ttt_client_destroy),
(_read_into_request_until), (_read_request), (_execute_request),
(_handle_requests_thread), (ttt_client_new), (ttt_client_get_id):
Pull the ttt_client structure definition back down inside the
ttt-client.c file. Don't export ttt_client_create and
ttt_client_destroy anymore, but instead just use static
_ttt_client_init and _ttt_client_fini. Implement the broadcast by
just passing a client pointer around and using client->request
rather than passing char *request all over. Document new
ttt_client_new and remove ttt_client_read_line. Add locking to
ttt_client_send and document it. Add ttt_client_get_id.
Carl Worth [Mon, 14 Nov 2005 21:14:52 +0000 (21:14 +0000)]
2005-11-14 Carl Worth <cworth@cworth.org>
Server now acts as a very simple chat server.
* src/ttt-client.h:
* src/ttt-client.c: (ttt_client_create), (ttt_client_destroy),
(_append_to_request), (ttt_client_read_into_request_until),
(ttt_client_read_line), (ttt_client_send): Add support to do a
buffering read within the client and to reuse the buffer (which
grows by doubling) from one request to the next. Add function to
send a message to a client.
* src/ttt-server.c: (ttt_server_init), (ttt_server_create_client):
Add support for a client idea. Resize the server's client list by
doubling.
* src/ttt-server.c: (ttt_server_destroy_client): Add support to
destroy a client.
* src/ttt-server.c: (_handle_client_requests_thread),
(_accept_client): Move handling of client requests up to
ttt-server.c from ttt-client.c. Use threads rather than a fork per
client.
* src/ttt-server.h:
* src/ttt-server.h: (ttt_server_broadcast): Add function to send a
message to all connected clients.
* src/ttt-socket.h:
* src/ttt-socket.c: (ttt_socket_read),
(ttt_socket_write): Add functions to do blocking read or write of
the specified number of bytes.
* src/ttt-socket.c: (ttt_socket_accept): Remove fork, so that the
accept function call can take care of anything like that itself.
* src/x.h:
* src/x.c: (xread), (xwrite): New wrappers for read and write.
* src/ttt.h: Add TTT_STATUS_EOF, TRUE, and FALSE.
* src/ttt.c: Need to include ttt-args.h explicitly now.
Carl Worth [Sat, 12 Nov 2005 01:21:21 +0000 (01:21 +0000)]
2005-11-11 Carl Worth <cworth@cworth.org>
* src/ttt-server.h:
* src/ttt-server.c: (ttt_server_init), (ttt_server_add_client),
(_accept_client), (main): Add a new ttt_server_t object with a
mutex-protected list of clients. Move client handling code down
into new ttt-client.c.
* src/ttt-client.h:
* src/ttt-client.c: (ttt_client_create), (ttt_client_destroy),
(ttt_client_handle_requests): New ttt_client_t object that simply
holds a pointer back to the server as well as the client socket
file descriptor.
* src/ttt-socket.h:
* src/ttt-socket.c: (ttt_socket_accept): Add closure argument. Add
a call to fork before calling the accept callback.
* src/ttt-args.c: Hide unused ttt_args_usage from the compiler to
keep it from complaining.
* src/ttt.c: (main): Rename the client main program from
ttt-client to ttt.c, (since the server code now has its own
ttt-client.c).
* src/ttt.h:
* src/Makefile.am: Include and link with pthread now that we have
pthread-based mutex locking.
Carl Worth [Fri, 11 Nov 2005 21:13:59 +0000 (21:13 +0000)]
2005-11-11 Carl Worth <cworth@pippin.local>
* src/ttt-server.c: (main): Don't assign to stderr which is
apparently an invalid lvalue on Mac OS X.
* src/x.h:
* src/x.c: (xfreopen): Change return type to void.
* src/ttt-board.c: (ttt_board_to_string): Add missing return
statement.
Carl Worth [Fri, 11 Nov 2005 21:04:03 +0000 (21:04 +0000)]
2005-11-11 Carl Worth <cworth@cworth.org>
* configure.in: Key off of src/ttt.h instead of src/ttt.c which no
longer exists.
Carl Worth [Fri, 11 Nov 2005 20:47:35 +0000 (20:47 +0000)]
2005-11-11 Carl Worth <cworth@cworth.org>
* src/ttt.h:
* src/x.c:
* src/x.h: Move include of stdarg.h from x.c to ttt.h.
Carl Worth [Fri, 11 Nov 2005 20:45:39 +0000 (20:45 +0000)]
2005-11-11 Carl Worth <cworth@cworth.org>
* src/ttt-board.h: Include ttt.h to get standard includes.
* src/ttt-socket.c: Replace include of netinet/ip.h with
netinet/in.h which seems to be necessary for BSD libc, (eg. Mac OS
X).
Carl Worth [Wed, 9 Nov 2005 14:37:16 +0000 (14:37 +0000)]
2005-11-09 Carl Worth <cworth@cworth.org>
* src/Makefile.am:
* src/ttt.h:
* src/ttt-server.c: (ttt_dispatch), (main):
* src/ttt-socket.h:
* src/ttt-socket.c: (_sockaddr_init), (_wait_for_connection),
(ttt_socket_create_server), (ttt_socket_accept): Push a lot of
code out of ttt-server.c down into a new ttt_socket abstraction
layer. The code is much easier to read now. The server also no
longer exits when the first client exits, but continues to listen
for more connections.
Carl Worth [Wed, 9 Nov 2005 13:57:33 +0000 (13:57 +0000)]
2005-11-09 Carl Worth <cworth@cworth.org>
* src/ttt-args.h:
* src/ttt-args.c: (ttt_args_help), (ttt_args_parse): Add support
for -h,--host, -p,--port, and --log-file command-line arguments.
* src/ttt-server.c: (main): Use host, port, and log-file
command-line arguments.
* src/ttt-client.c: (main): Track change in signature of
ttt_args_parse.
* src/x.h:
* src/x.c: (xfdopen), (xfreopen): More wrappers.
Carl Worth [Tue, 8 Nov 2005 18:03:08 +0000 (18:03 +0000)]
2005-11-08 Carl Worth <cworth@cworth.org>
* src/ttt.h:
* src/ttt-server.c: (_sockaddr_init), (_wait_for_connection),
(main): Add socket, bind, listen, accept calls to provide a
simple, functional, one-shot server demonstration.
* src/x.h:
* src/x.c: (xsocket), (xbind), (xlisten), (xfcntl), (xselect): Add
more wrapped system calls.
Carl Worth [Tue, 8 Nov 2005 00:44:57 +0000 (00:44 +0000)]
2005-11-07 Carl Worth <cworth@cworth.org>
* src/ttt.h: Grab some useful definitions from wdo.h:
ASSERT_NOT_REACHEED and TTT_PRINTF_FORMAT. Add several needed
include directives.
* src/Makefile.am: Rip out not-yet existing ttt-command and
ttt-error.
* src/ttt-args.c: (ttt_args_parse): Track name change from
args_help to ttt_args_help.
* src/ttt.c: Remove in favor of ttt-server.c and ttt-client.c.
* src/x.h: Add prototype for xfwrite.
Richard Worth [Sat, 5 Nov 2005 22:41:03 +0000 (22:41 +0000)]
* src/ttt-board.c: (ttt_board_init): Added for loop counter init.
* src/ttt-board.h: Added prototypes.
Richard Worth [Sat, 5 Nov 2005 20:25:11 +0000 (20:25 +0000)]
* src/args.c: Renamed ttt-args.c
* src/args.h: Renamed ttt-args.h
* src/ttt-args.c: (ttt_args_help), (ttt_args_usage),
(ttt_args_parse): Added ttt_ prefix.
* src/ttt-args.h: Added ttt_, TTT_ prefix.
Kevin Worth [Sat, 5 Nov 2005 19:53:18 +0000 (19:53 +0000)]
* /games/tictactoe/src/ttt-board.c, ttt-board.h: Implemented board_init
Carl Worth [Sat, 5 Nov 2005 16:43:21 +0000 (16:43 +0000)]
2005-11-05 Carl Worth <cworth@cworth.org>
* src/Makefile.am: Add ttt-board.[ch] and x.[ch]
* src/ttt-board.h:
* src/ttt-board.c: (ttt_board_init), (ttt_board_init_from_string),
(ttt_board_to_string), (ttt_board_write): Add some stub functions
for Richard and Kevin to have some practice
implementing. Functions to represent a board and to go to/from a
string.
* src/x.h:
* src/x.c: (xasprintf), (xvasprintf), (xpipe), (xfork), (xmalloc),
(xcalloc), (xrealloc), (xfdopen), (xstrdup), (xfwrite): Several
utility functions that make system calls, check the result, and
exit on any error. This will simplify the error checking needed in
programs using these functions.
Carl Worth [Sat, 5 Nov 2005 16:17:32 +0000 (16:17 +0000)]
2005-11-05 Carl Worth <cworth@cworth.org>
* src/Makefile.am: Break things up for separate ttt-client and
ttt-server and programs.
Carl Worth [Sat, 5 Nov 2005 16:08:18 +0000 (16:08 +0000)]
Add svn:ignore properties
Carl Worth [Sat, 5 Nov 2005 16:03:47 +0000 (16:03 +0000)]
Add template files
Carl Worth [Sat, 5 Nov 2005 15:45:28 +0000 (15:45 +0000)]
Minor fixes
Carl Worth [Sat, 5 Nov 2005 15:41:55 +0000 (15:41 +0000)]
Quick pass to make it more like tic-tac-toe --- far from complete.
Carl Worth [Sat, 5 Nov 2005 14:57:56 +0000 (14:57 +0000)]
Commit RRGP protocol document as a starting point.
Richard Worth [Sat, 5 Nov 2005 14:10:24 +0000 (14:10 +0000)]
* /games/tictactoe: New folders