]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
added a xstrerr(errno) function, to be used when the errno value is known
authorhno <>
Mon, 3 Mar 2003 05:20:31 +0000 (05:20 +0000)
committerhno <>
Mon, 3 Mar 2003 05:20:31 +0000 (05:20 +0000)
and not taken from errno

include/util.h
lib/util.c

index 5239d1a365a99e151b600aa5a95b32111404a44d..73a5be55a075c6758ac9b1f98d4e25ca43bec634 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: util.h,v 1.69 2003/02/02 22:04:13 robertc Exp $
+ * $Id: util.h,v 1.70 2003/03/02 22:20:31 hno Exp $
  *
  * AUTHOR: Harvest Derived
  *
@@ -71,6 +71,7 @@ SQUIDCEXTERN const char *mkrfc1123(time_t);
 SQUIDCEXTERN char *uudecode(const char *);
 SQUIDCEXTERN char *xstrdup(const char *);
 SQUIDCEXTERN char *xstrndup(const char *, size_t);
+SQUIDCEXTERN const char *xstrerr(int xerrno);
 SQUIDCEXTERN const char *xstrerror(void);
 SQUIDCEXTERN int tvSubMsec(struct timeval, struct timeval);
 SQUIDCEXTERN int tvSubUsec(struct timeval, struct timeval);
index c56f4f31e194b84083f436a62f0ac9e3ba41fd61..0c8467707c5ab29e6ef382e52e0088870f6fdf64 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: util.c,v 1.89 2003/01/23 00:37:02 robertc Exp $
+ * $Id: util.c,v 1.90 2003/03/02 22:20:31 hno Exp $
  *
  * DEBUG: 
  * AUTHOR: Harvest Derived
@@ -645,20 +645,26 @@ xstrndup(const char *s, size_t n)
  * xstrerror() - strerror() wrapper
  */
 const char *
-xstrerror(void)
+xstrerr(int error)
 {
     static char xstrerror_buf[BUFSIZ];
     static char strerror_buf[BUFSIZ];
 
-    snprintf(strerror_buf, BUFSIZ, "%s", strerror(errno));
+    snprintf(strerror_buf, BUFSIZ, "%s", strerror(error));
 
     if (strerror_buf)
-       snprintf(xstrerror_buf, BUFSIZ, "(%d) %s", errno, strerror_buf);
+       snprintf(xstrerror_buf, BUFSIZ, "(%d) %s", error, strerror_buf);
     else
-       snprintf(xstrerror_buf, BUFSIZ, "(%d) Unknown", errno);
+       snprintf(xstrerror_buf, BUFSIZ, "(%d) Unknown", error);
     return xstrerror_buf;
 }
 
+const char *
+xstrerror(void)
+{
+    return xstrerr(errno);
+}
+
 void
 Tolower(char *q)
 {