summaryrefslogtreecommitdiff
path: root/src/game_loop.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/game_loop.c')
-rw-r--r--src/game_loop.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/game_loop.c b/src/game_loop.c
index f71d204..5f893e0 100644
--- a/src/game_loop.c
+++ b/src/game_loop.c
@@ -64,11 +64,14 @@ static struct move get_move(enum player_color board[8][8],
}
}
- if (STREQ(input, "h\n")) {
+ // Remove trailing newline
+ input[strcspn(input, "\n")] = '\0';
+
+ if (STREQ(input, "h")) {
print_help();
- } else if (STREQ(input, "p\n")) {
+ } else if (STREQ(input, "p")) {
print_board(board);
- } else if (STREQ(input, "g\n")) {
+ } else if (STREQ(input, "g")) {
puts("NOT IMPLEMENTED YET!");
} else {
sscanf(input, "%d %d", &move.row, &move.col);