diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | configure.ac | 10 | ||||
-rw-r--r-- | src/options.c | 34 |
3 files changed, 30 insertions, 20 deletions
@@ -1,5 +1,9 @@ +2004-07-12 Kalle Wallin <kaw@linux.se> + * options.c: fixed short option handling for multiple short options + at once (-abcde) + 2004-07-09 Kalle Wallin <kaw@linux.se> - * ncmpc-0.11.0 released + * ncmpc-0.11.0 released (r1820) 2004-07-08 Kalle Wallin <kaw@linux.se> * doc/keys.sample: Welcome back diff --git a/configure.ac b/configure.ac index c58a6cc4f..e2e0a232e 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ dnl AC_INIT AC_CONFIG_SRCDIR([src/main.c]) -AM_INIT_AUTOMAKE(ncmpc, 0.11.0) +AM_INIT_AUTOMAKE([ncmpc], [0.11.1-svn]) AM_CONFIG_HEADER([config.h]) dnl Check for programs @@ -66,13 +66,13 @@ AC_CHECK_LIB([ncurses], dnl Check for glib-2.4 PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.4], - glib24=yes, - AC_MSG_WARN([glib-2.4 is required for NLS support!])) + [glib24=yes], + [AC_MSG_WARN([glib-2.4 is required for NLS support!])]) if test "x$glib24" != "xyes"; then PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.2], - nls=no, - AC_MSG_ERROR([glib-2.2 is required])) + [nls=no], + [AC_MSG_ERROR([glib-2.2 is required])]) fi diff --git a/src/options.c b/src/options.c index 314a0e98c..94da5b836 100644 --- a/src/options.c +++ b/src/options.c @@ -100,7 +100,7 @@ option_error(int error, char *option, char *arg) fprintf(stderr, PACKAGE ": invalid option %s=%s\n", option, arg); break; case ERROR_MISSING_ARGUMENT: - fprintf(stderr, PACKAGE ": missing value for %s\n", option); + fprintf(stderr, PACKAGE ": missing value for %s option\n", option); break; default: fprintf(stderr, PACKAGE ": internal error %d\n", error); @@ -242,22 +242,28 @@ options_parse(int argc, const char *argv[]) opt = NULL; } } - /* check for a short option */ - else if( len==2 && g_str_has_prefix(arg, "-") ) + /* check for short options */ + else if( len>=2 && g_str_has_prefix(arg, "-") ) { - /* make shure we got an argument for the previous option */ - if( opt && opt->argument ) - option_error(ERROR_MISSING_ARGUMENT, opt->longopt, opt->argument); + int j; - /* check if the option exists */ - if( (opt=lookup_option(arg[1], NULL))==NULL ) - option_error(ERROR_UNKNOWN_OPTION, arg, NULL); - - /* if no option argument is needed execute callback */ - if( opt->argument==NULL ) + for(j=1; j<len; j++) { - option_cb (opt->shortopt, NULL); - opt = NULL; + /* make shure we got an argument for the previous option */ + if( opt && opt->argument ) + option_error(ERROR_MISSING_ARGUMENT, + opt->longopt, opt->argument); + + /* check if the option exists */ + if( (opt=lookup_option(arg[j], NULL))==NULL ) + option_error(ERROR_UNKNOWN_OPTION, arg, NULL); + + /* if no option argument is needed execute callback */ + if( opt->argument==NULL ) + { + option_cb (opt->shortopt, NULL); + opt = NULL; + } } } else |