summaryrefslogtreecommitdiff
path: root/cmdline
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:50:59 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:50:59 +0000
commit08e8f724674eb96678dcabf856534c58f5c29996 (patch)
treef8cde76f1af140aa9d0536ea062d6e1fd0379c98 /cmdline
parentc5162d564ac98a1e97812ec5d290d2375c0820d8 (diff)
Sync
Author: jgg Date: 1998-09-22 05:30:24 GMT Sync
Diffstat (limited to 'cmdline')
-rw-r--r--cmdline/apt-cache.cc23
-rw-r--r--cmdline/makefile9
2 files changed, 24 insertions, 8 deletions
diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc
index 4d0a076a8..85405941e 100644
--- a/cmdline/apt-cache.cc
+++ b/cmdline/apt-cache.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: apt-cache.cc,v 1.6 1998/07/26 23:11:56 jgg Exp $
+// $Id: apt-cache.cc,v 1.7 1998/09/22 05:30:30 jgg Exp $
/* ######################################################################
apt-cache - Manages the cache file.
@@ -30,6 +30,7 @@
#include <apt-pkg/init.h>
#include <apt-pkg/progress.h>
#include <apt-pkg/sourcelist.h>
+#include <apt-pkg/cmndline.h>
#include <iostream.h>
#include <fstream.h>
@@ -70,7 +71,7 @@ bool SplitArg(const char *Arg,string &File,string &Dist,string Ver)
// DumpPackage - Show a dump of a package record /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool DumpPackage(pkgCache &Cache,int argc,char *argv[])
+bool DumpPackage(pkgCache &Cache,int argc,const char *argv[])
{
for (int I = 0; I != argc; I++)
{
@@ -255,7 +256,7 @@ bool DumpAvail(pkgCache &Cache)
// DoAdd - Perform an adding operation /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool DoAdd(int argc,char *argv[])
+bool DoAdd(int argc,const char *argv[])
{
string FileName;
string Dist;
@@ -312,8 +313,21 @@ bool GenCaches()
}
/*}}}*/
-int main(int argc, char *argv[])
+int main(int argc,const char *argv[])
{
+ CommandLine::Args Args[] = {
+ {'h',"help","help",0},
+ {0,0,0,0}};
+
+ CommandLine Cmds(Args,_config);
+ if (pkgInitialize(*_config) == false ||
+ Cmds.Parse(argc,argv) == false)
+ {
+ _error->DumpErrors();
+ return 100;
+ }
+ cout << _config->Find("help") << endl;
+
// Check arguments.
if (argc < 3)
{
@@ -321,7 +335,6 @@ int main(int argc, char *argv[])
return 100;
}
- pkgInitialize(*_config);
while (1)
{
CacheFile = argv[2];
diff --git a/cmdline/makefile b/cmdline/makefile
index 2dd10d6bc..bbe1f5e46 100644
--- a/cmdline/makefile
+++ b/cmdline/makefile
@@ -5,11 +5,14 @@ SUBDIR=cmdline
# Bring in the default rules
include ../buildlib/defaults.mak
-# The library name
+# The apt-cache program
PROGRAM=apt-cache
SLIBS = -lapt-pkg
-
-# Source code for the contributed non-core things
SOURCE = apt-cache.cc
+include $(PROGRAM_H)
+# The apt-config program
+PROGRAM=apt-config
+SLIBS = -lapt-pkg
+SOURCE = apt-config.cc
include $(PROGRAM_H)