Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenXG
OpenXG-RAN
Commits
6b3f26f5
Commit
6b3f26f5
authored
Oct 16, 2024
by
Guido Casati
Committed by
Robert Schmidt
Nov 17, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add define to printf and fflush in telnetsrv for real-time logs
parent
4f2fa739
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
+13
-7
common/utils/telnetsrv/telnetsrv.c
common/utils/telnetsrv/telnetsrv.c
+13
-7
No files found.
common/utils/telnetsrv/telnetsrv.c
View file @
6b3f26f5
...
...
@@ -67,6 +67,12 @@ static telnetsrv_params_t telnetparams;
#define TELNETSRV_OPTNAME_STATICMOD "staticmod"
#define TELNETSRV_OPTNAME_SHRMOD "shrmod"
#define TELNET_LOG(fmt, ...) \
do { \
printf("[TELNETSRV] " fmt __VA_OPT__(, ) __VA_ARGS__); \
fflush(stdout); \
} while (0)
// clang-format off
paramdef_t
telnetoptions
[]
=
{
/*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
...
...
@@ -653,10 +659,10 @@ void run_telnetsrv(void) {
using_history
();
int
plen
=
sprintf
(
prompt
,
"%s_%s> "
,
TELNET_PROMPT_PREFIX
,
get_softmodem_function
(
NULL
));
printf
(
"
\n
Initializing telnet server...
\n
"
);
TELNET_LOG
(
"
\n
Initializing telnet server...
\n
"
);
while
(
(
telnetparams
.
new_socket
=
accept
(
sock
,
&
cli_addr
,
&
cli_len
))
)
{
printf
(
"[TELNETSRV]
Telnet client connected....
\n
"
);
TELNET_LOG
(
"
Telnet client connected....
\n
"
);
read_history
(
telnetparams
.
histfile
);
stifle_history
(
telnetparams
.
histsize
);
...
...
@@ -682,12 +688,12 @@ void run_telnetsrv(void) {
}
if
(
!
readc
)
{
printf
(
"[TELNETSRV]
Telnet Client disconnected.
\n
"
);
TELNET_LOG
(
"
Telnet Client disconnected.
\n
"
);
break
;
}
if
(
telnetparams
.
telnetdbg
>
0
)
printf
(
"[TELNETSRV] Command received: readc %i filled %i
\"
%s
\"\n
"
,
readc
,
filled
,
buf
);
TELNET_LOG
(
"Command received: readc %i filled %i
\"
%s
\"\n
"
,
readc
,
filled
,
buf
);
if
(
buf
[
0
]
==
'!'
)
{
if
(
buf
[
1
]
==
'!'
)
{
...
...
@@ -720,7 +726,7 @@ void run_telnetsrv(void) {
send
(
telnetparams
.
new_socket
,
prompt
,
strlen
(
prompt
),
MSG_NOSIGNAL
);
}
else
{
printf
(
"[TELNETSRV]
Closing telnet connection...
\n
"
);
TELNET_LOG
(
"
Closing telnet connection...
\n
"
);
break
;
}
}
...
...
@@ -728,7 +734,7 @@ void run_telnetsrv(void) {
write_history
(
telnetparams
.
histfile
);
clear_history
();
close
(
telnetparams
.
new_socket
);
printf
(
"[TELNETSRV] Telnet server wait
ting for connection...
\n
"
);
TELNET_LOG
(
"Telnet server wai
ting for connection...
\n
"
);
}
close
(
sock
);
...
...
@@ -927,7 +933,7 @@ int add_telnetcmd(char *modulename, telnetshell_vardef_t *var, telnetshell_cmdde
cmd
[
j
].
qptr
=
afifo
;
}
}
printf
(
"[TELNETSRV]
Telnet server: module %i = %s added to shell
\n
"
,
i
,
telnetparams
.
CmdParsers
[
i
].
module
);
TELNET_LOG
(
"
Telnet server: module %i = %s added to shell
\n
"
,
i
,
telnetparams
.
CmdParsers
[
i
].
module
);
break
;
}
}
...
...
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