File: msg.c

package info (click to toggle)
rdup 1.1.15-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid, stretch
  • size: 1,304 kB
  • ctags: 233
  • sloc: ansic: 4,120; sh: 3,370; exp: 277; makefile: 86; ruby: 36; perl: 4
file content (44 lines) | stat: -rw-r--r-- 947 bytes parent folder | download
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
/*
 * Copyright (c) 2009 - 2011 Miek Gieben
 * License: GPLv3(+), see LICENSE for details
 */
#include "rdup.h"

extern char *PROGNAME;

void msg_va_list(const char *fmt, va_list args)
{
	fprintf(stderr, "** %s: ", PROGNAME);
	vfprintf(stderr, fmt, args);
	fprintf(stderr, "\n");
}

/* only with debugging enabled will this call be different */
void msgd_va_list( __attribute__ ((unused))
		  const char *func, __attribute__ ((unused))
		  int line, const char *fmt, va_list args)
{
#ifdef DEBUG
	fprintf(stderr, "** %s: %s():%d  ", PROGNAME, func, line);
#else
	fprintf(stderr, "** %s: ", PROGNAME);
#endif				/* DEBUG */
	vfprintf(stderr, fmt, args);
	fprintf(stderr, "\n");
}

void msg(const char *fmt, ...)
{
	va_list args;
	va_start(args, fmt);
	msg_va_list(fmt, args);
	va_end(args);
}

void msgd(const char *func, int line, const char *fmt, ...)
{
	va_list args;
	va_start(args, fmt);
	msgd_va_list(func, line, fmt, args);
	va_end(args);
}