File: err.h

package info (click to toggle)
squizz 0.99d%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 6,772 kB
  • sloc: sh: 4,799; ansic: 2,640; lex: 1,992; yacc: 1,650; makefile: 123
file content (59 lines) | stat: -rw-r--r-- 1,174 bytes parent folder | download | duplicates (4)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59

#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>

static void err(int val, const char *fmt, ...) {
  int sav;
  va_list ap;

  sav = errno;
  (void)fprintf(stderr, "%s: ", "xxx");
  if (fmt != NULL) {
    va_start(ap, fmt);
    (void)vfprintf(stderr, fmt, ap);
    va_end(ap); }
  (void)fprintf(stderr, ": %s\n", strerror(sav));

  exit(val); }

static void errx(int val, const char *fmt, ...) {
  va_list ap;

  (void)fprintf(stderr, "%s: ", "xxx");
  if (fmt != NULL) {
    va_start(ap, fmt);
    (void)vfprintf(stderr, fmt, ap);
    va_end(ap); }
  (void)fprintf(stderr, "\n");

  exit(val); }

static void warn(const char *fmt, ...) {
  int sav;
  va_list ap;

  sav = errno;
  (void)fprintf(stderr, "%s: ", "xxx");
  if (fmt != NULL) {
    va_start(ap, fmt);
    (void)vfprintf(stderr, fmt, ap);
    va_end(ap); }
  (void)fprintf(stderr, ": %s\n", strerror(sav));

  return; }

static void warnx(const char *fmt, ...) {
  va_list ap;

  (void)fprintf(stderr, "%s: ", "xxx");
  if (fmt != NULL) {
    va_start(ap, fmt);
    (void)vfprintf(stderr, fmt, ap);
    va_end(ap); }
  (void)fprintf(stderr, "\n");

  return; }