aboutsummaryrefslogtreecommitdiffstats
path: root/util/argparse.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>1999-11-19 16:11:37 +0000
committerWerner Koch <[email protected]>1999-11-19 16:11:37 +0000
commit2694bceb45f71b7808aec66f30d8ee720a92eb67 (patch)
tree358ee56c220c853334ec604d653c3483be72ff2f /util/argparse.c
parentSee ChangeLog: Mon Nov 15 21:36:02 CET 1999 Werner Koch (diff)
downloadgnupg-2694bceb45f71b7808aec66f30d8ee720a92eb67.tar.gz
gnupg-2694bceb45f71b7808aec66f30d8ee720a92eb67.zip
See ChangeLog: Fri Nov 19 17:15:20 CET 1999 Werner Koch
Diffstat (limited to 'util/argparse.c')
-rw-r--r--util/argparse.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/util/argparse.c b/util/argparse.c
index c6f405f62..12b0ebd7f 100644
--- a/util/argparse.c
+++ b/util/argparse.c
@@ -135,10 +135,13 @@ struct alias_def_s {
const char *value; /* ptr into name */
};
+static const char *(*strusage_handler)( int ) = NULL;
+
static int set_opt_arg(ARGPARSE_ARGS *arg, unsigned flags, char *s);
static void show_help(ARGPARSE_OPTS *opts, unsigned flags);
static void show_version(void);
+
static void
initialize( ARGPARSE_ARGS *arg, const char *filename, unsigned *lineno )
{
@@ -886,9 +889,13 @@ usage( int level )
* 41: long usage note (with LF)
*/
const char *
-default_strusage( int level )
+strusage( int level )
{
- const char *p = NULL;
+ const char *p = strusage_handler? strusage_handler(level) : NULL;
+
+ if( p )
+ return p;
+
switch( level ) {
case 11: p = "foo"; break;
case 13: p = "0.0"; break;
@@ -917,6 +924,11 @@ default_strusage( int level )
return p;
}
+void
+set_strusage( const char *(*f)( int ) )
+{
+ strusage_handler = f;
+}
#ifdef TEST