Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Firmware
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
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alberto Ruiz Garcia
Firmware
Commits
0da44b71
Commit
0da44b71
authored
8 years ago
by
Beat Küng
Browse files
Options
Downloads
Patches
Plain Diff
posix main: make <data_directory> argument optional, default to CWD
parent
f07cd13f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/platforms/posix/main.cpp
+12
-6
12 additions, 6 deletions
src/platforms/posix/main.cpp
with
12 additions
and
6 deletions
src/platforms/posix/main.cpp
+
12
−
6
View file @
0da44b71
...
...
@@ -231,11 +231,11 @@ static void run_cmd(const vector<string> &appargs, bool exit_on_fail, bool silen
static
void
usage
()
{
cout
<<
"./px4 [-d] data_directory startup_config [-h]"
<<
endl
;
cout
<<
"./px4 [-d]
[
data_directory
]
startup_config [-h]"
<<
endl
;
cout
<<
" -d - Optional flag to run the app in daemon mode and does not listen for user input."
<<
endl
;
cout
<<
" This is needed if px4 is intended to be run as a upstart job on linux"
<<
endl
;
cout
<<
"<data_directory> - directory where
romfs
and posix-configs are located"
<<
endl
;
cout
<<
"<data_directory> - directory where
ROMFS
and posix-configs are located
(if not given, CWD is used)
"
<<
endl
;
cout
<<
"<startup_config> - config file for starting/stopping px4 modules"
<<
endl
;
cout
<<
" -h - help/usage information"
<<
endl
;
}
...
...
@@ -343,23 +343,29 @@ int main(int argc, char **argv)
if
(
positional_arg_count
==
1
)
{
data_path
=
argv
[
index
];
cout
<<
"data path: "
<<
data_path
<<
endl
;
}
else
if
(
positional_arg_count
==
2
)
{
commands_file
=
argv
[
index
];
cout
<<
"commands file: "
<<
commands_file
<<
endl
;
}
}
++
index
;
}
if
(
positional_arg_count
!=
2
)
{
PX4_ERR
(
"Error expected 2 position arguments, got %d"
,
positional_arg_count
);
if
(
positional_arg_count
!=
2
&&
positional_arg_count
!=
1
)
{
PX4_ERR
(
"Error expected
1 or
2 position arguments, got %d"
,
positional_arg_count
);
usage
();
return
-
1
;
}
if
(
positional_arg_count
==
1
)
{
//data path is optional
commands_file
=
data_path
;
data_path
=
"."
;
}
cout
<<
"data path: "
<<
data_path
<<
endl
;
cout
<<
"commands file: "
<<
commands_file
<<
endl
;
if
(
commands_file
.
size
()
<
1
)
{
PX4_ERR
(
"Error commands file not specified"
);
return
-
1
;
...
...
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