From 1ba564778bc5e1e0af0d25ce6b6d23b8165f7338 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Mon, 1 Nov 2010 18:48:10 +0100 Subject: [PATCH] use cgetc() and cputc() instead of getchar() --- src/general.c | 5 +++-- src/itemz.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/general.c b/src/general.c index e1fb173..db7807c 100644 --- a/src/general.c +++ b/src/general.c @@ -26,10 +26,11 @@ char *get_input() { while (1) { if (i == 31) break; - c = getchar(); + c = cgetc(); if (c == 13) break; - else output[i++] = c; + cputc(c); + output[i++] = c; } return output; } diff --git a/src/itemz.c b/src/itemz.c index 274570f..f9ea82f 100644 --- a/src/itemz.c +++ b/src/itemz.c @@ -52,7 +52,7 @@ static void new_item() { if ((input = get_input()) == NULL || *input == '\0' || (price = atoi(input)) == 0) return; cprintf("\r\nWie oft schon verkauft? [0] \r\n"); - if ((input = get_input()) == NULL || *input == '\0') + if ((input = get_input()) == NULL) return; memset(status.status[status.num_items].item_name, '\0', MAX_ITEM_NAME_LENGTH+1); strncpy(status.status[status.num_items].item_name, name, MAX_ITEM_NAME_LENGTH); -- 2.39.5