// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: apt-cdrom.cc,v 1.36 2001/02/20 07:03:17 jgg Exp $
+// $Id: apt-cdrom.cc,v 1.43 2003/04/26 23:26:13 doogie Exp $
/* ######################################################################
APT CDROM - Tool for handling APT's CDROM database.
#include "indexcopy.h"
+#include <locale.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <stdio.h>
/*}}}*/
+using namespace std;
+
// FindPackages - Find the package files on the CDROM /*{{{*/
// ---------------------------------------------------------------------
/* We look over the cdrom for package files. This is a recursive
InfoDir = CD + ".disk/";
}
+ // Don't look into directories that have been marked to ingore.
+ if (stat(".aptignr",&Buf) == 0)
+ return true;
+
/* Aha! We found some package files. We assume that everything under
this dir is controlled by those package files so we don't look down
anymore */
bool DropBinaryArch(vector<string> &List)
{
char S[300];
- sprintf(S,"/binary-%s/",_config->Find("Apt::Architecture").c_str());
+ snprintf(S,sizeof(S),"/binary-%s/",
+ _config->Find("Apt::Architecture").c_str());
for (unsigned int I = 0; I < List.size(); I++)
{
// Score - We compute a 'score' for a path /*{{{*/
// ---------------------------------------------------------------------
/* Paths are scored based on how close they come to what I consider
- normal. That is ones that have 'dist' 'stable' 'frozen' will score
+ normal. That is ones that have 'dist' 'stable' 'testing' will score
higher than ones without. */
int Score(string Path)
{
Res += 29;
if (Path.find("/binary-") != string::npos)
Res += 20;
- if (Path.find("frozen/") != string::npos)
+ if (Path.find("testing/") != string::npos)
Res += 28;
if (Path.find("unstable/") != string::npos)
Res += 27;
// Open the stream for reading
ifstream F((FileExists(File)?File.c_str():"/dev/null"),
- ios::in | ios::nocreate);
+ ios::in );
if (!F != 0)
return _error->Errno("ifstream::ifstream","Opening %s",File.c_str());
{"add",&DoAdd},
{"ident",&DoIdent},
{0,0}};
-
+
+ // Set up gettext support
+ setlocale(LC_ALL,"");
+ textdomain(PACKAGE);
+
// Parse the command line and initialize the package library
CommandLine CmdL(Args,_config);
if (pkgInitConfig(*_config) == false ||