diff options
author | Volker Lendecke <vl@samba.org> | 2015-03-12 15:07:38 +0000 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2015-03-17 11:30:52 +0100 |
commit | 867f0a80a828d965fc855cef31f0724550b01b4f (patch) | |
tree | 1ffc1184b48764512ee0862b7f414b862391b47c /lib/texpect | |
parent | 0c47bdf295455034c414ba6f42fa9b8988e2ca2c (diff) | |
download | samba-867f0a80a828d965fc855cef31f0724550b01b4f.tar.gz |
texpect: Do not depend on ccan
texpect is the only remaining user of ccan code. Copy in the two routines
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'lib/texpect')
-rw-r--r-- | lib/texpect/texpect.c | 28 | ||||
-rw-r--r-- | lib/texpect/wscript | 2 |
2 files changed, 28 insertions, 2 deletions
diff --git a/lib/texpect/texpect.c b/lib/texpect/texpect.c index 9256b5ee31f..b553de8ca5c 100644 --- a/lib/texpect/texpect.c +++ b/lib/texpect/texpect.c @@ -56,7 +56,33 @@ #ifdef HAVE_ERR_H #include <err.h> #else -#include <ccan/err/err.h> +const char progname[] = "unknown program"; + +static void err(int eval, const char *fmt, ...) +{ + int err_errno = errno; + va_list ap; + + fprintf(stderr, "%s: ", progname); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + fprintf(stderr, ": %s\n", strerror(err_errno)); + exit(eval); +} + +static void errx(int eval, const char *fmt, ...) +{ + va_list ap; + + fprintf(stderr, "%s: ", progname); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + fprintf(stderr, "\n"); + exit(eval); +} + #endif struct command { diff --git a/lib/texpect/wscript b/lib/texpect/wscript index 3dd4740a13f..62a1d4dbb94 100644 --- a/lib/texpect/wscript +++ b/lib/texpect/wscript @@ -4,4 +4,4 @@ def configure(conf): conf.CHECK_FUNCS_IN('openpty', 'util', checklibc=True, headers='pty.h util.h bsd/libutil.h libutil.h') def build(bld): - bld.SAMBA_BINARY('texpect', 'texpect.c', deps='popt util ccan', install=False) + bld.SAMBA_BINARY('texpect', 'texpect.c', deps='popt util', install=False) |