From 20c9112b075e6574ce0ae9ef114529144e95fbbd Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 25 Apr 2005 16:31:36 +0000 Subject: [PATCH] Abfangen von errno, Ausgabe, aber kein Abbruch des Reports. --- src/common/gamecode/creport.c | 15 ++++++++------- src/common/gamecode/report.c | 33 +++++++++++---------------------- 2 files changed, 19 insertions(+), 29 deletions(-) diff --git a/src/common/gamecode/creport.c b/src/common/gamecode/creport.c index db9a0aabd..a9f299141 100644 --- a/src/common/gamecode/creport.c +++ b/src/common/gamecode/creport.c @@ -1104,14 +1104,11 @@ report_computer(FILE * F, faction * f, const faction_list * addresses, /* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ /* initialisations, header and lists */ - if (quiet) { - printf(" CR"); - fflush(stdout); - } - else printf(" - schreibe Computerreport\n"); + fprintf(stdout, "Reports für %s: CR\r", factionname(f)); + fflush(stdout); - fprintf(F, "VERSION %d\n", C_REPORT_VERSION); - fprintf(F, "\"%s\";locale\n", locale_name(f->locale)); + fprintf(F, "VERSION %d\n", C_REPORT_VERSION); + fprintf(F, "\"%s\";locale\n", locale_name(f->locale)); fprintf(F, "%d;noskillpoints\n", 1); fprintf(F, "%ld;date\n", report_time); fprintf(F, "\"%s\";Spiel\n", global.gamename); @@ -1525,5 +1522,9 @@ report_computer(FILE * F, faction * f, const faction_list * addresses, report_crtypes(F, f->locale); write_translations(F); reset_translations(); + if (errno) { + log_error(("%s\n", strerror(errno))); + errno = 0; + } return 0; } diff --git a/src/common/gamecode/report.c b/src/common/gamecode/report.c index 12e7456ef..1f8e73ccf 100644 --- a/src/common/gamecode/report.c +++ b/src/common/gamecode/report.c @@ -1582,12 +1582,9 @@ order_template(FILE * F, faction * f) plane *pl; region *last = f->last?f->last:lastregion(f); - if (quiet) { - printf(" ZV"); - fflush(stdout); - } - else - printf(" - Schreibe Zugvorlage\n"); + fprintf(stdout, "Reports für %s: ZV\r", factionname(f)); + fflush(stdout); + rps_nowrap(F, ""); rnl(F); rps_nowrap(F, LOC(f->locale, "nr_template")); @@ -2004,16 +2001,12 @@ report(FILE *F, faction * f, const faction_list * addresses, ix = Pow(O_STATISTICS); wants_stats = (f->options & ix); - if (quiet) { - printf(" NR"); - fflush(stdout); - } - else - printf(" - Schreibe Report\n"); + fprintf(stdout, "Reports für %s: NR\r", factionname(f)); + fflush(stdout); - m = msg_message("nr_header_date", "game date", global.gamename, pzTime); - nr_render(m, f->locale, buf, sizeof(buf), f); - msg_release(m); + m = msg_message("nr_header_date", "game date", global.gamename, pzTime); + nr_render(m, f->locale, buf, sizeof(buf), f); + msg_release(m); centre(F, buf, true); centre(F, gamedate_season(f->locale), true); @@ -2730,11 +2723,8 @@ reports(void) current_faction = f; gotit = false; - if (quiet) { - printf("Reports für %s: ", factionname(f)); - fflush(stdout); - } - else printf("%s\n", factionname(f)); + printf("Reports für %s: \r", factionname(f)); + fflush(stdout); prepare_report(f); addresses = get_addresses(f); @@ -2886,9 +2876,8 @@ reports(void) a = a->nexttype; a_remove(&f->attribs, a_old); } - if (quiet) - printf("\n"); freelist(addresses); + putc('\n', stdout); } str = get_param(global.parameters, "globalreport");