Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
OpenLDAP
Manage
Activity
Members
Labels
Plan
Wiki
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
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
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
Dimitar Stoychev
OpenLDAP
Commits
650ca420
Commit
650ca420
authored
20 years ago
by
Pierangelo Masarati
Browse files
Options
Downloads
Patches
Plain Diff
provide support for usage()
parent
06782dac
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
servers/slapd/main.c
+27
-5
27 additions, 5 deletions
servers/slapd/main.c
with
27 additions
and
5 deletions
servers/slapd/main.c
+
27
−
5
View file @
650ca420
...
...
@@ -160,12 +160,26 @@ slapd_opt_slp( const char *val, void *arg )
#endif
}
/*
* Option helper structure:
*
* oh_nam is left-hand part of <option>[=<value>]
* oh_fnc is handler function
* oh_arg is an optional arg to oh_fnc
* oh_usage is the one-line usage string related to the option,
* which is assumed to start with <option>[=<value>]
*
* please leave valid options in the structure, and optionally #ifdef
* their processing inside the helper, so that reasonable and helpful
* error messages can be generated if a disabled option is requested.
*/
struct
option_helper
{
struct
berval
oh_name
;
int
(
*
oh_fnc
)(
const
char
*
val
,
void
*
arg
);
void
*
oh_arg
;
const
char
*
oh_usage
;
}
option_helpers
[]
=
{
{
BER_BVC
(
"slp"
),
slapd_opt_slp
,
NULL
},
{
BER_BVC
(
"slp"
),
slapd_opt_slp
,
NULL
,
"slp[={on|off}] enable/disable SLP"
},
{
BER_BVNULL
}
};
...
...
@@ -190,10 +204,18 @@ usage( char *name )
"
\t
-l facility
\t
Syslog facility (default: LOCAL4)
\n
"
#endif
"
\t
-n serverName
\t
Service name
\n
"
"
\t
-o <opt>[=val]
\t
Generic means to specify options; supported options:
\n
"
#ifdef HAVE_SLP
"
\t\t\t\t
slp[={on|off}]
\n
"
#endif
"
\t
-o <opt>[=val] Generic means to specify options"
);
if
(
!
BER_BVISNULL
(
&
option_helpers
[
0
].
oh_name
)
)
{
int
i
;
fprintf
(
stderr
,
"; supported options:
\n
"
);
for
(
i
=
0
;
!
BER_BVISNULL
(
&
option_helpers
[
i
].
oh_name
);
i
++
)
{
fprintf
(
stderr
,
"
\t\t
%s
\n
"
,
option_helpers
[
i
].
oh_usage
);
}
}
else
{
fprintf
(
stderr
,
"
\n
"
);
}
fprintf
(
stderr
,
#ifdef HAVE_CHROOT
"
\t
-r directory
\t
Sandbox directory to chroot to
\n
"
#endif
...
...
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