9 static char *filter = NULL;
10 static BYTE filter_len;
12 static void print_credit_screen() {
15 cprintf("C128-Kassenprogramm: Credit Manager\r\n\r\n");
16 for (; i < credits.num_items; ++i)
17 if (filter == NULL || strncmp(credits.credits[i].nickname, filter, filter_len) == 0)
18 cprintf("Guthaben %s: %d Cents\r\n", credits.credits[i].nickname, credits.credits[i].credit);
19 cprintf("\r\nBefehle: n) Neues Guthaben f) Filtern z) Zurueck\r\n");
22 /* Guthabenverwalter */
23 void credit_manager() {
25 char *c, *nickname, *credits_input;
26 /* credits_int is a stupid name, but overlaps with struct credits_t credits; else */
29 print_credit_screen();
31 if (c == NULL || *c == '\0')
34 cprintf("\r\nGuthaben eingeben:\r\n");
35 credits_input = get_input();
37 if (credits_input == NULL || credits_input[0] == '\0')
39 else if (credits_input[0] == '-') {
43 credits_int = atoi(credits_input) * negative;
44 if (credits_int > 0) {
45 cprintf("Nickname eingeben:\r\n");
46 nickname = get_input();
47 if (nickname == NULL || nickname[0] == '\0')
49 strncpy(credits.credits[credits.num_items].nickname, nickname, 9);
50 credits.credits[credits.num_items].credit = credits_int;
53 } else if (*c == 'f') {
54 cprintf("Filter eingeben:\r\n");
56 if (filter == NULL || *filter == 32 || (filter_len = strlen(filter)) == 0)
58 } else if (*c == 'z' || *c == 'q')