Skip to content

Commit 67edbed

Browse files
committed
bin/xbps-alternatives: show usage for extra args in list mode
1 parent 053a545 commit 67edbed

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

bin/xbps-alternatives/main.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,12 @@ main(int argc, char **argv)
330330

331331
if (!list_mode && !set_mode)
332332
usage(true);
333-
else if (argc && list_mode)
334-
pkg = *argv;
333+
else if (argc > 0 && list_mode) {
334+
pkg = *argv++;
335+
argc -= 1;
336+
if (argc > 0)
337+
usage(true);
338+
}
335339

336340
memset(&xh, 0, sizeof(xh));
337341
xh.state_cb = state_cb;

0 commit comments

Comments
 (0)