Message ID | 20180209044908.22901-2-iff@escondida.tk |
---|---|
State | Superseded, archived |
Delegated to: | Andrew Gregory |
Headers | show |
Series | Miscellaneous pacman-conf tweaks | expand |
On 02/08/2018 11:49 PM, iff@escondida.tk wrote: > From: Ivy Foster <iff@escondida.tk> > > Also change '-?' no longer to be an error, because if we're going to > check for it anyway, why make it an error? Hmm, why are we checking for it at all? I see no reason to treat it differently from any other unknown option, and I *just* removed the undocumented --usage variant from vercmp as I think [-h|--help] is more than enough for everyone and everything. Can we just remove '-?' altogether? We don't use it anywhere else, --help is pretty standard, and I feel like '-?' will just be confusing and possibly too Windows'y to boot.
On 02/08/18 at 10:49pm, iff@escondida.tk wrote: > From: Ivy Foster <iff@escondida.tk> > > Also change '-?' no longer to be an error, because if we're going to > check for it anyway, why make it an error? Because '?' indicates an error.
diff --git a/src/pacman/pacman-conf.c b/src/pacman/pacman-conf.c index 1e6f55f9..5347a837 100644 --- a/src/pacman/pacman-conf.c +++ b/src/pacman/pacman-conf.c @@ -59,7 +59,7 @@ static void parse_opts(int argc, char **argv) int c; config_file = CONFFILE; - const char *short_opts = ""; + const char *short_opts = "c:hlR:r:Vv?"; struct option long_opts[] = { { "config" , required_argument , NULL , 'c' }, { "rootdir" , required_argument , NULL , 'R' }, @@ -89,6 +89,7 @@ static void parse_opts(int argc, char **argv) verbose = 1; break; case 'h': + case '?': usage(0); break; case 'V': @@ -96,7 +97,6 @@ static void parse_opts(int argc, char **argv) cleanup(); exit(0); break; - case '?': default: usage(1); break;