Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dhtnet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
dhtnet
Commits
77bb5858
Commit
77bb5858
authored
1 year ago
by
Amna Snene
Browse files
Options
Downloads
Patches
Plain Diff
tools: fix dsh argument
Change-Id: I1093d16dbfaf13cf0d36961a2b94d7c89e7650fe
parent
7c973d53
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/dsh/main.cpp
+21
-3
21 additions, 3 deletions
tools/dsh/main.cpp
with
21 additions
and
3 deletions
tools/dsh/main.cpp
+
21
−
3
View file @
77bb5858
...
...
@@ -54,7 +54,7 @@ parse_args(int argc, char** argv)
{
dhtsh_params
params
;
int
opt
;
while
((
opt
=
getopt_long
(
argc
,
argv
,
"hvlsI:p:i:"
,
long_options
,
nullptr
))
!=
-
1
)
{
while
((
opt
=
getopt_long
(
argc
,
argv
,
"hvls
:
I:p:i:"
,
long_options
,
nullptr
))
!=
-
1
)
{
switch
(
opt
)
{
case
'h'
:
params
.
help
=
true
;
...
...
@@ -81,7 +81,7 @@ parse_args(int argc, char** argv)
}
// If not listening, the peer_id argument is required
if
(
!
params
.
listen
)
{
if
(
!
params
.
listen
&&
!
params
.
help
&&
!
params
.
version
)
{
if
(
optind
<
argc
)
{
params
.
peer_id
=
dht
::
InfoHash
(
argv
[
optind
]);
optind
++
;
// Move to the next argument
...
...
@@ -122,9 +122,27 @@ setSipLogLevel()
int
main
(
int
argc
,
char
**
argv
)
{
fmt
::
print
(
"DSH 1.0
\n
"
);
setSipLogLevel
();
auto
params
=
parse_args
(
argc
,
argv
);
if
(
params
.
help
){
fmt
::
print
(
"Usage: dsh [OPTIONS] [PEER_ID]
\n
"
"
\n
Options:
\n
"
" -h, --help Show this help message and exit.
\n
"
" -v, --version Display the program version.
\n
"
" -l, --listen Start the program in listen mode.
\n
"
" -b, --bootstrap Specify the bootstrap option with an argument.
\n
"
" -s, --binary Specify the binary option with an argument.
\n
"
" -I, --id_path Specify the id_path option with an argument.
\n
"
);
return
EXIT_SUCCESS
;
}
if
(
params
.
version
){
fmt
::
print
(
"dsh v1.0
\n
"
);
return
EXIT_SUCCESS
;
}
fmt
::
print
(
"dsh 1.0
\n
"
);
auto
identity
=
dhtnet
::
loadIdentity
(
params
.
path
);
fmt
::
print
(
"Loaded identity: {} from {}
\n
"
,
identity
.
second
->
getId
(),
params
.
path
);
...
...
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