ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

err.c
Go to the documentation of this file.
00001 /*-
00002  * Copyright (c) 1993
00003  *  The Regents of the University of California.  All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  * 1. Redistributions of source code must retain the above copyright
00009  *    notice, this list of conditions and the following disclaimer.
00010  * 2. Redistributions in binary form must reproduce the above copyright
00011  *    notice, this list of conditions and the following disclaimer in the
00012  *    documentation and/or other materials provided with the distribution.
00013  * 3. All advertising materials mentioning features or use of this software
00014  *    must display the following acknowledgement:
00015  *  This product includes software developed by the University of
00016  *  California, Berkeley and its contributors.
00017  * 4. Neither the name of the University nor the names of its contributors
00018  *    may be used to endorse or promote products derived from this software
00019  *    without specific prior written permission.
00020  *
00021  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
00022  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00023  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00024  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
00025  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00026  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00027  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00028  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00029  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00030  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00031  * SUCH DAMAGE.
00032  */
00033 
00034 #if defined(LIBC_SCCS) && !defined(lint)
00035 static char sccsid[] = "@(#)err.c   8.1 (Berkeley) 6/4/93";
00036 #endif /* LIBC_SCCS and not lint */
00037 
00038 #include "precomp.h"
00039 
00040 extern char *__progname;        /* Program name, from crt0. */
00041 
00042 void
00043 err(int eval, const char *fmt, ...)
00044 {
00045     va_list ap;
00046     va_start(ap, fmt);
00047     verr(eval, fmt, ap);
00048     va_end(ap);
00049 }
00050 
00051 void
00052 verr(int eval, const char *fmt, va_list ap)
00053 {
00054     int sverrno;
00055 
00056     sverrno = errno;
00057     (void)fprintf(stderr, "%s: ", __progname);
00058     if (fmt != NULL) {
00059         (void)vfprintf(stderr, fmt, ap);
00060         (void)fprintf(stderr, ": ");
00061     }
00062     (void)fprintf(stderr, "%s\n", strerror(sverrno));
00063     exit(eval);
00064 }
00065 
00066 void
00067 errx(int eval, const char *fmt, ...)
00068 {
00069     va_list ap;
00070     va_start(ap, fmt);
00071     verrx(eval, fmt, ap);
00072     va_end(ap);
00073 }
00074 
00075 void
00076 verrx(int eval, const char *fmt, va_list ap)
00077 {
00078     (void)fprintf(stderr, "%s: ", __progname);
00079     if (fmt != NULL)
00080         (void)vfprintf(stderr, fmt, ap);
00081     (void)fprintf(stderr, "\n");
00082     exit(eval);
00083 }
00084 
00085 void
00086 warn(const char *fmt, ...)
00087 {
00088     va_list ap;
00089     va_start(ap, fmt);
00090     vwarn(fmt, ap);
00091     va_end(ap);
00092 }
00093 
00094 void
00095 vwarn(fmt, ap)
00096     const char *fmt;
00097     va_list ap;
00098 {
00099     int sverrno;
00100 
00101     sverrno = errno;
00102     (void)fprintf(stderr, "%s: ", __progname);
00103     if (fmt != NULL) {
00104         (void)vfprintf(stderr, fmt, ap);
00105         (void)fprintf(stderr, ": ");
00106     }
00107     (void)fprintf(stderr, "%s\n", strerror(sverrno));
00108 }
00109 
00110 void
00111 warnx(const char *fmt, ...)
00112 {
00113     va_list ap;
00114     va_start(ap, fmt);
00115     vwarnx(fmt, ap);
00116     va_end(ap);
00117 }
00118 
00119 void
00120 vwarnx(fmt, ap)
00121     const char *fmt;
00122     va_list ap;
00123 {
00124     (void)fprintf(stderr, "%s: ", __progname);
00125     if (fmt != NULL)
00126         (void)vfprintf(stderr, fmt, ap);
00127     (void)fprintf(stderr, "\n");
00128 }

Generated on Fri May 25 2012 04:15:29 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.