/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2011, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2015, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure, Markus Armbruster
*
* Empire is free software: you can redistribute it and/or modify
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
+#include "chance.h"
#include "commands.h"
#include "match.h"
#include "misc.h"
char mbox_buf[256]; /* Maximum path length */
struct telstr tgm;
FILE *telfp;
- int teles;
+ int teles, need_hdr;
char buf[1024];
char *kind;
int n, res;
return RET_FAIL;
}
teles = 0;
+ need_hdr = 1;
for (;;) {
res = tel_read_header(telfp, mbox, &tgm);
more:
}
if (!teles && *kind == 'a')
pr("\nAnnouncements since %s", ctime(&then));
- if (!teles || !tgm.tel_cont) {
+ if (need_hdr || !tgm.tel_cont) {
pr("\n> ");
pr("%s ", telnames[tgm.tel_type]);
if ((tgm.tel_type == TEL_NORM) ||
pr(" dated %s", ctime(&tgm.tel_date));
}
teles++;
+ need_hdr = 0;
res = tel_read_body(telfp, mbox, &tgm, print_sink, NULL);
if (res < 0)
break;
res = tel_read_header(telfp, mbox, &tgm);
if (res != 0) {
pr("Wait a sec! A new %s has arrived...\n", kind);
+ need_hdr = 1;
goto more;
}
/* Here, we just re-open the file for "w" only,