1 |
|
|
/* $Id: dbg.c,v 1.4 2016/09/13 17:13:37 deraadt Exp $ */ |
2 |
|
|
/* |
3 |
|
|
* Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv> |
4 |
|
|
* |
5 |
|
|
* Permission to use, copy, modify, and distribute this software for any |
6 |
|
|
* purpose with or without fee is hereby granted, provided that the above |
7 |
|
|
* copyright notice and this permission notice appear in all copies. |
8 |
|
|
* |
9 |
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES |
10 |
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
11 |
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR |
12 |
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
13 |
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
14 |
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
15 |
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
16 |
|
|
*/ |
17 |
|
|
|
18 |
|
|
#include <err.h> |
19 |
|
|
#include <stdarg.h> |
20 |
|
|
#include <stdlib.h> |
21 |
|
|
|
22 |
|
|
#include "extern.h" |
23 |
|
|
|
24 |
|
|
void |
25 |
|
|
doddbg(const char *fmt, ...) |
26 |
|
|
{ |
27 |
|
|
va_list ap; |
28 |
|
|
|
29 |
|
|
if (verbose < 2) |
30 |
|
|
return; |
31 |
|
|
|
32 |
|
|
va_start(ap, fmt); |
33 |
|
|
vwarnx(fmt, ap); |
34 |
|
|
va_end(ap); |
35 |
|
|
} |
36 |
|
|
|
37 |
|
|
void |
38 |
|
|
dodbg(const char *fmt, ...) |
39 |
|
|
{ |
40 |
|
|
va_list ap; |
41 |
|
|
|
42 |
|
|
if (!verbose) |
43 |
|
|
return; |
44 |
|
|
|
45 |
|
|
va_start(ap, fmt); |
46 |
|
|
vwarnx(fmt, ap); |
47 |
|
|
va_end(ap); |
48 |
|
|
} |