"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "libnetbsd/err.c" between
tnftp-20151004.tar.gz and tnftp-20200705.tar.gz

About: tnftp is an enhanced ftp client (prior name "lukemftp").

err.c  (tnftp-20151004):err.c  (tnftp-20200705)
/* $NetBSD: err.c,v 1.4 2005/05/11 01:01:56 lukem Exp $ */ /* $NetBSD: err.c,v 1.6 2020/07/05 09:54:26 lukem Exp $ */
/* /*
* Copyright 1997-2000 Luke Mewburn <lukem@NetBSD.org>. * Copyright 1997-2000,2020 Luke Mewburn <lukem@NetBSD.org>.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
* 1. Redistributions of source code must retain the above copyright * 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "tnftp.h" #include "tnftp.h"
void void
err(int eval, const char *fmt, ...) err(int eval, const char *fmt, ...)
{ {
va_list ap; va_list ap;
int sverrno; int sverrno;
sverrno = errno; sverrno = errno;
(void)fprintf(stderr, "%s: ", getprogname()); (void)fprintf(stderr, "%s: ", getprogname());
va_start(ap, fmt); va_start(ap, fmt);
if (fmt != NULL) { if (fmt != NULL) {
(void)vfprintf(stderr, fmt, ap); (void)vfprintf(stderr, fmt, ap);
(void)fprintf(stderr, ": "); (void)fprintf(stderr, ": ");
} }
va_end(ap); va_end(ap);
(void)fprintf(stderr, "%s\n", strerror(sverrno)); (void)fprintf(stderr, "%s\n", strerror(sverrno));
exit(eval); exit(eval);
} }
void void
errx(int eval, const char *fmt, ...) errx(int eval, const char *fmt, ...)
{ {
va_list ap; va_list ap;
(void)fprintf(stderr, "%s: ", getprogname()); (void)fprintf(stderr, "%s: ", getprogname());
va_start(ap, fmt); va_start(ap, fmt);
if (fmt != NULL) if (fmt != NULL)
(void)vfprintf(stderr, fmt, ap); (void)vfprintf(stderr, fmt, ap);
va_end(ap); va_end(ap);
(void)fprintf(stderr, "\n"); (void)fprintf(stderr, "\n");
exit(eval); exit(eval);
} }
void void
warn(const char *fmt, ...) warn(const char *fmt, ...)
{ {
va_list ap; va_list ap;
int sverrno; int sverrno;
sverrno = errno; sverrno = errno;
(void)fprintf(stderr, "%s: ", getprogname()); (void)fprintf(stderr, "%s: ", getprogname());
va_start(ap, fmt); va_start(ap, fmt);
if (fmt != NULL) { if (fmt != NULL) {
(void)vfprintf(stderr, fmt, ap); (void)vfprintf(stderr, fmt, ap);
(void)fprintf(stderr, ": "); (void)fprintf(stderr, ": ");
} }
va_end(ap); va_end(ap);
(void)fprintf(stderr, "%s\n", strerror(sverrno)); (void)fprintf(stderr, "%s\n", strerror(sverrno));
} }
void void
warnx(const char *fmt, ...) warnx(const char *fmt, ...)
{ {
va_list ap; va_list ap;
(void)fprintf(stderr, "%s: ", getprogname()); (void)fprintf(stderr, "%s: ", getprogname());
va_start(ap, fmt); va_start(ap, fmt);
if (fmt != NULL) if (fmt != NULL)
(void)vfprintf(stderr, fmt, ap); (void)vfprintf(stderr, fmt, ap);
va_end(ap); va_end(ap);
(void)fprintf(stderr, "\n"); (void)fprintf(stderr, "\n");
} }
 End of changes. 19 change blocks. 
32 lines changed or deleted 30 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)