Fix announce reports when no modems are defined
This commit is contained in:
parent
3d11c24969
commit
4b3dc846c3
@ -240,6 +240,10 @@ void FinishMsg(int Final, long filepos)
|
|||||||
char *temp;
|
char *temp;
|
||||||
FILE *fp, *fi;
|
FILE *fp, *fi;
|
||||||
|
|
||||||
|
#if defined (__FreeBSD__)
|
||||||
|
Syslog('-', "FinishMsg(Final=%s, filepos=%ld)", Final?"true":"false", filepos);
|
||||||
|
#endif
|
||||||
|
|
||||||
temp = calloc(PATH_MAX, sizeof(char));
|
temp = calloc(PATH_MAX, sizeof(char));
|
||||||
|
|
||||||
if (Final && ((fi = OpenMacro(newfiles.Template, newfiles.Language, FALSE)) != NULL)) {
|
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;
|
long filepos1 = 0, filepos2, filepos3 = 0, finalpos = 0;
|
||||||
time_t ftime;
|
time_t ftime;
|
||||||
|
|
||||||
|
#if defined (__FreeBSD__)
|
||||||
|
Syslog('-', "Report(grlist ..., filepos=%ld)", filepos);
|
||||||
|
#endif
|
||||||
|
|
||||||
temp = calloc(PATH_MAX, sizeof(char));
|
temp = calloc(PATH_MAX, sizeof(char));
|
||||||
sprintf(temp, "%s/etc/toberep.data", getenv("MBSE_ROOT"));
|
sprintf(temp, "%s/etc/toberep.data", getenv("MBSE_ROOT"));
|
||||||
if ((fp = fopen(temp, "r")) == NULL) {
|
if ((fp = fopen(temp, "r")) == NULL) {
|
||||||
@ -314,6 +322,9 @@ long Report(gr_list *ta, long filepos)
|
|||||||
fseek(fi, filepos, SEEK_SET);
|
fseek(fi, filepos, SEEK_SET);
|
||||||
Msg_Macro(fi);
|
Msg_Macro(fi);
|
||||||
filepos1 = ftell(fi);
|
filepos1 = ftell(fi);
|
||||||
|
#if defined(__FreeBSD__)
|
||||||
|
Syslog('-', "filepos1=%ld", filepos1);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
free(temp);
|
free(temp);
|
||||||
return 0;
|
return 0;
|
||||||
@ -335,7 +346,7 @@ long Report(gr_list *ta, long filepos)
|
|||||||
Syslog('-', "start a file ...");
|
Syslog('-', "start a file ...");
|
||||||
Syslog('-', "sl: \"%s\" \"%s\"", T_File.Name, T_File.LName);
|
Syslog('-', "sl: \"%s\" \"%s\"", T_File.Name, T_File.LName);
|
||||||
Syslog('-', "bk: \"%d\" \"%d\"", T_File.Size, T_File.SizeKb);
|
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
|
#endif
|
||||||
MacroVars("sl", "ss", T_File.Name, T_File.LName);
|
MacroVars("sl", "ss", T_File.Name, T_File.LName);
|
||||||
MacroVars("bk", "dd", T_File.Size, T_File.SizeKb);
|
MacroVars("bk", "dd", T_File.Size, T_File.SizeKb);
|
||||||
|
@ -143,9 +143,10 @@ void Msg_Macro(FILE *fi)
|
|||||||
|
|
||||||
long Msg_Top(char *template, int language, fidoaddr aka)
|
long Msg_Top(char *template, int language, fidoaddr aka)
|
||||||
{
|
{
|
||||||
char *temp;
|
char *temp, *line;
|
||||||
FILE *fp, *fi;
|
FILE *fp, *fi;
|
||||||
long fileptr, fileptr1 = -1L;
|
long fileptr, fileptr1 = -1L;
|
||||||
|
int hasmodems = FALSE;
|
||||||
|
|
||||||
temp = calloc(PATH_MAX, sizeof(char));
|
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);
|
MacroVars("pqrf", "dsss", ttyinfo.type, ttyinfo.phone, ttyinfo.speed, ttyinfo.flags);
|
||||||
fseek(fi, fileptr, SEEK_SET);
|
fseek(fi, fileptr, SEEK_SET);
|
||||||
Msg_Macro(fi);
|
Msg_Macro(fi);
|
||||||
|
hasmodems = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose(fp);
|
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
|
* TTY info footer
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user