summaryrefslogtreecommitdiff
path: root/ftparchive
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2014-11-08 18:14:46 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2014-11-09 01:26:07 +0100
commitad7e0941b376d792911f240377094a2e78ca8756 (patch)
treea7e65478aa213bd7639cd45e8025989b6d413bfa /ftparchive
parent20801f613690b330c79b4f7a30dc3ff52b722468 (diff)
streamline display of --help in all tools
By convention, if I run a tool with --help or --version I expect it to exit successfully with the usage, while if I do call it wrong (like without any parameters) I expect the usage message shown with a non-zero exit.
Diffstat (limited to 'ftparchive')
-rw-r--r--ftparchive/apt-ftparchive.cc19
-rw-r--r--ftparchive/makefile4
2 files changed, 6 insertions, 17 deletions
diff --git a/ftparchive/apt-ftparchive.cc b/ftparchive/apt-ftparchive.cc
index ebf99a8f8..7d9af4178 100644
--- a/ftparchive/apt-ftparchive.cc
+++ b/ftparchive/apt-ftparchive.cc
@@ -19,6 +19,8 @@
#include <apt-pkg/init.h>
#include <apt-pkg/fileutl.h>
+#include <apt-private/private-cmndline.h>
+
#include <algorithm>
#include <climits>
#include <sys/time.h>
@@ -1060,21 +1062,8 @@ int main(int argc, const char *argv[])
// Parse the command line and initialize the package library
CommandLine CmdL(Args,_config);
- if (pkgInitConfig(*_config) == false || CmdL.Parse(argc,argv) == false)
- {
- _error->DumpErrors();
- return 100;
- }
-
- // See if the help should be shown
- if (_config->FindB("help") == true ||
- _config->FindB("version") == true ||
- CmdL.FileSize() == 0)
- {
- ShowHelp(CmdL);
- return 0;
- }
-
+ ParseCommandLine(CmdL, Cmds, Args, &_config, NULL, argc, argv, ShowHelp);
+
// Setup the output streams
c0out.rdbuf(clog.rdbuf());
c1out.rdbuf(clog.rdbuf());
diff --git a/ftparchive/makefile b/ftparchive/makefile
index d1ffe182a..e67272e1e 100644
--- a/ftparchive/makefile
+++ b/ftparchive/makefile
@@ -9,8 +9,8 @@ include ../buildlib/defaults.mak
ifdef BDBLIB
APT_DOMAIN:=apt-utils
PROGRAM=apt-ftparchive
-SLIBS = -lapt-pkg -lapt-inst $(BDBLIB) $(INTLLIBS)
-LIB_MAKES = apt-pkg/makefile apt-inst/makefile
+SLIBS = -lapt-pkg -lapt-inst -lapt-private $(BDBLIB) $(INTLLIBS)
+LIB_MAKES = apt-pkg/makefile apt-inst/makefile apt-private/makefile
SOURCE = apt-ftparchive.cc cachedb.cc writer.cc contents.cc override.cc \
multicompress.cc sources.cc
include $(PROGRAM_H)