Working acquire code
[ntk/apt.git] / test / scratch.cc
CommitLineData
024835dc
AL
1#include <apt-pkg/acquire-item.h>
2#include <apt-pkg/init.h>
3#include <apt-pkg/error.h>
0a8a80e5 4#include <signal.h>
93bf083d 5#include <strutl.h>
024835dc 6
93bf083d 7int main(int argc,char *argv[])
024835dc 8{
0a8a80e5 9 signal(SIGPIPE,SIG_IGN);
93bf083d 10
bfd22fc0 11/* URI Foo(argv[1]);
93bf083d
AL
12 cout << Foo.Access << '\'' << endl;
13 cout << Foo.Host << '\'' << endl;
14 cout << Foo.Path << '\'' << endl;
15 cout << Foo.User << '\'' << endl;
16 cout << Foo.Password << '\'' << endl;
17 cout << Foo.Port << endl;
18
bfd22fc0 19 return 0;*/
92e889c8 20
024835dc
AL
21 pkgInitialize(*_config);
22
23 pkgSourceList List;
24 pkgAcquire Fetcher;
25 List.ReadMainList();
26
27 pkgSourceList::const_iterator I;
28 for (I = List.begin(); I != List.end(); I++)
29 {
30 new pkgAcqIndex(&Fetcher,I);
31 if (_error->PendingError() == true)
32 break;
33 }
0a8a80e5
AL
34
35 Fetcher.Run();
024835dc
AL
36
37 _error->DumpErrors();
38}