diff options
author | Stefan Bolte <sbolte@lavabit.com> | 2013-05-18 02:40:01 +0200 |
---|---|---|
committer | Stefan Bolte <sbolte@lavabit.com> | 2013-05-18 02:40:01 +0200 |
commit | 56fc1e87ee8493b69701bf2fb1c4b7b462d32c5f (patch) | |
tree | 1cdaa2408058dd76e8a2bcecc8334d87c2b9bc90 /tools | |
parent | 8ae273486fddbb251a69ec6feff597fa87a9ba7e (diff) | |
download | dwb-56fc1e87ee8493b69701bf2fb1c4b7b462d32c5f.zip |
dwbem: Adding --archive-pack/--archive-unpack
Diffstat (limited to 'tools')
-rw-r--r-- | tools/Makefile | 13 | ||||
-rw-r--r-- | tools/dwbem.c | 24 |
2 files changed, 32 insertions, 5 deletions
diff --git a/tools/Makefile b/tools/Makefile index eadab41f..059703f2 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -3,7 +3,12 @@ include ../config.mk TARGET=dwbem -OBJ = $(patsubst %.c, %.o, $(wildcard *.c)) +BASEDIR = .. + +CFLAGS += -I$(BASEDIR)/$(DWB_LIB_DIRS) + +OBJ = $(patsubst %.c, %.o, $(wildcard *.c)) $(BASEDIR)/$(OBJLIB) + SYSTEM_EXTENSION_DIR=$(PREFIX)/share/dwb/extensions @@ -21,11 +26,11 @@ LDFLAGS += $(shell pkg-config --libs $(LIBS)) all: $(TARGET) $(TARGET): $(OBJ) - @echo $(CC) $@ - @$(CC) $< -o $@ $(LDFLAGS) + @echo $(CC) -o $@ + @$(CC) $(OBJ) -o $@ $(LDFLAGS) %.o: %.c - @echo $(CC) $< + @echo $(CC) $< @$(CC) $(CFLAGS) -c $< -o $@ $(CPPFLAGS) clean: diff --git a/tools/dwbem.c b/tools/dwbem.c index b710dbbc..85c016aa 100644 --- a/tools/dwbem.c +++ b/tools/dwbem.c @@ -19,7 +19,7 @@ #ifndef _BSD_SOURCE #define _BSD_SOURCE #endif -#ifndef _BSD_SOURCE +#ifndef _POSIX_SOURCE #define _POSIX_SOURCE #endif @@ -37,6 +37,8 @@ #include <glib-2.0/glib.h> #include <libsoup-2.4/libsoup/soup.h> +#include <exar.h> + #define API_BASE "https://api.bitbucket.org/1.0/repositories/portix/dwb_extensions/src/tip/src/?format=yaml" #define REPO_BASE "https://bitbucket.org/portix/dwb_extensions" #define REPO_TREE "/raw/tip/src" @@ -1148,6 +1150,19 @@ cl_edit(const char *name, int flags) } return -1; } +static int +cl_exar_pack(const char *path, int flags) +{ + (void) flags; + return exar_pack(path); +} + +static int +cl_exar_unpack(const char *path, int flags) +{ + (void) flags; + return exar_unpack(path, NULL); +} int main(int argc, char **argv) @@ -1171,6 +1186,8 @@ main(int argc, char **argv) char **o_show_config = NULL; char **o_edit = NULL; char *o_proxy = NULL; + char **o_pack = NULL; + char **o_unpack = NULL; gboolean o_noconfig = false; gboolean o_update = false; gboolean o_list_installed = false; @@ -1196,6 +1213,8 @@ main(int argc, char **argv) { "proxy", 'p', 0, G_OPTION_ARG_STRING, &o_proxy, "HTTP-proxy to use", NULL }, { "upgrade", 'u', 0, G_OPTION_ARG_NONE, &o_update, "Update all extensions", NULL }, { "update", 'U', 0, G_OPTION_ARG_STRING_ARRAY, &o_update_ext, "Update <extension>", "<extension>" }, + { "archive-pack", 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &o_pack, "Pack <path> to an archive", "<path>" }, + { "archive-unpack", 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &o_unpack, "Unpack <archive>", "<archive>" }, { NULL, 0, 0, 0, NULL, NULL, NULL }, }; @@ -1271,6 +1290,9 @@ main(int argc, char **argv) for_each(o_install, flags, cl_install); for_each(o_show_config, flags, cl_show_config); for_each(o_edit, flags, cl_edit); + for_each(o_pack, flags, cl_exar_pack); + for_each(o_unpack, flags, cl_exar_unpack); + clean_up(); return 0; } |