]>
git.proxmox.com Git - mirror_edk2.git/blob - StdLib/PosixLib/Err/warn_err.c
2 Implement the warning and error output messages.
4 Copyright (c) 2011, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 * Copyright (c) 1994 Michael L. Hitch
14 * All rights reserved.
16 * Redistribution and use in source and binary forms, with or without
17 * modification, are permitted provided that the following conditions
19 * 1. Redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer.
21 * 2. Redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution.
24 * 3. All advertising materials mentioning features or use of this software
25 * must display the following acknowledgement:
26 * This product includes software developed by Michael L. Hitch.
27 * 4. The name of the author may not be used to endorse or promote products
28 * derived from this software without specific prior written permission
30 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
31 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
32 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
33 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
34 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
35 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
39 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 #include <LibConfig.h>
50 _Vdomessage(int doerrno
, const char *fmt
, va_list args
)
52 fprintf(stderr
, "%s: ", getprogname());
54 vfprintf(stderr
, fmt
, args
);
55 fprintf(stderr
, ": ");
57 if (doerrno
&& errno
< EMAXERRORVAL
) {
58 fprintf(stderr
, "%s", strerror(errno
));
60 fprintf(stderr
, "\n");
64 err(int eval
, const char *fmt
, ...)
68 _Vdomessage(1, fmt
, ap
);
74 errx(int eval
, const char *fmt
, ...)
78 _Vdomessage(0, fmt
, ap
);
84 warn(const char *fmt
, ...)
88 _Vdomessage(1, fmt
, ap
);
93 warnx(const char *fmt
, ...)
97 _Vdomessage(0, fmt
, ap
);