From 4b3dc846c33cff0701d1632e74f31443945b4e18 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Sat, 18 May 2002 20:23:58 +0000 Subject: [PATCH] Fix announce reports when no modems are defined --- mbfido/announce.c | 13 ++++++++++++- mbfido/msgutil.c | 14 +++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/mbfido/announce.c b/mbfido/announce.c index 0cc17d83..e01bb122 100644 --- a/mbfido/announce.c +++ b/mbfido/announce.c @@ -240,6 +240,10 @@ void FinishMsg(int Final, long filepos) char *temp; FILE *fp, *fi; +#if defined (__FreeBSD__) + Syslog('-', "FinishMsg(Final=%s, filepos=%ld)", Final?"true":"false", filepos); +#endif + temp = calloc(PATH_MAX, sizeof(char)); if (Final && ((fi = OpenMacro(newfiles.Template, newfiles.Language, FALSE)) != NULL)) { @@ -287,6 +291,10 @@ long Report(gr_list *ta, long filepos) long filepos1 = 0, filepos2, filepos3 = 0, finalpos = 0; time_t ftime; +#if defined (__FreeBSD__) + Syslog('-', "Report(grlist ..., filepos=%ld)", filepos); +#endif + temp = calloc(PATH_MAX, sizeof(char)); sprintf(temp, "%s/etc/toberep.data", getenv("MBSE_ROOT")); if ((fp = fopen(temp, "r")) == NULL) { @@ -314,6 +322,9 @@ long Report(gr_list *ta, long filepos) fseek(fi, filepos, SEEK_SET); Msg_Macro(fi); filepos1 = ftell(fi); +#if defined(__FreeBSD__) + Syslog('-', "filepos1=%ld", filepos1); +#endif } else { free(temp); return 0; @@ -335,7 +346,7 @@ long Report(gr_list *ta, long filepos) Syslog('-', "start a file ..."); Syslog('-', "sl: \"%s\" \"%s\"", T_File.Name, T_File.LName); Syslog('-', "bk: \"%d\" \"%d\"", T_File.Size, T_File.SizeKb); - Syslog('-', "dt: \"%d\" \"%d\"", rfcdate(ftime), To_Low(T_File.LDesc[0],newfiles.HiAscii)); + Syslog('-', "dt: \"%s\" \"%s\"", rfcdate(ftime), To_Low(T_File.LDesc[0],newfiles.HiAscii)); #endif MacroVars("sl", "ss", T_File.Name, T_File.LName); MacroVars("bk", "dd", T_File.Size, T_File.SizeKb); diff --git a/mbfido/msgutil.c b/mbfido/msgutil.c index 84938458..8ccffa70 100644 --- a/mbfido/msgutil.c +++ b/mbfido/msgutil.c @@ -143,9 +143,10 @@ void Msg_Macro(FILE *fi) long Msg_Top(char *template, int language, fidoaddr aka) { - char *temp; + char *temp, *line; FILE *fp, *fi; long fileptr, fileptr1 = -1L; + int hasmodems = FALSE; temp = calloc(PATH_MAX, sizeof(char)); @@ -167,11 +168,22 @@ long Msg_Top(char *template, int language, fidoaddr aka) MacroVars("pqrf", "dsss", ttyinfo.type, ttyinfo.phone, ttyinfo.speed, ttyinfo.flags); fseek(fi, fileptr, SEEK_SET); Msg_Macro(fi); + hasmodems = TRUE; } } fclose(fp); } + /* + * If no modems were defined, the fileptr is at a wrong place and + * must be moved. + */ + if (!hasmodems) { + line = calloc(MAXSTR, sizeof(char)); + while ((fgets(line, MAXSTR-2, fi) != NULL) && ((line[0]!='@') || (line[1]!='|'))) {} + free(line); + } + /* * TTY info footer */