~ubuntu-branches/ubuntu/vivid/emscripten/vivid-proposed

« back to all changes in this revision

Viewing changes to system/lib/libc/musl/src/legacy/err.c

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2014-01-19 14:12:40 UTC
  • mfrom: (4.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20140119141240-nfiw0p8033oitpfz
Tags: 1.9.0~20140119~7dc8c2f-1
* New snapshot release (Closes: #733714)
* Provide sources for javascript and flash. Done in orig-tar.sh
  Available in third_party/websockify/include/web-socket-js/src/
  (Closes: #735903)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <err.h>
 
2
#include <stdio.h>
 
3
#include <stdarg.h>
 
4
#include <stdlib.h>
 
5
 
 
6
extern char *__progname;
 
7
 
 
8
void vwarn(const char *fmt, va_list ap)
 
9
{
 
10
        fprintf (stderr, "%s: ", __progname);
 
11
        if (fmt) {
 
12
                vfprintf(stderr, fmt, ap);
 
13
                fputs (": ", stderr);
 
14
        }
 
15
        perror(0);
 
16
}
 
17
 
 
18
void vwarnx(const char *fmt, va_list ap)
 
19
{
 
20
        fprintf (stderr, "%s: ", __progname);
 
21
        if (fmt) vfprintf(stderr, fmt, ap);
 
22
        putc('\n', stderr);
 
23
}
 
24
 
 
25
_Noreturn void verr(int status, const char *fmt, va_list ap)
 
26
{
 
27
        vwarn(fmt, ap);
 
28
        exit(status);
 
29
}
 
30
 
 
31
_Noreturn void verrx(int status, const char *fmt, va_list ap)
 
32
{
 
33
        vwarnx(fmt, ap);
 
34
        exit(status);
 
35
}
 
36
 
 
37
void warn(const char *fmt, ...)
 
38
{
 
39
        va_list ap;
 
40
        va_start(ap, fmt);
 
41
        vwarn(fmt, ap);
 
42
        va_end(ap);
 
43
}
 
44
 
 
45
void warnx(const char *fmt, ...)
 
46
{
 
47
        va_list ap;
 
48
        va_start(ap, fmt);
 
49
        vwarnx(fmt, ap);
 
50
        va_end(ap);
 
51
}
 
52
 
 
53
_Noreturn void err(int status, const char *fmt, ...)
 
54
{
 
55
        va_list ap;
 
56
        va_start(ap, fmt);
 
57
        verr(status, fmt, ap);
 
58
        va_end(ap);
 
59
}
 
60
 
 
61
_Noreturn void errx(int status, const char *fmt, ...)
 
62
{
 
63
        va_list ap;
 
64
        va_start(ap, fmt);
 
65
        verrx(status, fmt, ap);
 
66
        va_end(ap);
 
67
}