- {
- File CacheF("./cache",File::WriteExists);
- MMap Map(CacheF,MMap::Public | MMap::ReadOnly);
- pkgCache Cache(Map);
- for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
- {
- cout << "Package: " << I.Name() << endl;
- for (pkgCache::VerIterator V = I.VersionList(); V.end() == false; V++)
- {
- cout << "Version: " << V.VerStr() << endl;
- cout << "Size: " << V->Size << endl;
- cout << "Installed-Size: " << V->InstalledSize << endl;
- cout << "Section: " << V.Section() << endl;
- cout << "Priority: " << Cache.Priority(V->Priority) << endl;
- }
- cout << endl;
- }
- }
+ // Copy it into a temp buffer so we can use strtol
+ char S[300];
+ if ((unsigned)(Stop - Start) >= sizeof(S))
+ return Default;
+ strncpy(S,Start,Stop-Start);
+ S[Stop - Start] = 0;