Fixed problem with empty bottom text

SVN revision: 1603
This commit is contained in:
Stefan Ritt 2006-01-16 16:32:51 +00:00
parent 1b8c197a51
commit b1b9e71797

View File

@ -7016,28 +7016,30 @@ void show_bottom_text(LOGBOOK * lbs)
FILE *f; FILE *f;
char file_name[256], *buf; char file_name[256], *buf;
/* check if file starts with an absolute directory */ if (str[0]) {
if (str[0] == DIR_SEPARATOR || str[1] == ':') /* check if file starts with an absolute directory */
strcpy(file_name, str); if (str[0] == DIR_SEPARATOR || str[1] == ':')
else { strcpy(file_name, str);
strlcpy(file_name, resource_dir, sizeof(file_name)); else {
strlcat(file_name, str, sizeof(file_name)); strlcpy(file_name, resource_dir, sizeof(file_name));
strlcat(file_name, str, sizeof(file_name));
}
f = fopen(file_name, "rb");
if (f != NULL) {
fseek(f, 0, SEEK_END);
size = TELL(fileno(f));
fseek(f, 0, SEEK_SET);
buf = xmalloc(size + 1);
fread(buf, 1, size, f);
buf[size] = 0;
fclose(f);
rsputs(buf);
} else
rsputs(str);
} }
f = fopen(file_name, "rb");
if (f != NULL) {
fseek(f, 0, SEEK_END);
size = TELL(fileno(f));
fseek(f, 0, SEEK_SET);
buf = xmalloc(size + 1);
fread(buf, 1, size, f);
buf[size] = 0;
fclose(f);
rsputs(buf);
} else
rsputs(str);
} else } else
/* add little logo */ /* add little logo */
rsprintf rsprintf