mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-01-21 14:25:24 -05:00
provide support for usage()
This commit is contained in:
parent
06782dac3b
commit
650ca42066
1 changed files with 27 additions and 5 deletions
|
|
@ -160,12 +160,26 @@ slapd_opt_slp( const char *val, void *arg )
|
||||||
#endif
|
#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 option_helper {
|
||||||
struct berval oh_name;
|
struct berval oh_name;
|
||||||
int (*oh_fnc)(const char *val, void *arg);
|
int (*oh_fnc)(const char *val, void *arg);
|
||||||
void *oh_arg;
|
void *oh_arg;
|
||||||
|
const char *oh_usage;
|
||||||
} option_helpers[] = {
|
} option_helpers[] = {
|
||||||
{ BER_BVC("slp"), slapd_opt_slp, NULL },
|
{ BER_BVC("slp"), slapd_opt_slp, NULL, "slp[={on|off}] enable/disable SLP" },
|
||||||
{ BER_BVNULL }
|
{ BER_BVNULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -190,10 +204,18 @@ usage( char *name )
|
||||||
"\t-l facility\tSyslog facility (default: LOCAL4)\n"
|
"\t-l facility\tSyslog facility (default: LOCAL4)\n"
|
||||||
#endif
|
#endif
|
||||||
"\t-n serverName\tService name\n"
|
"\t-n serverName\tService name\n"
|
||||||
"\t-o <opt>[=val]\tGeneric means to specify options; supported options:\n"
|
"\t-o <opt>[=val] Generic means to specify options" );
|
||||||
#ifdef HAVE_SLP
|
if ( !BER_BVISNULL( &option_helpers[0].oh_name ) ) {
|
||||||
"\t\t\t\tslp[={on|off}]\n"
|
int i;
|
||||||
#endif
|
|
||||||
|
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
|
#ifdef HAVE_CHROOT
|
||||||
"\t-r directory\tSandbox directory to chroot to\n"
|
"\t-r directory\tSandbox directory to chroot to\n"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue