File: err.c

package info (click to toggle)
netkit-rusers 0.17-13
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 348 kB
  • sloc: ansic: 1,024; makefile: 88; sh: 33
file content (30 lines) | stat: -rw-r--r-- 584 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
 * Reimplementation of err/warnx.
 */

char err_rcsid[] = 
  "$Id: err.c,v 1.1 1997/04/05 22:13:31 dholland Exp $";

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <err.h>

void err(int eval, const char *fmt, ...) {
    va_list ap;
    va_start(ap, fmt);
    fprintf(stderr, "rup: ");
    vfprintf(stderr, fmt, ap);
    fprintf(stderr, "%m\n");
    va_end(ap);
    exit(eval);
}

void warnx(const char *fmt, ...) {
    va_list ap;
    va_start(ap, fmt);
    fprintf(stderr, "rup: ");
    vfprintf(stderr, fmt, ap);
    fprintf(stderr, "\n");
    va_end(ap);
}