$(INSTALL) -pm 0644 lib/bup/source_info.py $(dest_libdir)/bup/; \
fi
-embed_cflags := $(bup_python_cflags_embed) $(bup_shared_cflags)
+embed_cflags := $(bup_python_cflags_embed) $(bup_shared_cflags) -I$(CURDIR)/src
embed_ldflags := $(bup_python_ldflags_embed) $(bup_shared_ldflags)
config/config.h: config/config.vars
clean_paths += dev/bup-exec
generated_dependencies += dev/bup-exec.d
dev/bup-exec: CFLAGS += -D BUP_DEV_BUP_EXEC=1
-dev/bup-exec: lib/cmd/bup.c
+dev/bup-exec: lib/cmd/bup.c src/bup/io.c
$(cc_bin)
clean_paths += dev/bup-python
generated_dependencies += dev/bup-python.d
dev/bup-python: CFLAGS += -D BUP_DEV_BUP_PYTHON=1
-dev/bup-python: lib/cmd/bup.c
+dev/bup-python: lib/cmd/bup.c src/bup/io.c
$(cc_bin)
clean_paths += lib/cmd/bup
generated_dependencies += lib/cmd/bup.d
-lib/cmd/bup: lib/cmd/bup.c
+lib/cmd/bup: lib/cmd/bup.c src/bup/io.c
$(cc_bin)
clean_paths += lib/bup/_helpers$(soext)
#include <sys/types.h>
#include <unistd.h>
-__attribute__ ((format(printf, 2, 3)))
-static void
-die(int exit_status, const char * const msg, ...)
-{
- if (fputs("bup: ", stderr) == EOF)
- exit(3);
- va_list ap;
- va_start(ap, msg);;
- if (vfprintf(stderr, msg, ap) < 0)
- exit(3);
- va_end(ap);
- exit(exit_status);
-}
+#include "bup/io.h"
static int prog_argc = 0;
static char **prog_argv = NULL;
--- /dev/null
+
+#define _GNU_SOURCE 1
+#undef NDEBUG
+
+#include <stdarg.h>
+#include <stdlib.h>
+
+#include "bup/io.h"
+
+__attribute__ ((format(printf, 2, 3)))
+void
+msg(FILE* f, const char * const msg, ...)
+{
+ if (fputs("bup: ", f) == EOF)
+ exit(3);
+ va_list ap;
+ va_start(ap, msg);
+ if (vfprintf(f, msg, ap) < 0)
+ exit(3);
+ va_end(ap);
+}
+
+__attribute__ ((format(printf, 2, 3)))
+void
+die(int exit_status, const char * const msg, ...)
+{
+ if (fputs("bup: ", stderr) == EOF)
+ exit(3);
+ va_list ap;
+ va_start(ap, msg);
+ if (vfprintf(stderr, msg, ap) < 0)
+ exit(3);
+ va_end(ap);
+ exit(exit_status);
+}
--- /dev/null
+#pragma once
+
+#include <stdio.h>
+
+void msg(FILE* f, const char * const msg, ...);
+void die(int exit_status, const char * const msg, ...);