Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: fusl/src/legacy/err.c

Issue 1573973002: Add a "fork" of musl as //fusl. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fusl/src/legacy/daemon.c ('k') | fusl/src/legacy/euidaccess.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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 }
OLDNEW
« no previous file with comments | « fusl/src/legacy/daemon.c ('k') | fusl/src/legacy/euidaccess.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698