Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:19

0001 /*  $NetBSD: err.h,v 1.14 2005/02/03 04:39:32 perry Exp $   */
0002 
0003 /*-
0004  * Copyright (c) 1993
0005  *  The Regents of the University of California.  All rights reserved.
0006  *
0007  * Redistribution and use in source and binary forms, with or without
0008  * modification, are permitted provided that the following conditions
0009  * are met:
0010  * 1. Redistributions of source code must retain the above copyright
0011  *    notice, this list of conditions and the following disclaimer.
0012  * 2. Redistributions in binary form must reproduce the above copyright
0013  *    notice, this list of conditions and the following disclaimer in the
0014  *    documentation and/or other materials provided with the distribution.
0015  * 3. Neither the name of the University nor the names of its contributors
0016  *    may be used to endorse or promote products derived from this software
0017  *    without specific prior written permission.
0018  *
0019  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
0020  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0021  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0022  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
0023  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
0024  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
0025  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
0026  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
0027  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
0028  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
0029  * SUCH DAMAGE.
0030  *
0031  *  @(#)err.h   8.1 (Berkeley) 6/2/93
0032  */
0033 
0034 #ifndef _ERR_H_
0035 #define _ERR_H_
0036 
0037 /*
0038  * Don't use va_list in the err/warn prototypes.   Va_list is typedef'd in two
0039  * places (<machine/varargs.h> and <machine/stdarg.h>), so if we include one
0040  * of them here we may collide with the utility's includes.  It's unreasonable
0041  * for utilities to have to include one of them to include err.h, so we get
0042  * _BSD_VA_LIST_ from <machine/ansi.h> and use it.
0043  */
0044 #include <machine/ansi.h>
0045 #include <sys/cdefs.h>
0046 
0047 #include <stdarg.h>
0048 #define _BSD_VA_LIST_ va_list
0049 
0050 #define __dead
0051 
0052 #define err    rtems_shell_err
0053 #define verr   rtems_shell_verr
0054 #define errx   rtems_shell_errx
0055 #define verrx  rtems_shell_verrx
0056 #define warn   rtems_shell_warn
0057 #define vwarn  rtems_shell_vwarn
0058 #define warnx  rtems_shell_warnx
0059 #define vwarnx rtems_shell_vwarnx
0060 
0061 #include <setjmp.h>
0062 #include <rtems.h>
0063 
0064 extern  jmp_buf rtems_shell_bsd_exit_recover;
0065 
0066 __BEGIN_DECLS
0067 __dead void err(jmp_buf*, int, const char *, ...)
0068             __attribute__((__noreturn__, __format__(__printf__, 3, 4)));
0069 __dead void verr(jmp_buf*, int, const char *, _BSD_VA_LIST_)
0070             __attribute__((__noreturn__, __format__(__printf__, 3, 0)));
0071 __dead void errx(jmp_buf*, int, const char *, ...)
0072             __attribute__((__noreturn__, __format__(__printf__, 3, 4)));
0073 __dead void verrx(jmp_buf*, int, const char *, _BSD_VA_LIST_)
0074             __attribute__((__noreturn__, __format__(__printf__, 3, 0)));
0075 void        warn(const char *, ...)
0076             __attribute__((__format__(__printf__, 1, 2)));
0077 void        vwarn(const char *, _BSD_VA_LIST_)
0078             __attribute__((__format__(__printf__, 1, 0)));
0079 void        warnx(const char *, ...)
0080             __attribute__((__format__(__printf__, 1, 2)));
0081 void        vwarnx(const char *, _BSD_VA_LIST_)
0082             __attribute__((__format__(__printf__, 1, 0)));
0083 __END_DECLS
0084 
0085 #endif /* !_ERR_H_ */