From 5028a716488ebb482d128bfb78cee58fd04ad59f Mon Sep 17 00:00:00 2001 From: matze Date: Sat, 27 Oct 2007 00:17:39 +0000 Subject: [PATCH] print nickname in log git-svn-id: https://shell.noname-ev.de/svn/kasse/c128@74 af93e077-1a23-4f1e-9cbe-9382a9d578f5 --- src/kasse.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/kasse.c b/src/kasse.c index 8c02cef..336cc3f 100644 --- a/src/kasse.c +++ b/src/kasse.c @@ -90,7 +90,7 @@ static void print_log(BYTE n, int einheiten, char *nickname) { RETRY:; sprintf(print_buffer, "[%lu] %s - %s - %s - %d - an %s\r\n", items_sold, time, status.status[n].item_name, price, - einheiten, (nickname != NULL ? nickname : "Unbekannt")); + einheiten, (*nickname != '\0' ? nickname : "Unbekannt")); c = cbm_open((BYTE)4, (BYTE)4, (BYTE)0, NULL); if (c != 0) { c128_perror(c, "cbm_open(printer)"); @@ -122,7 +122,8 @@ void buy(BYTE n) { BYTE i = 0, matches = 0; BYTE c, nickname_len; int einheiten; - char *nickname; + char *input; + char nickname[11]; struct credits_t *credit; if (status.status[n].item_name == NULL) { @@ -150,7 +151,8 @@ void buy(BYTE n) { toggle_videomode(); cprintf("\r\nAuf ein Guthaben kaufen? Wenn ja, Nickname eingeben:\r\n"); - nickname = get_input(); + input = get_input(); + strncpy(nickname, input, 11); toggle_videomode(); cprintf("%s\r\n", nickname); toggle_videomode(); @@ -181,7 +183,7 @@ void buy(BYTE n) { } } else { /* Ensure that nickname is NULL if it's empty because it's used in print_log */ - nickname = NULL; + *nickname = '\0'; } status.status[n].times_sold += einheiten; -- 2.39.5