aboutsummaryrefslogtreecommitdiffstats
path: root/convert-to-chess.c
diff options
context:
space:
mode:
Diffstat (limited to 'convert-to-chess.c')
-rw-r--r--convert-to-chess.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/convert-to-chess.c b/convert-to-chess.c
new file mode 100644
index 0000000..b08c90c
--- /dev/null
+++ b/convert-to-chess.c
@@ -0,0 +1,25 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+USAGE("[-w | -b | -n]");
+
+
+int
+main(int argc, char *argv[])
+{
+ int black = 0;
+
+ ARGBEGIN {
+ case 'b': black = 1; break;
+ case 'w': black = 0; break;
+ case 'n': black = -1; break;
+ default:
+ usage();
+ } ARGEND;
+ if (argc)
+ usage();
+
+ return convert(black < 0 ? &libcharconv_chess_neutral :
+ black > 0 ? &libcharconv_chess_black :
+ &libcharconv_chess_white);
+}