Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
e13e4957
Commit
e13e4957
authored
17 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
Beautify log output a bit.
parent
5b0e5c8c
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/syncterm/syncterm.c
+1
-0
1 addition, 0 deletions
src/syncterm/syncterm.c
src/syncterm/telnet_io.c
+7
-6
7 additions, 6 deletions
src/syncterm/telnet_io.c
src/syncterm/term.c
+1
-1
1 addition, 1 deletion
src/syncterm/term.c
with
9 additions
and
7 deletions
src/syncterm/syncterm.c
+
1
−
0
View file @
e13e4957
...
@@ -1223,6 +1223,7 @@ int main(int argc, char **argv)
...
@@ -1223,6 +1223,7 @@ int main(int argc, char **argv)
if
(
log_fp
!=
NULL
)
{
if
(
log_fp
!=
NULL
)
{
time_t
now
=
time
(
NULL
);
time_t
now
=
time
(
NULL
);
fprintf
(
log_fp
,
"%.15s Log closed
\n
"
,
ctime
(
&
now
)
+
4
);
fprintf
(
log_fp
,
"%.15s Log closed
\n
"
,
ctime
(
&
now
)
+
4
);
fprintf
(
log_fp
,
"---------------
\n
"
);
fclose
(
log_fp
);
fclose
(
log_fp
);
log_fp
=
NULL
;
log_fp
=
NULL
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/syncterm/telnet_io.c
+
7
−
6
View file @
e13e4957
...
@@ -24,6 +24,7 @@ char terminal[TELNET_TERM_MAXLEN+1];
...
@@ -24,6 +24,7 @@ char terminal[TELNET_TERM_MAXLEN+1];
uchar
telnet_local_option
[
0x100
];
uchar
telnet_local_option
[
0x100
];
uchar
telnet_remote_option
[
0x100
];
uchar
telnet_remote_option
[
0x100
];
extern
char
*
log_levels
[];
extern
FILE
*
log_fp
;
extern
FILE
*
log_fp
;
int
telnet_log_level
;
int
telnet_log_level
;
...
@@ -39,7 +40,7 @@ static int lprintf(int level, const char *fmt, ...)
...
@@ -39,7 +40,7 @@ static int lprintf(int level, const char *fmt, ...)
vsnprintf
(
sbuf
,
sizeof
(
sbuf
),
fmt
,
argptr
);
vsnprintf
(
sbuf
,
sizeof
(
sbuf
),
fmt
,
argptr
);
sbuf
[
sizeof
(
sbuf
)
-
1
]
=
0
;
sbuf
[
sizeof
(
sbuf
)
-
1
]
=
0
;
va_end
(
argptr
);
va_end
(
argptr
);
return
(
fprintf
(
log_fp
,
"
%s
\n
"
,
sbuf
));
return
(
fprintf
(
log_fp
,
"
Telnet %s %s
\n
"
,
log_levels
[
level
]
,
sbuf
));
}
}
void
putcom
(
BYTE
*
buf
,
size_t
len
)
void
putcom
(
BYTE
*
buf
,
size_t
len
)
...
@@ -60,12 +61,12 @@ static void send_telnet_cmd(uchar cmd, uchar opt)
...
@@ -60,12 +61,12 @@ static void send_telnet_cmd(uchar cmd, uchar opt)
char
buf
[
16
];
char
buf
[
16
];
if
(
cmd
<
TELNET_WILL
)
{
if
(
cmd
<
TELNET_WILL
)
{
lprintf
(
LOG_INFO
,
"TX
Telnet command
: %s"
lprintf
(
LOG_INFO
,
"TX: %s"
,
telnet_cmd_desc
(
cmd
));
,
telnet_cmd_desc
(
cmd
));
sprintf
(
buf
,
"%c%c"
,
TELNET_IAC
,
cmd
);
sprintf
(
buf
,
"%c%c"
,
TELNET_IAC
,
cmd
);
putcom
(
buf
,
2
);
putcom
(
buf
,
2
);
}
else
{
}
else
{
lprintf
(
LOG_INFO
,
"TX
Telnet command
: %s %s"
lprintf
(
LOG_INFO
,
"TX: %s %s"
,
telnet_cmd_desc
(
cmd
),
telnet_opt_desc
(
opt
));
,
telnet_cmd_desc
(
cmd
),
telnet_opt_desc
(
opt
));
sprintf
(
buf
,
"%c%c%c"
,
TELNET_IAC
,
cmd
,
opt
);
sprintf
(
buf
,
"%c%c%c"
,
TELNET_IAC
,
cmd
,
opt
);
putcom
(
buf
,
3
);
putcom
(
buf
,
3
);
...
@@ -135,7 +136,7 @@ BYTE* telnet_interpret(BYTE* inbuf, int inlen, BYTE* outbuf, int *outlen)
...
@@ -135,7 +136,7 @@ BYTE* telnet_interpret(BYTE* inbuf, int inlen, BYTE* outbuf, int *outlen)
,
TELNET_IAC
,
TELNET_SB
,
TELNET_IAC
,
TELNET_SB
,
TELNET_TERM_TYPE
,
TELNET_TERM_IS
,
TELNET_TERM_TYPE
,
TELNET_TERM_IS
,
TELNET_IAC
,
TELNET_SE
);
,
TELNET_IAC
,
TELNET_SE
);
lprintf
(
LOG_INFO
,
"TX
Telnet command
: Terminal Type is ANSI"
);
lprintf
(
LOG_INFO
,
"TX: Terminal Type is ANSI"
);
putcom
(
buf
,
len
);
putcom
(
buf
,
len
);
request_telnet_opt
(
TELNET_WILL
,
TELNET_NEGOTIATE_WINDOW_SIZE
);
request_telnet_opt
(
TELNET_WILL
,
TELNET_NEGOTIATE_WINDOW_SIZE
);
}
}
...
@@ -147,7 +148,7 @@ BYTE* telnet_interpret(BYTE* inbuf, int inlen, BYTE* outbuf, int *outlen)
...
@@ -147,7 +148,7 @@ BYTE* telnet_interpret(BYTE* inbuf, int inlen, BYTE* outbuf, int *outlen)
}
}
else
if
(
telnet_cmdlen
>=
3
)
{
/* telnet option negotiation */
else
if
(
telnet_cmdlen
>=
3
)
{
/* telnet option negotiation */
lprintf
(
LOG_INFO
,
"RX
Telnet command
: %s %s"
lprintf
(
LOG_INFO
,
"RX: %s %s"
,
telnet_cmd_desc
(
command
),
telnet_opt_desc
(
option
));
,
telnet_cmd_desc
(
command
),
telnet_opt_desc
(
option
));
if
(
command
==
TELNET_DO
||
command
==
TELNET_DONT
)
{
/* local options */
if
(
command
==
TELNET_DO
||
command
==
TELNET_DONT
)
{
/* local options */
...
@@ -179,7 +180,7 @@ BYTE* telnet_interpret(BYTE* inbuf, int inlen, BYTE* outbuf, int *outlen)
...
@@ -179,7 +180,7 @@ BYTE* telnet_interpret(BYTE* inbuf, int inlen, BYTE* outbuf, int *outlen)
buf
[
6
]
=
term
.
height
&
0xff
;
buf
[
6
]
=
term
.
height
&
0xff
;
buf
[
7
]
=
TELNET_IAC
;
buf
[
7
]
=
TELNET_IAC
;
buf
[
8
]
=
TELNET_SE
;
buf
[
8
]
=
TELNET_SE
;
lprintf
(
LOG_INFO
,
"TX
Telnet command
: Window Size is %u x %u"
lprintf
(
LOG_INFO
,
"TX: Window Size is %u x %u"
,
term
.
width
,
term
.
height
);
,
term
.
width
,
term
.
height
);
putcom
(
buf
,
9
);
putcom
(
buf
,
9
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/syncterm/term.c
+
1
−
1
View file @
e13e4957
...
@@ -254,7 +254,7 @@ static int lputs(void* cbdata, int level, const char* str)
...
@@ -254,7 +254,7 @@ static int lputs(void* cbdata, int level, const char* str)
#endif
#endif
if
(
log_fp
!=
NULL
&&
level
<=
log_level
)
if
(
log_fp
!=
NULL
&&
level
<=
log_level
)
fprintf
(
log_fp
,
"%s: %s
\n
"
,
log_levels
[
level
],
str
);
fprintf
(
log_fp
,
"
Xfer
%s: %s
\n
"
,
log_levels
[
level
],
str
);
if
(
level
>
LOG_INFO
)
if
(
level
>
LOG_INFO
)
return
0
;
return
0
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment