summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/error.cc
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:50:58 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:50:58 +0000
commitc5162d564ac98a1e97812ec5d290d2375c0820d8 (patch)
tree547a70fd355e85f1fa5d74a1b015e612f905e160 /apt-pkg/contrib/error.cc
parent6f27a7fc6c8471534c5cee39cffdc2def1388bdc (diff)
downloadapt-c5162d564ac98a1e97812ec5d290d2375c0820d8.tar.gz
Sync
Author: jgg Date: 1998-09-18 02:42:38 GMT Sync
Diffstat (limited to 'apt-pkg/contrib/error.cc')
-rw-r--r--apt-pkg/contrib/error.cc28
1 files changed, 27 insertions, 1 deletions
diff --git a/apt-pkg/contrib/error.cc b/apt-pkg/contrib/error.cc
index 42e01e9fe..bbd081d50 100644
--- a/apt-pkg/contrib/error.cc
+++ b/apt-pkg/contrib/error.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: error.cc,v 1.4 1998/09/12 02:46:26 jgg Exp $
+// $Id: error.cc,v 1.5 1998/09/18 02:42:40 jgg Exp $
/* ######################################################################
Global Erorr Class - Global error mechanism
@@ -94,6 +94,32 @@ bool GlobalError::Errno(const char *Function,const char *Description,...)
return false;
}
/*}}}*/
+// GlobalError::WarningE - Get part of the warn string from errno /*{{{*/
+// ---------------------------------------------------------------------
+/* Function indicates the stdlib function that failed and Description is
+ a user string that leads the text. Form is:
+ Description - Function (errno: strerror)
+ Carefull of the buffer overrun, sprintf.
+ */
+bool GlobalError::WarningE(const char *Function,const char *Description,...)
+{
+ va_list args;
+ va_start(args,Description);
+
+ // sprintf the description
+ char S[400];
+ vsprintf(S,Description,args);
+ sprintf(S + strlen(S)," - %s (%i %s)",Function,errno,strerror(errno));
+
+ // Put it on the list
+ Item *Itm = new Item;
+ Itm->Text = S;
+ Itm->Error = false;
+ Insert(Itm);
+
+ return false;
+}
+ /*}}}*/
// GlobalError::Error - Add an error to the list /*{{{*/
// ---------------------------------------------------------------------
/* Just vsprintfs and pushes */