Ensure correct Remote Console functionality when log files get big
This commit is contained in:
parent
4c6f086eb3
commit
02b3477d20
3 changed files with 14 additions and 13 deletions
|
@ -484,7 +484,7 @@ TMLN *lp;
|
|||
char cbuf[4*CBUFSIZE], gbuf[CBUFSIZE], *cptr, *argv[1] = {NULL};
|
||||
CTAB *cmdp;
|
||||
uint32 read_start_time;
|
||||
long cmd_log_start;
|
||||
t_offset cmd_log_start;
|
||||
|
||||
tmxr_poll_rx (&sim_rem_con_tmxr); /* poll input */
|
||||
for (i=0; i < sim_rem_con_tmxr.lines; i++) {
|
||||
|
@ -603,7 +603,7 @@ for (i=0; i < sim_rem_con_tmxr.lines; i++) {
|
|||
cptr = cbuf;
|
||||
cptr = get_glyph (cptr, gbuf, 0); /* get command glyph */
|
||||
sim_switches = 0; /* init switches */
|
||||
cmd_log_start = ftell (sim_log);
|
||||
cmd_log_start = sim_ftell (sim_log);
|
||||
if (!find_cmd (gbuf)) /* validate command */
|
||||
stat = SCPE_UNK;
|
||||
else {
|
||||
|
@ -633,7 +633,7 @@ for (i=0; i < sim_rem_con_tmxr.lines; i++) {
|
|||
}
|
||||
}
|
||||
fflush (sim_log);
|
||||
fseek (sim_log, cmd_log_start, SEEK_SET);
|
||||
sim_fseeko (sim_log, cmd_log_start, SEEK_SET);
|
||||
cbuf[sizeof(cbuf)-1] = '\0';
|
||||
while (fgets (cbuf, sizeof(cbuf)-1, sim_log)) {
|
||||
tmxr_linemsg (lp, cbuf);
|
||||
|
@ -1161,7 +1161,7 @@ else {
|
|||
return SCPE_MEM;
|
||||
get_glyph_nc (filename, gbuf, 0); /* reparse */
|
||||
strncpy ((*pref)->name, gbuf, sizeof((*pref)->name)-1);
|
||||
*pf = sim_fopen (gbuf, (binary ? "a+b" : "a+")); /* open file */
|
||||
*pf = sim_fopen (gbuf, (binary ? "a+b" : "a+")); /* open file */
|
||||
if (*pf == NULL) { /* error? */
|
||||
free (*pref);
|
||||
*pref = NULL;
|
||||
|
|
18
sim_fio.c
18
sim_fio.c
|
@ -176,7 +176,7 @@ return total;
|
|||
|
||||
/* Forward Declaration */
|
||||
|
||||
static t_offset _sim_ftell (FILE *st);
|
||||
t_offset sim_ftell (FILE *st);
|
||||
|
||||
/* Get file size */
|
||||
|
||||
|
@ -186,9 +186,9 @@ t_offset pos, sz;
|
|||
|
||||
if (fp == NULL)
|
||||
return 0;
|
||||
pos = _sim_ftell (fp);
|
||||
pos = sim_ftell (fp);
|
||||
sim_fseek (fp, 0, SEEK_END);
|
||||
sz = _sim_ftell (fp);
|
||||
sz = sim_ftell (fp);
|
||||
sim_fseeko (fp, pos, SEEK_SET);
|
||||
return sz;
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ int sim_fseeko (FILE *st, t_offset offset, int whence)
|
|||
return fseeko (st, (off_t)offset, whence);
|
||||
}
|
||||
|
||||
static t_offset _sim_ftell (FILE *st)
|
||||
t_offset sim_ftell (FILE *st)
|
||||
{
|
||||
return (t_offset)(ftello (st));
|
||||
}
|
||||
|
@ -258,7 +258,7 @@ int sim_fseeko (FILE *st, t_offset offset, int whence)
|
|||
return fseek (st, offset, whence);
|
||||
}
|
||||
|
||||
static t_offset _sim_ftell (FILE *st)
|
||||
t_offset sim_ftell (FILE *st)
|
||||
{
|
||||
return (t_offset)(ftell (st));
|
||||
}
|
||||
|
@ -301,7 +301,7 @@ switch (whence) {
|
|||
return fsetpos (st, &fileaddr);
|
||||
}
|
||||
|
||||
static t_offset _sim_ftell (FILE *st)
|
||||
t_offset sim_ftell (FILE *st)
|
||||
{
|
||||
fpos_t fileaddr;
|
||||
if (fgetpos (st, &fileaddr))
|
||||
|
@ -320,7 +320,7 @@ int sim_fseeko (FILE *st, t_offset xpos, int origin)
|
|||
return fseeko64 (st, (off64_t)xpos, origin);
|
||||
}
|
||||
|
||||
static t_offset _sim_ftell (FILE *st)
|
||||
t_offset sim_ftell (FILE *st)
|
||||
{
|
||||
return (t_offset)(ftello64 (st));
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ int sim_fseeko (FILE *st, t_offset xpos, int origin)
|
|||
return fseeko (st, (off_t)xpos, origin);
|
||||
}
|
||||
|
||||
static t_offset _sim_ftell (FILE *st)
|
||||
t_offset sim_ftell (FILE *st)
|
||||
{
|
||||
return (t_offset)(ftello (st));
|
||||
}
|
||||
|
@ -352,7 +352,7 @@ int sim_fseeko (FILE *st, t_offset xpos, int origin)
|
|||
return fseek (st, (long) xpos, origin);
|
||||
}
|
||||
|
||||
static t_offset _sim_ftell (FILE *st)
|
||||
t_offset sim_ftell (FILE *st)
|
||||
{
|
||||
return (t_offset)(ftell (st));
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ size_t sim_fread (void *bptr, size_t size, size_t count, FILE *fptr);
|
|||
size_t sim_fwrite (void *bptr, size_t size, size_t count, FILE *fptr);
|
||||
uint32 sim_fsize (FILE *fptr);
|
||||
uint32 sim_fsize_name (char *fname);
|
||||
t_offset sim_ftell (FILE *st);
|
||||
t_offset sim_fsize_ex (FILE *fptr);
|
||||
t_offset sim_fsize_name_ex (char *fname);
|
||||
void sim_buf_swap_data (void *bptr, size_t size, size_t count);
|
||||
|
|
Loading…
Add table
Reference in a new issue