From: matze Date: Sun, 29 Jul 2007 14:35:28 +0000 (+0000) Subject: file logging X-Git-Tag: rgb2rv6~68 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=4fd4ec23e00a36535c5e1ad8eee15f0ed04faffd;p=c128-kasse file logging git-svn-id: https://shell.noname-ev.de/svn/kasse/c128@41 af93e077-1a23-4f1e-9cbe-9382a9d578f5 --- diff --git a/config.c b/config.c index b58f36f..9fc1fee 100644 --- a/config.c +++ b/config.c @@ -11,10 +11,8 @@ unsigned long int items_sold = 0; BYTE printer_port = 4; struct status_t status[MAX_ITEMS+1]; struct credits_t credits[MAX_CREDIT_ITEMS+1]; -#define REAL_DATA -#ifdef REAL_DATA -void load_config(); +void load_config(); void load_items(){ FILE* f; @@ -93,35 +91,3 @@ void dump_state(){ */ void load_config() { } - -#else - -void load_config() { -} - -void load_items() { - BYTE c; - num_items=2; - strcpy(status[0].item_name, "cola"); - status[0].price = 230; - status[0].times_sold = 0; - strcpy(status[1].item_name, "mate"); - status[1].price = 150; - status[1].times_sold = 0; - for (c = 2; c < MAX_ITEMS; ++c) - status[c].item_name[0] = 0; -} - -void load_state() { - status[0].times_sold=23; - status[1].times_sold=42; -} - -void load_credits() { -} - -void save_state() { -} - -void save_credits() {} -#endif diff --git a/kasse.c b/kasse.c index f56a032..fefc39d 100644 --- a/kasse.c +++ b/kasse.c @@ -26,6 +26,17 @@ void print_screen() { cprintf("\r\nBefehle: s) Daten sichern d) Drucken umschalten\r\ng) Guthabenverwaltung z) Zeit setzen\r\n"); } +void log_file(char * s) { + FILE * f; + if (s==NULL) + return; + f = fopen("log", "a"); + if (f==NULL) + c128_perror(23, "kann logfile nicht oeffnen"); + fputs(f, s); + fclose(f); +} + /* Druckt eine entsprechende Zeile aus */ void print_log(BYTE n, int einheiten, char *nickname) { BYTE c; @@ -51,6 +62,7 @@ void print_log(BYTE n, int einheiten, char *nickname) { exit(1); } cbm_close((BYTE)4); + log_file(print_buffer); } /* Dialog, der einen durch's Abrechnen der Einträge führt */