# 2.11BSD#431 - /usr/src/lib/libc/gen/err.c

##### Functions

    err               X
    errx              X
    verr              X
    verrx             X
    vwarn             X
    vwarnx            X
    warn              X
    warnx             X

       1: /*-
       2:  * Copyright (c) 1993
       3:  *	The Regents of the University of California.  All rights reserved.
       4:  *
       5:  * Redistribution and use in source and binary forms, with or without
       6:  * modification, are permitted provided that the following conditions
       7:  * are met:
       8:  * 1. Redistributions of source code must retain the above copyright
       9:  *    notice, this list of conditions and the following disclaimer.
      10:  * 2. Redistributions in binary form must reproduce the above copyright
      11:  *    notice, this list of conditions and the following disclaimer in the
      12:  *    documentation and/or other materials provided with the distribution.
      13:  * 3. All advertising materials mentioning features or use of this software
      14:  *    must display the following acknowledgement:
      15:  *	This product includes software developed by the University of
      16:  *	California, Berkeley and its contributors.
      17:  * 4. Neither the name of the University nor the names of its contributors
      18:  *    may be used to endorse or promote products derived from this software
      19:  *    without specific prior written permission.
      20:  *
      21:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
      22:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
      23:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
      24:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
      25:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
      26:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
      27:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
      28:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
      29:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
      30:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
      31:  * SUCH DAMAGE.
      32:  */
      33:
      34: #if defined(LIBC_SCCS) && !defined(lint)
      35: static char sccsid[] = "@(#)err.c	8.1.1 (2.11BSD GTE) 2/3/95";
      36: #endif /* LIBC_SCCS and not lint */
      37:
      38: #include <stdio.h>
      39:
      40: #ifdef __STDC__
      41: #include <stdarg.h>
      42: #else
      43: #include <varargs.h>
      44: #endif
      45:
      46: extern  int errno;
      47: extern  char *__progname;       /* Program name, from crt0. */
      48: static  void    putprog(), putcolsp();
      49:
      50: void
      51: #ifdef __STDC__
      52: err(int eval, const char *fmt, ...)
      53: #else
      54: err(eval, fmt, va_alist)
      55:     int eval;
      56:     char *fmt;
      57:     va_dcl
      58: #endif
      59: {
      60:     va_list ap;
      61: #if __STDC__
      62:     va_start(ap, fmt);
      63: #else
      64:     va_start(ap);
      65: #endif
      66:     verr(eval, fmt, ap);
      67:     va_end(ap);
      68: }
      69:
      70: void
      71: verr(eval, fmt, ap)
      72:     int eval;
      73:     char *fmt;
      74:     va_list ap;
      75: {
      76:     int sverrno;
      77:
      78:     sverrno = errno;
      79:     putprog();
      80:     if (fmt != NULL) {
      81:         (void)vfprintf(stderr, fmt, ap);
      82:         putcolsp();
      83:     }
      84:     (void)fputs(strerror(sverrno), stderr);
      85:     (void)fputc('\n', stderr);
      86:     exit(eval);
      87: }
      88:
      89: void
      90: #if __STDC__
      91: errx(int eval, const char *fmt, ...)
      92: #else
      93: errx(eval, fmt, va_alist)
      94:     int eval;
      95:     char *fmt;
      96:     va_dcl
      97: #endif
      98: {
      99:     va_list ap;
     100: #if __STDC__
     101:     va_start(ap, fmt);
     102: #else
     103:     va_start(ap);
     104: #endif
     105:     verrx(eval, fmt, ap);
     106:     va_end(ap);
     107: }
     108:
     109: void
     110: verrx(eval, fmt, ap)
     111:     int eval;
     112:     char *fmt;
     113:     va_list ap;
     114: {
     115:     putprog();
     116:     if (fmt != NULL)
     117:         (void)vfprintf(stderr, fmt, ap);
     118:     (void)fputc('\n', stderr);
     119:     exit(eval);
     120: }
     121:
     122: void
     123: #if __STDC__
     124: warn(const char *fmt, ...)
     125: #else
     126: warn(fmt, va_alist)
     127:     char *fmt;
     128:     va_dcl
     129: #endif
     130: {
     131:     va_list ap;
     132: #if __STDC__
     133:     va_start(ap, fmt);
     134: #else
     135:     va_start(ap);
     136: #endif
     137:     vwarn(fmt, ap);
     138:     va_end(ap);
     139: }
     140:
     141: void
     142: vwarn(fmt, ap)
     143:     char *fmt;
     144:     va_list ap;
     145: {
     146:     int sverrno;
     147:
     148:     sverrno = errno;
     149:     putprog();
     150:     if (fmt != NULL) {
     151:         (void)vfprintf(stderr, fmt, ap);
     152:         putcolsp();
     153:     }
     154:     (void)fputs(strerror(sverrno), stderr);
     155:     (void)fputc('\n', stderr);
     156: }
     157:
     158: void
     159: #ifdef __STDC__
     160: warnx(const char *fmt, ...)
     161: #else
     162: warnx(fmt, va_alist)
     163:     char *fmt;
     164:     va_dcl
     165: #endif
     166: {
     167:     va_list ap;
     168: #ifdef __STDC__
     169:     va_start(ap, fmt);
     170: #else
     171:     va_start(ap);
     172: #endif
     173:     vwarnx(fmt, ap);
     174:     va_end(ap);
     175: }
     176:
     177: void
     178: vwarnx(fmt, ap)
     179:     char *fmt;
     180:     va_list ap;
     181: {
     182:     putprog();
     183:     if (fmt != NULL)
     184:         (void)vfprintf(stderr, fmt, ap);
     185:     (void)fputc('\n', stderr);
     186: }
     187:
     188: /*
     189:  * Helper routines.  Repeated constructs of the form "%s: " used up too
     190:  * much D space.  On a pdp-11 code can be overlaid but Data space is worth
     191:  * conserving.  An extra function call or two handling an error condition is
     192:  * a reasonable trade for 20 or 30 bytes of D space.
     193: */
     194:
     195: static void
     196: putprog()
     197:     {
     198:
     199:     fputs(__progname, stderr);
     200:     putcolsp();
     201:     }
     202:
     203: static void
     204: putcolsp()
     205:     {
     206:
     207:     fputc(':', stderr);
     208:     fputc(' ', stderr);
     209:     }

#### Defined functions

err defined in line 50; used 59 times

- in /usr/src/bin/hostid.c line 51
- in /usr/src/bin/hostname/hostname.c line 77-80(2)
- in /usr/src/bin/stty/stty.c line 189-191(2)
- in /usr/src/bin/test/test.c line 239, 565, 572
- in /usr/src/sbin/gt307/gt307.c line 112
- in /usr/src/sbin/mkfs/mkfs.c line 122-125(2)
- in /usr/src/sbin/mount/getmntopts.c line 61
- in /usr/src/sbin/mount/mount.c line 177, 223, 449
- in /usr/src/sbin/quotacheck/preen.c line 344
- in /usr/src/sbin/quotacheck/quotacheck.c line 153, 173, 448, 480, 531
- in /usr/src/sbin/shutdown/shutdown.c line 192
- in /usr/src/sbin/umount/umount.c line 107, 150, 275
- in /usr/src/sys/pdpstand/makesimtape.c line 69-74(2), 114, 134, 145
- in /usr/src/ucb/lastcomm.c line 63
- in /usr/src/ucb/tcopy.c line 54-58(2)
- in /usr/src/usr.bin/id/id.c line 162
- in /usr/src/usr.bin/mkerrlst/mkerrlst.c line 70-72(2), 78, 101
- in /usr/src/usr.bin/uname/uname.c line 109, 118, 127, 136, 148
- in /usr/src/usr.bin/whereis/whereis.c line 78-82(2), 89
- in /usr/src/usr.lib/libI77/lio.h line 54
- in /usr/src/usr.sbin/accton/accton.c line 67, 182, 192-196(2), 202
- in /usr/src/usr.sbin/dev_mkdb/dev_mkdb.c line 51, 89, 96, 131, 141-145(2), 152

errx defined in line 89; used 29 times

- in /usr/src/bin/hostid.c line 57
- in /usr/src/bin/test/test.c line 115-119(2), 558
- in /usr/src/sbin/gt307/gt307.c line 128, 134, 151
- in /usr/src/sbin/mount/getmntopts.c line 83
- in /usr/src/sbin/mount/mount.c line 125, 192-196(2), 204-208(2)
- in /usr/src/sbin/umount/umount.c line 255, 281
- in /usr/src/sys/pdpstand/makesimtape.c line 64
- in /usr/src/usr.bin/id/id.c line 311
- in /usr/src/usr.sbin/accton/accton.c line 39, 54-57(2), 83, 90, 97, 146-152(3), 168-170(2), 210

putcolsp defined in line 203; used 4 times

- in line 48, 82, 152, 200

putprog defined in line 195; used 5 times

- in line 48, 79, 115, 149, 182

verr defined in line 70; used 1 times

- in line 66

verrx defined in line 109; used 1 times

- in line 105

vwarn defined in line 141; used 1 times

- in line 137

vwarnx defined in line 177; used 2 times

- in line 173
- in /usr/src/sbin/newfs/newfs.c line 258

warn defined in line 122; used 45 times

- in /usr/src/bin/df.c line 107, 125, 240
- in /usr/src/bin/stty/stty.c line 213, 366
- in /usr/src/lib/libc/gen/devname.c line 60
- in /usr/src/lib/libc/gen/fstab.c line 206
- in /usr/src/libexec/talkd/process.c line 160
- in /usr/src/new/kermit5.188/ckcfns.c line 1134, 2010-2011(2)
- in /usr/src/new/kermit5.188/ckuus7.c line 852-859(4)
- in /usr/src/new/kermit5.188/ckuusy.c line 395
- in /usr/src/sbin/mount/mount.c line 294, 307-311(2), 318, 332, 424
- in /usr/src/sbin/newfs/newfs.c line 223
- in /usr/src/sbin/quotacheck/preen.c line 81, 96, 124, 132, 176-179(2), 229, 273, 279, 288, 294, 302
- in /usr/src/sbin/quotacheck/quotacheck.c line 166, 267-276(3), 287, 293
- in /usr/src/sbin/umount/umount.c line 197, 214
- in /usr/src/sys/pdpstand/makesimtape.c line 108
- in /usr/src/usr.sbin/dev_mkdb/dev_mkdb.c line 110

warnx defined in line 158; used 7 times

- in /usr/src/sbin/mount/mount.c line 326
- in /usr/src/sbin/umount/umount.c line 137, 169-174(2), 180-184(2)
- in /usr/src/usr.sbin/accton/accton.c line 117

#### Defined variables

sccsid defined in line 35; never used

Last modified: 1995-02-04 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 842 |