--- /dev/null
+#include <conio.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "config.h"
+#include "general.h"
+
+char *filter = NULL;
+
+void print_credit_screen() {
+ uc i = 0;
+ clrscr();
+ printf("C128-Kassenprogramm: Guthabenverwaltung\n\n");
+ for (; i < num_credit_items; ++i)
+ printf("Guthaben für %s: %d Cents\n", credits[i].nickname, credits[i].credit);
+ printf("\nBefehle: f) Filtern q) Back to main screen\n");
+}
+
+/* Guthabenverwalter */
+void credit_manager() {
+ uc c;
+ while (1) {
+ print_credit_screen();
+ c = getchar();
+ if (c == 'f') {
+ printf("Filter eingeben:\n");
+ if (filter != NULL)
+ free(filter);
+ filter = get_input();
+ if (filter[0] == '0') {
+ free(filter);
+ filter = NULL;
+ }
+ } else if (c == 'q')
+ break;
+ }
+}
--- /dev/null
+#ifndef CREDIT_MANAGER_H_
+#define CREDIT_MANAGER_H_
+void credit_manager();
+#endif
--- /dev/null
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "general.h"
+
+char *get_input() {
+ uc i = 0;
+ char *output = malloc(32 * sizeof(char));
+ uc c;
+ if (output == NULL) {
+ perror("malloc()");
+ exit(1);
+ }
+ memset(output, '\0', 32);
+ while (1) {
+ if (i == 31)
+ break;
+ c = getchar();
+ if (c == 13)
+ break;
+ else output[i++] = c;
+ }
+ return output;
+}