1 /* $OpenBSD: error.c,v 1.1 2012/07/10 10:28:05 nicm Exp $ */
4 * Copyright (c) 2012 Nicholas Marriott <nicm@openbsd.org>
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
15 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
16 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 #include <sys/types.h>
31 * Once we've configured termios, we need to use \r\n to end lines, so use our
32 * own versions of warn/warnx/err/errx.
35 extern char *__progname
;
38 cu_err(int eval
, const char *fmt
, ...)
49 cu_errx(int eval
, const char *fmt
, ...)
60 cu_warn(const char *fmt
, ...)
64 fprintf(stderr
, "%s: ", __progname
);
67 vfprintf(stderr
, fmt
, ap
);
70 fprintf(stderr
, ": %s\r\n", strerror(errno
));
74 cu_warnx(const char *fmt
, ...)
78 fprintf(stderr
, "%s: ", __progname
);
81 vfprintf(stderr
, fmt
, ap
);
84 fprintf(stderr
, "\r\n");