+++ /dev/null
-/** @file\r
- Implement the warning and error output messages.\r
-\r
- Copyright (c) 2011, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
- * Copyright (c) 1994 Michael L. Hitch\r
- * All rights reserved.\r
- *\r
- * Redistribution and use in source and binary forms, with or without\r
- * modification, are permitted provided that the following conditions\r
- * are met:\r
- * 1. Redistributions of source code must retain the above copyright\r
- * notice, this list of conditions and the following disclaimer.\r
- * 2. Redistributions in binary form must reproduce the above copyright\r
- * notice, this list of conditions and the following disclaimer in the\r
- * documentation and/or other materials provided with the distribution.\r
- * 3. All advertising materials mentioning features or use of this software\r
- * must display the following acknowledgement:\r
- * This product includes software developed by Michael L. Hitch.\r
- * 4. The name of the author may not be used to endorse or promote products\r
- * derived from this software without specific prior written permission\r
- *\r
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\r
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\r
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\r
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\r
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\r
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
- **/\r
-#include <LibConfig.h>\r
-\r
-#include <stdarg.h>\r
-#include <stdio.h>\r
-#include <errno.h>\r
-#include <string.h>\r
-#include <stdlib.h>\r
-\r
-static void\r
-_Vdomessage(int doerrno, const char *fmt, va_list args)\r
-{\r
- fprintf(stderr, "%s: ", getprogname());\r
- if (fmt) {\r
- vfprintf(stderr, fmt, args);\r
- fprintf(stderr, ": ");\r
- }\r
- if (doerrno && errno < EMAXERRORVAL) {\r
- fprintf(stderr, "%s", strerror(errno));\r
- }\r
- fprintf(stderr, "\n");\r
-}\r
-\r
-void\r
-err(int eval, const char *fmt, ...)\r
-{\r
- va_list ap;\r
- va_start(ap, fmt);\r
- _Vdomessage(1, fmt, ap);\r
- va_end(ap);\r
- exit(eval);\r
-}\r
-\r
-void\r
-errx(int eval, const char *fmt, ...)\r
-{\r
- va_list ap;\r
- va_start(ap, fmt);\r
- _Vdomessage(0, fmt, ap);\r
- va_end(ap);\r
- exit(eval);\r
-}\r
-\r
-void\r
-warn(const char *fmt, ...)\r
-{\r
- va_list ap;\r
- va_start(ap, fmt);\r
- _Vdomessage(1, fmt, ap);\r
- va_end(ap);\r
-}\r
-\r
-void\r
-warnx(const char *fmt, ...)\r
-{\r
- va_list ap;\r
- va_start(ap, fmt);\r
- _Vdomessage(0, fmt, ap);\r
- va_end(ap);\r
-}\r