]> git.cworth.org Git - ttt/commitdiff
2005-11-07 Carl Worth <cworth@cworth.org>
authorCarl Worth <carl@theworths.org>
Tue, 8 Nov 2005 00:44:57 +0000 (00:44 +0000)
committerCarl Worth <carl@theworths.org>
Tue, 8 Nov 2005 00:44:57 +0000 (00:44 +0000)
        * 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.

ChangeLog
src/Makefile.am
src/ttt-args.c
src/ttt-client.c [new file with mode: 0644]
src/ttt-server.c [new file with mode: 0644]
src/ttt.c [deleted file]
src/ttt.h
src/x.h

index e7d6dd684dcb0fbb2c56ebf977b39b60b4b3a7fc..08b40e2e579d807f81be9e5f4da27a4855afd89e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+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.
+
 2005-11-05  Richard D. Worth  <richard@theworths.org>
 
        * src/ttt-board.c: (ttt_board_init): Added for loop counter init.
 2005-11-05  Richard D. Worth  <richard@theworths.org>
 
        * src/ttt-board.c: (ttt_board_init): Added for loop counter init.
index 2e7ae737fdbe35e2fc2e64c19bca5d1883358b1b..4c3bd16aaa4e8100b2f6baa6a457e8a46bcfd87e 100644 (file)
@@ -5,10 +5,6 @@ ttt_common_sources =           \
        ttt-args.h              \
        ttt-board.c             \
        ttt-board.h             \
        ttt-args.h              \
        ttt-board.c             \
        ttt-board.h             \
-       ttt-command.c           \
-       ttt-command.h           \
-       ttt-error.c             \
-       ttt-error.h             \
        x.c                     \
        x.h
 
        x.c                     \
        x.h
 
index 302e3011de717c6ffd14876cde366f63e8e3a73e..2e4720594e6dee1c575f85c497d4afd0ee748735 100644 (file)
@@ -106,12 +106,12 @@ ttt_args_parse(ttt_args_t *args, int argc, char *argv[], int *args_first)
            break;
 
        case 'h':
            break;
 
        case 'h':
-           args_help (argv0);
+           ttt_args_help (argv0);
            exit (0);
            break;
 
        case '?':
            exit (0);
            break;
 
        case '?':
-           args_help (argv0);
+           ttt_args_help (argv0);
            exit (1);
            break;
 
            exit (1);
            break;
 
@@ -125,7 +125,7 @@ ttt_args_parse(ttt_args_t *args, int argc, char *argv[], int *args_first)
     if (argc - optind == 1) {
        args->file = argv[optind];
     } else {
     if (argc - optind == 1) {
        args->file = argv[optind];
     } else {
-       args_usage (argv0);
+        ttt_args_usage (argv0);
     }
     */
 
     }
     */
 
diff --git a/src/ttt-client.c b/src/ttt-client.c
new file mode 100644 (file)
index 0000000..b42db7a
--- /dev/null
@@ -0,0 +1,35 @@
+/* ttt.c - client-server tic-tac-toe game
+ *
+ * Copyright © 2005 Carl Worth
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Author: Carl Worth <cworth@cworth.org>
+ */
+
+#include "ttt.h"
+
+int 
+main (int argc, char **argv)
+{
+    ttt_args_t args;
+    int args_first;
+
+    ttt_args_parse (&args, argc, argv, &args_first);
+
+    /* XXX: insert code here */
+
+    return 0;
+}
diff --git a/src/ttt-server.c b/src/ttt-server.c
new file mode 100644 (file)
index 0000000..b42db7a
--- /dev/null
@@ -0,0 +1,35 @@
+/* ttt.c - client-server tic-tac-toe game
+ *
+ * Copyright © 2005 Carl Worth
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Author: Carl Worth <cworth@cworth.org>
+ */
+
+#include "ttt.h"
+
+int 
+main (int argc, char **argv)
+{
+    ttt_args_t args;
+    int args_first;
+
+    ttt_args_parse (&args, argc, argv, &args_first);
+
+    /* XXX: insert code here */
+
+    return 0;
+}
diff --git a/src/ttt.c b/src/ttt.c
deleted file mode 100644 (file)
index b5ec1d5..0000000
--- a/src/ttt.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* ttt.c - client-server tic-tac-toe game
- *
- * Copyright © 2005 Carl Worth
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Author: Carl Worth <cworth@cworth.org>
- */
-
-#include "ttt.h"
-
-int 
-main (int argc, char **argv)
-{
-    args_t args;
-    int args_first;
-
-    args_parse (&args, argc, argv, &args_first);
-
-    /* XXX: insert code here */
-
-    return 0;
-}
index 910c6883c78ad2473c74dd10405742900224a9d5..0f2f7e55782f7e7ac54a8bf85daaf0c8795bc64b 100644 (file)
--- a/src/ttt.h
+++ b/src/ttt.h
 #include "config.h"
 #endif
 
 #include "config.h"
 #endif
 
-#include "args.h"
+/* We use _GNU_SOURCE to get things like asprintf. */
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <assert.h>
+#include <string.h>
+#include <errno.h>
+#include <ctype.h>
+
+#define ASSERT_NOT_REACHED             \
+do {                                   \
+    static const int NOT_REACHED = 0;  \
+    assert (NOT_REACHED);              \
+    exit (1);                          \
+} while (0)
+
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
+#define TTT_PRINTF_FORMAT(fmt_index, va_index) \
+       __attribute__((__format__(__printf__, fmt_index, va_index)))
+#else
+#define TTT_PRINTF_FORMAT(fmt_index, va_index)
+#endif
+
+#include "ttt-args.h"
+#include "x.h"
 
 #endif
 
 #endif
diff --git a/src/x.h b/src/x.h
index 52c3acdd6ffe7a79ac1fe3f23f36d628784a7555..45bf6a9c4fa618696a0a7c59d174e9cf5197991b 100644 (file)
--- a/src/x.h
+++ b/src/x.h
@@ -23,7 +23,7 @@
 #define _X_H_
 
 void
 #define _X_H_
 
 void
-xasprintf (char **strp, const char *fmt, ...) WDO_PRINTF_FORMAT(2, 3);
+xasprintf (char **strp, const char *fmt, ...) TTT_PRINTF_FORMAT(2, 3);
 
 void
 xvasprintf (char **strp, const char *fmt, va_list ap);
 
 void
 xvasprintf (char **strp, const char *fmt, va_list ap);
@@ -49,4 +49,7 @@ xfdopen (int filedes, const char *mode);
 char *
 xstrdup (const char *s);
 
 char *
 xstrdup (const char *s);
 
+void
+xfwrite (const void *ptr, size_t size, size_t nmemb, FILE *stream);
+
 #endif /* _X_H_ */
 #endif /* _X_H_ */