aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--util/ChangeLog6
-rw-r--r--util/argparse.c35
2 files changed, 25 insertions, 16 deletions
diff --git a/util/ChangeLog b/util/ChangeLog
index c776b17f3..dfe03337b 100644
--- a/util/ChangeLog
+++ b/util/ChangeLog
@@ -1,3 +1,9 @@
+2004-01-13 David Shaw <[email protected]>
+
+ * argparse.c (initialize): Avoid a number of -Wformat-nonliteral
+ warnings. These aren't actual problems, but the warnings bothered
+ me.
+
2004-01-13 David Shaw <[email protected]>
* miscutil.c (print_string2): New variation on print_string that
diff --git a/util/argparse.c b/util/argparse.c
index 4ff0c028a..30b403fd1 100644
--- a/util/argparse.c
+++ b/util/argparse.c
@@ -159,39 +159,42 @@ initialize( ARGPARSE_ARGS *arg, const char *filename, unsigned *lineno )
if( arg->err ) { /* last option was erroneous */
- const char *s;
if( filename ) {
if( arg->r_opt == -6 )
- s = "%s:%u: argument not expected\n";
+ log_error("%s:%u: argument not expected\n", filename, *lineno );
else if( arg->r_opt == -5 )
- s = "%s:%u: read error\n";
+ log_error("%s:%u: read error\n", filename, *lineno );
else if( arg->r_opt == -4 )
- s = "%s:%u: keyword too long\n";
+ log_error("%s:%u: keyword too long\n", filename, *lineno );
else if( arg->r_opt == -3 )
- s = "%s:%u: missing argument\n";
+ log_error("%s:%u: missing argument\n", filename, *lineno );
else if( arg->r_opt == -7 )
- s = "%s:%u: invalid command\n";
+ log_error("%s:%u: invalid command\n", filename, *lineno );
else if( arg->r_opt == -10 )
- s = "%s:%u: invalid alias definition\n";
+ log_error("%s:%u: invalid alias definition\n",filename,*lineno);
else
- s = "%s:%u: invalid option\n";
- log_error(s, filename, *lineno );
+ log_error("%s:%u: invalid option\n", filename, *lineno );
}
else {
if( arg->r_opt == -3 )
- s = "Missing argument for option \"%.50s\"\n";
+ log_error("Missing argument for option \"%.50s\"\n",
+ arg->internal.last? arg->internal.last:"[??]" );
else if( arg->r_opt == -6 )
- s = "Option \"%.50s\" does not expect an argument\n";
+ log_error("Option \"%.50s\" does not expect an argument\n",
+ arg->internal.last? arg->internal.last:"[??]" );
else if( arg->r_opt == -7 )
- s = "Invalid command \"%.50s\"\n";
+ log_error("Invalid command \"%.50s\"\n",
+ arg->internal.last? arg->internal.last:"[??]" );
else if( arg->r_opt == -8 )
- s = "Option \"%.50s\" is ambiguous\n";
+ log_error("Option \"%.50s\" is ambiguous\n",
+ arg->internal.last? arg->internal.last:"[??]" );
else if( arg->r_opt == -9 )
- s = "Command \"%.50s\" is ambiguous\n";
+ log_error("Command \"%.50s\" is ambiguous\n",
+ arg->internal.last? arg->internal.last:"[??]" );
else
- s = "Invalid option \"%.50s\"\n";
- log_error(s, arg->internal.last? arg->internal.last:"[??]" );
+ log_error("Invalid option \"%.50s\"\n",
+ arg->internal.last? arg->internal.last:"[??]" );
}
if( arg->err != 1 || arg->r_opt == -5 )
exit(2);