193 lines
6.5 KiB
Diff
193 lines
6.5 KiB
Diff
Patch for #302081
|
|
|
|
This removes unncessary duplicate variable vt_capfp and fixes handling
|
|
of capture file descriptors so that minicom doesn't crash after the
|
|
capture file was closed.
|
|
|
|
Lubomir Kundrak <lkundrak@redhat.com>
|
|
|
|
diff -Nurp minicom-2.2/src/dial.c minicom-2.2.capture/src/dial.c
|
|
--- minicom-2.2/src/dial.c 2005-10-31 13:13:51.000000000 +0100
|
|
+++ minicom-2.2.capture/src/dial.c 2007-09-23 10:07:46.000000000 +0200
|
|
@@ -1355,7 +1355,7 @@ static void dial_entry(struct dialent *d
|
|
mode_status();
|
|
}
|
|
newtype = d->term;
|
|
- vt_set(-1, d->flags & FL_WRAP, NULL, -1, -1, d->flags & FL_ECHO, -1, -1);
|
|
+ vt_set(-1, d->flags & FL_WRAP, -1, -1, d->flags & FL_ECHO, -1, -1);
|
|
local_echo = d->flags & FL_ECHO;
|
|
if (newtype != terminal)
|
|
init_emul(newtype, 1);
|
|
diff -Nurp minicom-2.2/src/ipc.c minicom-2.2.capture/src/ipc.c
|
|
--- minicom-2.2/src/ipc.c 2007-09-23 10:10:00.000000000 +0200
|
|
+++ minicom-2.2.capture/src/ipc.c 2007-09-23 10:08:03.000000000 +0200
|
|
@@ -87,13 +87,13 @@ int keyboard(int cmd, int arg)
|
|
escape = arg;
|
|
break;
|
|
case KSETBS:
|
|
- vt_set(-1, -1, NULL, -1, arg, -1, -1, -1);
|
|
+ vt_set(-1, -1, -1, arg, -1, -1, -1);
|
|
break;
|
|
case KCURST:
|
|
- vt_set(-1, -1, NULL, -1, -1, -1, NORMAL, -1);
|
|
+ vt_set(-1, -1, -1, -1, -1, NORMAL, -1);
|
|
break;
|
|
case KCURAPP:
|
|
- vt_set(-1, -1, NULL, -1, -1, -1, APPL, -1);
|
|
+ vt_set(-1, -1, -1, -1, -1, APPL, -1);
|
|
break;
|
|
default:
|
|
/* The rest is only meaningful if a keyserv runs. */
|
|
diff -Nurp minicom-2.2/src/minicom.c minicom-2.2.capture/src/minicom.c
|
|
--- minicom-2.2/src/minicom.c 2007-09-23 10:10:00.000000000 +0200
|
|
+++ minicom-2.2.capture/src/minicom.c 2007-09-23 10:08:39.000000000 +0200
|
|
@@ -873,14 +873,14 @@ static void helpthem(void)
|
|
void toggle_addlf(void)
|
|
{
|
|
addlf = !addlf;
|
|
- vt_set(addlf, -1, NULL, -1, -1, -1, -1, -1);
|
|
+ vt_set(addlf, -1, -1, -1, -1, -1, -1);
|
|
}
|
|
|
|
/* Toggle local echo. Can be called through the menu, or by a macro. */
|
|
void toggle_local_echo(void)
|
|
{
|
|
local_echo = !local_echo;
|
|
- vt_set(-1, -1, NULL, -1, -1, local_echo, -1 ,-1);
|
|
+ vt_set(-1, -1, -1, -1, local_echo, -1 ,-1);
|
|
}
|
|
|
|
int main(int argc, char **argv)
|
|
@@ -1137,7 +1137,7 @@ int main(int argc, char **argv)
|
|
exit(1);
|
|
}
|
|
docap = 1;
|
|
- vt_set(addlf, -1, capfp, docap, -1, -1, -1, -1);
|
|
+ vt_set(addlf, -1, docap, -1, -1, -1, -1);
|
|
seteuid(eff_uid);
|
|
setegid(eff_gid);
|
|
break;
|
|
@@ -1170,7 +1170,7 @@ int main(int argc, char **argv)
|
|
|
|
if (screen_iso && screen_ibmpc)
|
|
/* init VT */
|
|
- vt_set(-1, -1, (FILE*)NULL, -1, -1, -1, -1, 1);
|
|
+ vt_set(-1, -1, -1, -1, -1, -1, 1);
|
|
|
|
|
|
|
|
@@ -1464,7 +1464,7 @@ dirty_goto:
|
|
if (c == 1)
|
|
docap = 0;
|
|
}
|
|
- vt_set(addlf, -1, capfp, docap, -1, -1, -1, -1);
|
|
+ vt_set(addlf, -1, docap, -1, -1, -1, -1);
|
|
break;
|
|
case 'p': /* Set parameters */
|
|
get_bbp(P_BAUDRATE, P_BITS, P_PARITY, P_STOPB, 0);
|
|
@@ -1489,7 +1489,7 @@ dirty_goto:
|
|
break;
|
|
case 'w': /* Line wrap on-off */
|
|
c = (!us->wrap);
|
|
- vt_set(addlf, c, capfp, docap, -1, -1, -1, -1);
|
|
+ vt_set(addlf, c, docap, -1, -1, -1, -1);
|
|
s = c ? _("Linewrap ON") : _("Linewrap OFF");
|
|
werror("%s", s);
|
|
break;
|
|
diff -Nurp minicom-2.2/src/vt100.c minicom-2.2.capture/src/vt100.c
|
|
--- minicom-2.2/src/vt100.c 2007-09-23 10:10:00.000000000 +0200
|
|
+++ minicom-2.2.capture/src/vt100.c 2007-09-23 10:08:51.000000000 +0200
|
|
@@ -175,7 +175,6 @@ static int vt_crlf = 0; /* Return sends
|
|
static int vt_om; /* Origin mode. */
|
|
WIN *vt_win = NULL; /* Output window. */
|
|
static int vt_docap; /* Capture on/off. */
|
|
-static FILE *vt_capfp; /* Capture file. */
|
|
static void (*vt_keyb)(int, int);/* Gets called for NORMAL/APPL switch. */
|
|
static void (*termout)(const char *, int);/* Gets called to output a string. */
|
|
|
|
@@ -273,15 +272,13 @@ void vt_init(int type, int fg, int bg, i
|
|
}
|
|
|
|
/* Change some things on the fly. */
|
|
-void vt_set(int addlf, int wrap, FILE *capfp, int docap, int bscode,
|
|
+void vt_set(int addlf, int wrap, int docap, int bscode,
|
|
int echo, int cursor, int asis)
|
|
{
|
|
if (addlf >= 0)
|
|
vt_addlf = addlf;
|
|
if (wrap >= 0)
|
|
vt_win->wrap = vt_wrap = wrap;
|
|
- if (capfp != NULL)
|
|
- vt_capfp = capfp;
|
|
if (docap >= 0)
|
|
vt_docap = docap;
|
|
if (bscode >= 0)
|
|
@@ -961,7 +958,7 @@ void vt_out(int ch)
|
|
c = (unsigned char)ch;
|
|
|
|
if (vt_docap == 2) /* Literal. */
|
|
- fputc(c, vt_capfp);
|
|
+ fputc(c, capfp);
|
|
|
|
/* Process <31 chars first, even in an escape sequence. */
|
|
switch (c) {
|
|
@@ -977,7 +974,7 @@ void vt_out(int ch)
|
|
if (vt_addlf) {
|
|
wputc(vt_win, '\n');
|
|
if (vt_docap == 1)
|
|
- fputc('\n', vt_capfp);
|
|
+ fputc('\n', capfp);
|
|
}
|
|
break;
|
|
case '\t': /* Non - destructive TAB */
|
|
@@ -989,7 +986,7 @@ void vt_out(int ch)
|
|
f = vt_win->xs - 1;
|
|
wlocate(vt_win, f, vt_win->cury);
|
|
if (vt_docap == 1)
|
|
- fputc(c, vt_capfp);
|
|
+ fputc(c, capfp);
|
|
break;
|
|
case 013: /* Old Minix: CTRL-K = up */
|
|
wlocate(vt_win, vt_win->curx, vt_win->cury - 1);
|
|
@@ -1025,7 +1022,7 @@ void vt_out(int ch)
|
|
case 7: /* Bell */
|
|
wputc(vt_win, c);
|
|
if (vt_docap == 1)
|
|
- fputc(c, vt_capfp);
|
|
+ fputc(c, capfp);
|
|
break;
|
|
default:
|
|
go_on = 1;
|
|
@@ -1038,7 +1035,7 @@ void vt_out(int ch)
|
|
switch (esc_s) {
|
|
case 0: /* Normal character */
|
|
if (vt_docap == 1)
|
|
- fputc(P_CONVCAP[0] == 'Y' ? vt_inmap[c] : c, vt_capfp);
|
|
+ fputc(P_CONVCAP[0] == 'Y' ? vt_inmap[c] : c, capfp);
|
|
c = vt_inmap[c]; /* conversion 04.09.97 / jl */
|
|
#if TRANSLATE
|
|
if (vt_type == VT100 && vt_trans[vt_charset] && vt_asis == 0)
|
|
@@ -1080,8 +1077,8 @@ void vt_out(int ch)
|
|
|
|
/* Flush output to capture file so that all output is visible there
|
|
* immediately. Causes a write syscall for every call though. */
|
|
- if (vt_capfp)
|
|
- fflush(vt_capfp);
|
|
+ if (capfp)
|
|
+ fflush(capfp);
|
|
}
|
|
|
|
/* Translate keycode to escape sequence. */
|
|
diff -Nurp minicom-2.2/src/vt100.h minicom-2.2.capture/src/vt100.h
|
|
--- minicom-2.2/src/vt100.h 2005-08-04 22:33:34.000000000 +0200
|
|
+++ minicom-2.2.capture/src/vt100.h 2007-09-23 10:07:37.000000000 +0200
|
|
@@ -29,7 +29,7 @@ extern int vt_nl_delay; /* Delay after
|
|
void vt_install(void(*)(const char *, int), void (*)(int, int), WIN *);
|
|
void vt_init(int, int, int, int, int);
|
|
void vt_pinit(WIN *, int, int);
|
|
-void vt_set(int, int, FILE *, int, int, int, int, int);
|
|
+void vt_set(int, int, int, int, int, int, int);
|
|
void vt_out(int);
|
|
void vt_send(int ch);
|
|
|