Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
openocd
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
card10
openocd
Commits
ae5732b9
Commit
ae5732b9
authored
15 years ago
by
Zachary T Welch
Browse files
Options
Downloads
Patches
Plain Diff
Add server port command helper function.
parent
653ea7b2
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/server/server.c
+20
-0
20 additions, 0 deletions
src/server/server.c
src/server/server.h
+3
-0
3 additions, 0 deletions
src/server/server.h
with
23 additions
and
0 deletions
src/server/server.c
+
20
−
0
View file @
ae5732b9
...
...
@@ -549,3 +549,23 @@ int handle_shutdown_command(struct command_context_s *cmd_ctx, char *cmd, char *
return
ERROR_COMMAND_CLOSE_CONNECTION
;
}
int
server_port_command
(
struct
command_context_s
*
cmd_ctx
,
char
*
cmd
,
char
**
args
,
int
argc
,
unsigned
short
*
out
)
{
switch
(
argc
)
{
case
0
:
command_print
(
cmd_ctx
,
"%d"
,
*
out
);
break
;
case
1
:
{
uint16_t
port
;
COMMAND_PARSE_NUMBER
(
u16
,
args
[
0
],
port
);
*
out
=
port
;
break
;
}
default:
return
ERROR_INVALID_ARGUMENTS
;
}
return
ERROR_OK
;
}
This diff is collapsed.
Click to expand it.
src/server/server.h
+
3
−
0
View file @
ae5732b9
...
...
@@ -75,6 +75,9 @@ extern int server_quit(void);
extern
int
server_loop
(
command_context_t
*
command_context
);
extern
int
server_register_commands
(
command_context_t
*
context
);
int
server_port_command
(
struct
command_context_s
*
cmd_ctx
,
char
*
cmd
,
char
**
args
,
int
argc
,
unsigned
short
*
port
);
extern
int
server_use_pipes
;
#define ERROR_SERVER_REMOTE_CLOSED (-400)
...
...
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