summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/contrib')
-rw-r--r--apt-pkg/contrib/configuration.cc13
-rw-r--r--apt-pkg/contrib/fileutl.cc6
-rw-r--r--apt-pkg/contrib/fileutl.h4
-rw-r--r--apt-pkg/contrib/progress.cc32
-rw-r--r--apt-pkg/contrib/progress.h8
5 files changed, 53 insertions, 10 deletions
diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc
index b12fed6be..433b92244 100644
--- a/apt-pkg/contrib/configuration.cc
+++ b/apt-pkg/contrib/configuration.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: configuration.cc,v 1.5 1998/09/26 05:34:26 jgg Exp $
+// $Id: configuration.cc,v 1.6 1998/10/02 04:39:49 jgg Exp $
/* ######################################################################
Configuration Class
@@ -105,6 +105,7 @@ string Configuration::Find(const char *Name,const char *Default)
// Configuration::FindDir - Find a directory /*{{{*/
// ---------------------------------------------------------------------
/* Directories are stored as the base dir in the Parent node and the
+ sub directory in sub nodes
*/
string Configuration::FindDir(const char *Name,const char *Default = 0)
{
@@ -117,8 +118,16 @@ string Configuration::FindDir(const char *Name,const char *Default = 0)
return Default;
}
+ // Absolute path
if (Itm->Value[0] == '/' || Itm->Parent == 0)
return Itm->Value;
+
+ // ./ is also considered absolute as is anything with ~ in it
+ if (Itm->Value[0] != 0 &&
+ ((Itm->Value[0] == '.' && Itm->Value[1] == '/') ||
+ (Itm->Value[0] == '~' && Itm->Value[1] == '/')))
+ return Itm->Value;
+
if (Itm->Parent->Value.end()[-1] == '/')
return Itm->Parent->Value + Itm->Value;
else
@@ -167,7 +176,7 @@ bool Configuration::FindB(const char *Name,bool Default)
strcasecmp(Itm->Value.c_str(),"true") == 0 ||
strcasecmp(Itm->Value.c_str(),"with") == 0 ||
strcasecmp(Itm->Value.c_str(),"enable") == 0)
- return false;
+ return true;
return Default;
}
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index d18f7853e..60b9f8b75 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: fileutl.cc,v 1.7 1998/08/26 04:52:26 jgg Exp $
+// $Id: fileutl.cc,v 1.8 1998/10/02 04:39:50 jgg Exp $
/* ######################################################################
File Utilities
@@ -140,6 +140,10 @@ FileFd::FileFd(string FileName,OpenMode Mode, unsigned long Perms)
case WriteExists:
iFd = open(FileName.c_str(),O_RDWR);
break;
+
+ case WriteAny:
+ iFd = open(FileName.c_str(),O_RDWR | O_CREAT,Perms);
+ break;
// Dont use this in public directories
case LockEmpty:
diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h
index a99d5fee6..c468c95d3 100644
--- a/apt-pkg/contrib/fileutl.h
+++ b/apt-pkg/contrib/fileutl.h
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: fileutl.h,v 1.5 1998/08/26 04:52:27 jgg Exp $
+// $Id: fileutl.h,v 1.6 1998/10/02 04:39:52 jgg Exp $
/* ######################################################################
File Utilities
@@ -38,7 +38,7 @@ class FileFd
string FileName;
public:
- enum OpenMode {ReadOnly,WriteEmpty,WriteExists,LockEmpty};
+ enum OpenMode {ReadOnly,WriteEmpty,WriteExists,WriteAny,LockEmpty};
bool Read(void *To,unsigned long Size);
bool Write(void *From,unsigned long Size);
diff --git a/apt-pkg/contrib/progress.cc b/apt-pkg/contrib/progress.cc
index 9a29c4b66..0f2218f3c 100644
--- a/apt-pkg/contrib/progress.cc
+++ b/apt-pkg/contrib/progress.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: progress.cc,v 1.7 1998/09/07 05:28:38 jgg Exp $
+// $Id: progress.cc,v 1.8 1998/10/02 04:39:53 jgg Exp $
/* ######################################################################
OpProgress - Operation Progress
@@ -13,6 +13,7 @@
#endif
#include <apt-pkg/progress.h>
#include <apt-pkg/error.h>
+#include <apt-pkg/configuration.h>
#include <stdio.h>
/*}}}*/
@@ -108,6 +109,18 @@ bool OpProgress::CheckChange(float Interval)
return true;
}
/*}}}*/
+// OpTextProgress::OpTextProgress - Constructor /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+OpTextProgress::OpTextProgress(Configuration &Config) :
+ NoUpdate(false), NoDisplay(false), LastLen(0)
+{
+ if (Config.FindI("quiet",0) >= 1)
+ NoUpdate = true;
+ if (Config.FindI("quiet",0) >= 2)
+ NoDisplay = true;
+};
+ /*}}}*/
// OpTextProgress::Done - Clean up the display /*{{{*/
// ---------------------------------------------------------------------
/* */
@@ -123,7 +136,13 @@ void OpTextProgress::Done()
Write(S);
cout << endl;
OldOp = string();
- }
+ }
+
+ if (NoUpdate == true && NoDisplay == false && OldOp.empty() == false)
+ {
+ OldOp = string();
+ cout << endl;
+ }
}
/*}}}*/
// OpTextProgress::Update - Simple text spinner /*{{{*/
@@ -139,7 +158,14 @@ void OpTextProgress::Update()
{
if (MajorChange == false)
return;
- cout << Op << endl;
+ if (NoDisplay == false)
+ {
+ if (OldOp.empty() == false)
+ cout << endl;
+ OldOp = "a";
+ cout << Op << "..." << flush;
+ }
+
return;
}
diff --git a/apt-pkg/contrib/progress.h b/apt-pkg/contrib/progress.h
index 554cb16ea..094c4b016 100644
--- a/apt-pkg/contrib/progress.h
+++ b/apt-pkg/contrib/progress.h
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: progress.h,v 1.3 1998/08/26 04:52:29 jgg Exp $
+// $Id: progress.h,v 1.4 1998/10/02 04:39:54 jgg Exp $
/* ######################################################################
OpProgress - Operation Progress
@@ -29,6 +29,7 @@
#include <string>
#include <sys/time.h>
+class Configuration;
class OpProgress
{
unsigned long Current;
@@ -72,6 +73,7 @@ class OpTextProgress : public OpProgress
string OldOp;
bool NoUpdate;
+ bool NoDisplay;
unsigned long LastLen;
virtual void Update();
void Write(const char *S);
@@ -80,7 +82,9 @@ class OpTextProgress : public OpProgress
virtual void Done();
- OpTextProgress(bool NoUpdate = false) : NoUpdate(NoUpdate), LastLen(0) {};
+ OpTextProgress(bool NoUpdate = false) : NoUpdate(NoUpdate),
+ NoDisplay(false), LastLen(0) {};
+ OpTextProgress(Configuration &Config);
virtual ~OpTextProgress() {Done();};
};