mirror of
http://mpg123.de/trunk/.git
synced 2025-10-25 04:37:34 +03:00
Fix behaviour on certain command line arguments that only call a handler
function and do neither have a short name, nor an address to store a value to (--cdr, --au). The effect was that on mpg123 --au test.au -n 300 file.bla parsing stopped after test.au and mpg123 tried to open the file "-n". I fail to understand the idea behind the lines in getlopt.c that I disabled. Perhaps one time, Oliver can explain the reasoning to me. git-svn-id: svn://scm.orgis.org/mpg123/trunk@3777 35dc7657-300d-0410-a2e5-dc2837fedb53
This commit is contained in:
3
NEWS
3
NEWS
@@ -36,6 +36,9 @@
|
||||
- Remove spurious Frankenstein warning when scanning files that have no
|
||||
gapless info (the reported value of -1152 gapless sample length should be
|
||||
a giveaway anyway).
|
||||
- Fix a bug in the command line parser that was present from the beginning,
|
||||
apparently, causing certain parameters (--au, --cdr) to kill off parsing
|
||||
of following ones. Nobody complained in all these years. Astounding.
|
||||
|
||||
1.22.4
|
||||
---
|
||||
|
||||
@@ -34,7 +34,7 @@ topt *findopt (int islong, char *opt, topt *opts)
|
||||
return (0);
|
||||
}
|
||||
|
||||
int performoption (int argc, char *argv[], topt *opt)
|
||||
static int performoption (int argc, char *argv[], topt *opt)
|
||||
{
|
||||
int result = GLO_CONTINUE;
|
||||
/* this really is not supposed to happen, so the exit may be justified to create asap ficing pressure */
|
||||
@@ -44,6 +44,8 @@ int performoption (int argc, char *argv[], topt *opt)
|
||||
exit(1); \
|
||||
}
|
||||
|
||||
debug2("performoption on %c / %s"
|
||||
, opt->sname ? opt->sname : '_', opt->lname ? opt->lname : "");
|
||||
if (!(opt->flags & GLO_ARG)) { /* doesn't take argument */
|
||||
if (opt->var) {
|
||||
if (opt->flags & GLO_CHAR) /* var is *char */
|
||||
@@ -66,10 +68,13 @@ int performoption (int argc, char *argv[], topt *opt)
|
||||
|
||||
debug("casting assignment done");
|
||||
}
|
||||
#if 0 /* Oliver: What was this for?! --ThOr */
|
||||
else
|
||||
result = opt->value ? opt->value : opt->sname;
|
||||
#endif
|
||||
}
|
||||
else { /* requires argument */
|
||||
debug("argument required");
|
||||
if (loptind >= argc)
|
||||
return (GLO_NOARG);
|
||||
loptarg = argv[loptind++]+loptchr;
|
||||
@@ -85,11 +90,14 @@ int performoption (int argc, char *argv[], topt *opt)
|
||||
*((double *) opt->var) = atof(loptarg);
|
||||
else prog_error();
|
||||
}
|
||||
#if 0 /* Oliver: What was this for?! --ThOr */
|
||||
else
|
||||
result = opt->value ? opt->value : opt->sname;
|
||||
#endif
|
||||
}
|
||||
if (opt->func)
|
||||
opt->func(loptarg);
|
||||
debug4("result: %i (%p, %i, %i)", result, opt->var, opt->value, opt->sname);
|
||||
return (result);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user