Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Main
Synchronet
Commits
089d3b1a
Commit
089d3b1a
authored
Jul 10, 2019
by
deuce
Browse files
Remove hack introduced in r1.12 of conn_telnet.c by breaking the dependency
on cterm.
parent
93614865
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
35 additions
and
21 deletions
+35
-21
src/syncterm/bbslist.c
src/syncterm/bbslist.c
+19
-0
src/syncterm/bbslist.h
src/syncterm/bbslist.h
+3
-0
src/syncterm/conn_telnet.c
src/syncterm/conn_telnet.c
+8
-4
src/syncterm/telnet_io.c
src/syncterm/telnet_io.c
+2
-3
src/syncterm/telnet_io.h
src/syncterm/telnet_io.h
+2
-1
src/syncterm/term.c
src/syncterm/term.c
+1
-13
No files found.
src/syncterm/bbslist.c
View file @
089d3b1a
...
...
@@ -1963,3 +1963,22 @@ struct bbslist *show_bbslist(char *current, int connected)
}
}
}
cterm_emulation_t
get_emulation
(
struct
bbslist
*
bbs
)
{
if
(
bbs
==
NULL
)
return
CTERM_EMULATION_ANSI_BBS
;
switch
(
bbs
->
screen_mode
)
{
case
SCREEN_MODE_C64
:
case
SCREEN_MODE_C128_40
:
case
SCREEN_MODE_C128_80
:
return
CTERM_EMULATION_PETASCII
;
case
SCREEN_MODE_ATARI
:
case
SCREEN_MODE_ATARI_XEP80
:
return
CTERM_EMULATION_ATASCII
;
default:
return
CTERM_EMULATION_ANSI_BBS
;
}
}
src/syncterm/bbslist.h
View file @
089d3b1a
...
...
@@ -15,6 +15,8 @@
#include <malloc.h>
/* alloca() on Win32 */
#endif
#include <cterm.h>
#define LIST_NAME_MAX 30
#define LIST_ADDR_MAX 64
#define MAX_USER_LEN 30
...
...
@@ -103,5 +105,6 @@ void free_list(struct bbslist **list, int listcount);
void
add_bbs
(
char
*
listpath
,
struct
bbslist
*
bbs
);
int
edit_list
(
struct
bbslist
**
list
,
struct
bbslist
*
item
,
char
*
listpath
,
int
isdefault
);
int
get_rate_num
(
int
rate
);
cterm_emulation_t
get_emulation
(
struct
bbslist
*
bbs
);
#endif
src/syncterm/conn_telnet.c
View file @
089d3b1a
...
...
@@ -30,11 +30,11 @@ void telnet_input_thread(void *args)
size_t
buffer
;
char
rbuf
[
BUFFER_SIZE
];
char
*
buf
;
cterm_emulation_t
emu
=
*
(
cterm_emulation_t
*
)
args
;
SetThreadName
(
"Telnet Input"
);
conn_api
.
input_thread_running
=
1
;
while
(
cterm
==
NULL
)
// telnet_interpret needs to dereference cterm (to get emulation type)
SLEEP
(
1
);
free
(
args
);
while
(
telnet_sock
!=
INVALID_SOCKET
&&
!
conn_api
.
terminate
)
{
FD_ZERO
(
&
rds
);
FD_SET
(
telnet_sock
,
&
rds
);
...
...
@@ -59,7 +59,7 @@ void telnet_input_thread(void *args)
break
;
}
if
(
rd
>
0
)
buf
=
(
char
*
)
telnet_interpret
(
conn_api
.
rd_buf
,
rd
,
(
BYTE
*
)
rbuf
,
&
rd
);
buf
=
(
char
*
)
telnet_interpret
(
conn_api
.
rd_buf
,
rd
,
(
BYTE
*
)
rbuf
,
&
rd
,
emu
);
buffered
=
0
;
while
(
buffered
<
rd
)
{
pthread_mutex_lock
(
&
(
conn_inbuf
.
mutex
));
...
...
@@ -130,6 +130,8 @@ void telnet_output_thread(void *args)
int
telnet_connect
(
struct
bbslist
*
bbs
)
{
cterm_emulation_t
*
emu
;
init_uifc
(
TRUE
,
TRUE
);
telnet_log_level
=
bbs
->
telnet_loglevel
;
...
...
@@ -163,8 +165,10 @@ int telnet_connect(struct bbslist *bbs)
memset
(
telnet_local_option
,
0
,
sizeof
(
telnet_local_option
));
memset
(
telnet_remote_option
,
0
,
sizeof
(
telnet_remote_option
));
emu
=
malloc
(
sizeof
(
cterm_emulation_t
));
*
emu
=
get_emulation
(
bbs
);
_beginthread
(
telnet_output_thread
,
0
,
NULL
);
_beginthread
(
telnet_input_thread
,
0
,
NULL
);
_beginthread
(
telnet_input_thread
,
0
,
emu
);
uifc
.
pop
(
NULL
);
...
...
src/syncterm/telnet_io.c
View file @
089d3b1a
...
...
@@ -6,7 +6,6 @@
#include <string.h>
#include "term.h"
#include "cterm.h"
#include "genwrap.h"
#include "sockwrap.h"
...
...
@@ -91,7 +90,7 @@ void request_telnet_opt(uchar cmd, uchar opt)
send_telnet_cmd
(
cmd
,
opt
);
}
BYTE
*
telnet_interpret
(
BYTE
*
inbuf
,
int
inlen
,
BYTE
*
outbuf
,
int
*
outlen
)
BYTE
*
telnet_interpret
(
BYTE
*
inbuf
,
int
inlen
,
BYTE
*
outbuf
,
int
*
outlen
,
cterm_emulation_t
emu
)
{
BYTE
command
;
BYTE
option
;
...
...
@@ -160,7 +159,7 @@ BYTE* telnet_interpret(BYTE* inbuf, int inlen, BYTE* outbuf, int *outlen)
if
(
option
==
TELNET_TERM_TYPE
&&
telnet_cmd
[
3
]
==
TELNET_TERM_SEND
)
{
char
buf
[
32
];
const
char
*
termtype
;
switch
(
cterm
->
emulation
)
{
switch
(
emu
)
{
case
CTERM_EMULATION_PETASCII
:
termtype
=
"PETSCII"
;
break
;
...
...
src/syncterm/telnet_io.h
View file @
089d3b1a
...
...
@@ -8,12 +8,13 @@
#ifndef TELNET_NO_DLL
#define TELNET_NO_DLL
#endif
#include <cterm.h>
#include "telnet.h"
extern
uchar
telnet_local_option
[
0x100
];
extern
uchar
telnet_remote_option
[
0x100
];
BYTE
*
telnet_interpret
(
BYTE
*
inbuf
,
int
inlen
,
BYTE
*
outbuf
,
int
*
outlen
);
BYTE
*
telnet_interpret
(
BYTE
*
inbuf
,
int
inlen
,
BYTE
*
outbuf
,
int
*
outlen
,
cterm_emulation_t
emu
);
BYTE
*
telnet_expand
(
BYTE
*
inbuf
,
size_t
inlen
,
BYTE
*
outbuf
,
size_t
*
newlen
);
void
request_telnet_opt
(
uchar
cmd
,
uchar
opt
);
...
...
src/syncterm/term.c
View file @
089d3b1a
...
...
@@ -2235,7 +2235,6 @@ BOOL doterm(struct bbslist *bbs)
int
oldmc
;
int
updated
=
FALSE
;
BOOL
sleep
;
int
emulation
=
CTERM_EMULATION_ANSI_BBS
;
size_t
remain
;
struct
text_info
txtinfo
;
#ifndef WITHOUT_OOII
...
...
@@ -2263,18 +2262,7 @@ BOOL doterm(struct bbslist *bbs)
FREE_AND_NULL
(
scrollback_buf
);
scrollback_lines
=
0
;
scrollback_mode
=
txtinfo
.
currmode
;
switch
(
bbs
->
screen_mode
)
{
case
SCREEN_MODE_C64
:
case
SCREEN_MODE_C128_40
:
case
SCREEN_MODE_C128_80
:
emulation
=
CTERM_EMULATION_PETASCII
;
break
;
case
SCREEN_MODE_ATARI
:
case
SCREEN_MODE_ATARI_XEP80
:
emulation
=
CTERM_EMULATION_ATASCII
;
break
;
}
cterm
=
cterm_init
(
term
.
height
,
term
.
width
,
term
.
x
-
1
,
term
.
y
-
1
,
settings
.
backlines
,
scrollback_buf
,
emulation
);
cterm
=
cterm_init
(
term
.
height
,
term
.
width
,
term
.
x
-
1
,
term
.
y
-
1
,
settings
.
backlines
,
scrollback_buf
,
get_emulation
(
bbs
));
if
(
!
cterm
)
{
return
FALSE
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment