pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/libnbcompat/files add v{err,warn}{,x}.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/910ff62c9481
branches:  trunk
changeset: 461373:910ff62c9481
user:      grant <grant%pkgsrc.org@localhost>
date:      Mon Sep 15 07:39:34 2003 +0000

description:
add v{err,warn}{,x}.

diffstat:

 pkgtools/libnbcompat/files/err.c |  60 +++++++++++++++++++++++++++++++++++++++-
 1 files changed, 59 insertions(+), 1 deletions(-)

diffs (78 lines):

diff -r 93ae46bf1aa6 -r 910ff62c9481 pkgtools/libnbcompat/files/err.c
--- a/pkgtools/libnbcompat/files/err.c  Mon Sep 15 05:33:41 2003 +0000
+++ b/pkgtools/libnbcompat/files/err.c  Mon Sep 15 07:39:34 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: err.c,v 1.2 2003/09/06 23:03:01 grant Exp $    */
+/*     $NetBSD: err.c,v 1.3 2003/09/15 07:39:34 grant Exp $    */
 
 /*
  * Copyright 1997-2000 Luke Mewburn <lukem%netbsd.org@localhost>.
@@ -62,6 +62,37 @@
 }
 
 void
+verr(eval, fmt, ap)
+       int eval;
+       const char *fmt;
+       va_list ap;
+{
+       int sverrno;
+
+       sverrno = errno;
+       (void)fprintf(stderr, "%s: ", getprogname());
+       if (fmt != NULL) {
+               (void)vfprintf(stderr, fmt, ap);
+               (void)fprintf(stderr, ": ");
+       }
+       (void)fprintf(stderr, "%s\n", strerror(sverrno));
+       exit(eval);
+}
+
+void
+verrx(eval, fmt, ap)
+       int eval;
+       const char *fmt;
+       va_list ap;
+{
+       (void)fprintf(stderr, "%s: ", getprogname());
+       if (fmt != NULL)
+               (void)vfprintf(stderr, fmt, ap);
+       (void)fprintf(stderr, "\n");
+       exit(eval);
+}
+
+void
 warn(const char *fmt, ...)
 {
        va_list ap;
@@ -90,3 +121,30 @@
        va_end(ap);
         (void)fprintf(stderr, "\n");
 }
+
+void
+vwarn(fmt, ap)
+       const char *fmt;
+       va_list ap;
+{
+       int sverrno;
+
+       sverrno = errno;
+       (void)fprintf(stderr, "%s: ", getprogname());
+       if (fmt != NULL) {
+               (void)vfprintf(stderr, fmt, ap);
+               (void)fprintf(stderr, ": ");
+       }
+       (void)fprintf(stderr, "%s\n", strerror(sverrno));
+}
+
+void
+vwarnx(fmt, ap)
+       const char *fmt;
+       va_list ap;
+{
+       (void)fprintf(stderr, "%s: ", getprogname());
+       if (fmt != NULL)
+               (void)vfprintf(stderr, fmt, ap);
+       (void)fprintf(stderr, "\n");
+}



Home | Main Index | Thread Index | Old Index