diff --git a/src/getlopt.c b/src/getlopt.c index 0a37c483..4e773a39 100644 --- a/src/getlopt.c +++ b/src/getlopt.c @@ -9,6 +9,7 @@ * Fri Dec 23, 2005 */ +#include #include "config.h" #include "debug.h" #include "getlopt.h" @@ -48,6 +49,11 @@ topt *findopt (int islong, char *opt, topt *opts) int performoption (int argc, char *argv[], topt *opt) { int result = GLO_CONTINUE; + #define prog_error() \ + { \ + fprintf(stderr, __FILE__ ":%i Option without type flag! This is a programming error! Developer: fix this ASAP to regain your honor.\n", __LINE__); \ + exit(1); \ + } if (!(opt->flags & GLO_ARG)) { /* doesn't take argument */ if (opt->var) { @@ -66,7 +72,7 @@ int performoption (int argc, char *argv[], topt *opt) debug1("int at %p", opt->var); *( (int *) opt->var ) = (int) opt->value; } - else debug("Option without type flag! This is a programming error!"); + else prog_error(); debug("casting assignment done"); } @@ -85,7 +91,7 @@ int performoption (int argc, char *argv[], topt *opt) *((long *) opt->var) = atol(loptarg); else if(opt->flags & GLO_INT) *((int *) opt->var) = atoi(loptarg); - else debug("Option without type flag! This is a programming error!"); + else prog_error(); } else result = opt->value ? opt->value : opt->sname; diff --git a/src/mpg123.c b/src/mpg123.c index c228960e..d5b5a68a 100644 --- a/src/mpg123.c +++ b/src/mpg123.c @@ -510,22 +510,23 @@ topt opts[] = { {'Z', "random", GLO_INT, 0, ¶m.shuffle, 2}, {'E', "equalizer", GLO_ARG | GLO_CHAR, 0, &equalfile,1}, #ifdef HAVE_SETPRIORITY - {0, "aggressive", 0, 0, ¶m.aggressive, 2}, + {0, "aggressive", GLO_INT, 0, ¶m.aggressive, 2}, #endif #ifdef USE_3DNOW - {0, "force-3dnow", 0, 0, ¶m.stat_3dnow,1}, - {0, "no-3dnow", 0, 0, ¶m.stat_3dnow,2}, - {0, "test-3dnow", 0, 0, ¶m.test_3dnow,TRUE}, + {0, "force-3dnow", GLO_INT, 0, ¶m.stat_3dnow, 1}, + {0, "no-3dnow", GLO_INT, 0, ¶m.stat_3dnow, 2}, + {0, "test-3dnow", GLO_INT, 0, ¶m.test_3dnow, TRUE}, #endif #if !defined(WIN32) && !defined(GENERIC) {'u', "auth", GLO_ARG | GLO_CHAR, 0, &httpauth, 0}, #endif #ifdef HAVE_SCHED_SETSCHEDULER - {'T', "realtime", 0, 0, ¶m.realtime, TRUE }, + /* check why this should be a long variable instead of int! */ + {'T', "realtime", GLO_LONG, 0, ¶m.realtime, TRUE }, #else {'T', "realtime", 0, realtime_not_compiled, 0, 0 }, #endif - {0, "title", 0, 0, ¶m.xterm_title, TRUE }, + {0, "title", GLO_INT, 0, ¶m.xterm_title, TRUE }, {'w', "wav", GLO_ARG | GLO_CHAR, set_wav, 0 , 0 }, {0, "cdr", GLO_ARG | GLO_CHAR, set_cdr, 0 , 0 }, {0, "au", GLO_ARG | GLO_CHAR, set_au, 0 , 0 },