X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fkasse.c;h=c5796f9a580788b6a514b86221511518dfb1375f;hb=HEAD;hp=054dfa11170a3521160bb35fad1a3d89db03ebc2;hpb=25a8447b3eea0f353aef046f25a6014332dd3310;p=c128-kasse diff --git a/src/kasse.c b/src/kasse.c index 054dfa1..c5796f9 100644 --- a/src/kasse.c +++ b/src/kasse.c @@ -112,6 +112,7 @@ static void print_screen(void) { static void print_log(char *name, int32_t item_price, int16_t einheiten, char *nickname, char *rest) { char *time = get_time(); + char *ptr = NULL; uint8_t n; char price[EUR_FORMAT_MINLEN + 1]; if (format_euro(price, sizeof(price), item_price) == NULL) { @@ -119,11 +120,6 @@ static void print_log(char *name, int32_t item_price, int16_t einheiten, exit(1); } - /* TODO: teach the EUR sign to the printer. - * Until then, we just overwrite it with "E" */ - price[EUR_FORMAT_MINLEN - 1] = 'E'; - rest[EUR_FORMAT_MINLEN - 1] = 'E'; - /* clang-format off */ n = snprintf(print_buffer, sizeof(print_buffer), /* enable lower case letters -- 1 */ @@ -146,6 +142,14 @@ static void print_log(char *name, int32_t item_price, int16_t einheiten, 17, status.transaction_id, time, name, price, rest, einheiten, (*nickname != '\0' ? nickname : "Unbekannt")); /* clang-format on */ + + /* TODO: teach the EUR sign to the printer. + * Until then, we just overwrite it with "E" */ + ptr = print_buffer; + while (ptr = strchr(ptr, EURSYM[0])) { + *ptr = 'E'; + } + if (n > sizeof(print_buffer)) { cprintf("\r\nprint_log(): print_buffer overflowed!\r\n" "Wanted to write %d bytes\r\n%s\r\n",