Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
etherlabmaster
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
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
Code review analytics
Issue 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
ICS Control System Infrastructure
etherlabmaster
Commits
4a3b8090
Commit
4a3b8090
authored
16 years ago
by
Florian Pose
Browse files
Options
Downloads
Patches
Plain Diff
helpWanted; cmdName.
parent
cbb1ce3e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/main.cpp
+20
-7
20 additions, 7 deletions
tools/main.cpp
with
20 additions
and
7 deletions
tools/main.cpp
+
20
−
7
View file @
4a3b8090
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
****************************************************************************/
****************************************************************************/
#include
<getopt.h>
#include
<getopt.h>
#include
<libgen.h>
// basename()
#include
<iostream>
#include
<iostream>
#include
<string>
#include
<string>
...
@@ -17,6 +18,7 @@ using namespace std;
...
@@ -17,6 +18,7 @@ using namespace std;
#define DEFAULT_MASTER 0
#define DEFAULT_MASTER 0
static
string
cmdName
;
static
unsigned
int
masterIndex
=
DEFAULT_MASTER
;
static
unsigned
int
masterIndex
=
DEFAULT_MASTER
;
static
int
slavePosition
=
-
1
;
static
int
slavePosition
=
-
1
;
static
int
domainIndex
=
-
1
;
static
int
domainIndex
=
-
1
;
...
@@ -25,13 +27,14 @@ vector<string> commandArgs;
...
@@ -25,13 +27,14 @@ vector<string> commandArgs;
static
Master
::
Verbosity
verbosity
=
Master
::
Normal
;
static
Master
::
Verbosity
verbosity
=
Master
::
Normal
;
string
dataTypeStr
;
string
dataTypeStr
;
bool
force
=
false
;
bool
force
=
false
;
bool
helpWanted
=
false
;
/*****************************************************************************/
/*****************************************************************************/
void
printUsage
()
void
printUsage
()
{
{
cerr
cerr
<<
"Usage:
ethercat
<COMMAND> [OPTIONS]"
<<
endl
<<
"Usage:
"
<<
cmdName
<<
"
<COMMAND> [OPTIONS]"
<<
endl
<<
"Commands:"
<<
endl
<<
"Commands:"
<<
endl
<<
" alias Write alias addresses."
<<
endl
<<
" alias Write alias addresses."
<<
endl
<<
" config Show bus configuration."
<<
endl
<<
" config Show bus configuration."
<<
endl
...
@@ -63,7 +66,10 @@ void printUsage()
...
@@ -63,7 +66,10 @@ void printUsage()
<<
" --force -f Force action."
<<
endl
<<
" --force -f Force action."
<<
endl
<<
" --quiet -q Output less information."
<<
endl
<<
" --quiet -q Output less information."
<<
endl
<<
" --verbose -v Output more information."
<<
endl
<<
" --verbose -v Output more information."
<<
endl
<<
" --help -h Show this help."
<<
endl
;
<<
" --help -h Show this help."
<<
endl
<<
"Call '"
<<
cmdName
<<
" <COMMAND> --help' for command-specific "
<<
"help."
<<
endl
<<
"Send bug reports to "
<<
PACKAGE_BUGREPORT
<<
"."
<<
endl
;
}
}
/*****************************************************************************/
/*****************************************************************************/
...
@@ -148,9 +154,12 @@ void getOptions(int argc, char **argv)
...
@@ -148,9 +154,12 @@ void getOptions(int argc, char **argv)
break
;
break
;
case
'h'
:
case
'h'
:
helpWanted
=
true
;
break
;
case
'?'
:
case
'?'
:
printUsage
();
printUsage
();
exit
(
0
);
exit
(
1
);
default
:
default
:
break
;
break
;
...
@@ -160,10 +169,12 @@ void getOptions(int argc, char **argv)
...
@@ -160,10 +169,12 @@ void getOptions(int argc, char **argv)
argCount
=
argc
-
optind
;
argCount
=
argc
-
optind
;
if
(
!
argCount
)
{
if
(
!
argCount
)
{
cerr
<<
"Please specify a command!"
<<
endl
;
if
(
!
helpWanted
)
{
printUsage
();
cerr
<<
"Please specify a command!"
<<
endl
;
exit
(
1
);
}
printUsage
();
exit
(
!
helpWanted
);
}
}
command
=
argv
[
optind
];
command
=
argv
[
optind
];
...
@@ -176,6 +187,8 @@ void getOptions(int argc, char **argv)
...
@@ -176,6 +187,8 @@ void getOptions(int argc, char **argv)
int
main
(
int
argc
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
{
Master
master
;
Master
master
;
cmdName
=
basename
(
argv
[
0
]);
getOptions
(
argc
,
argv
);
getOptions
(
argc
,
argv
);
...
...
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