diff options
author | June McEnroe <june@causal.agency> | 2022-06-18 10:03:57 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2022-06-18 10:03:57 -0400 |
commit | 511f999dfab4fce8d31af9c388d616ce45a88398 (patch) | |
tree | cb96078d99295f62b1d25af3329b84ac2897df04 /extra | |
parent | edit: Validate size is power of two (diff) | |
download | pounce-511f999dfab4fce8d31af9c388d616ce45a88398.tar.gz pounce-511f999dfab4fce8d31af9c388d616ce45a88398.zip |
Flatten extras to top-level directory
Diffstat (limited to '')
-rw-r--r-- | edit.c (renamed from extra/edit/edit.c) | 0 | ||||
-rw-r--r-- | extra/edit/.gitignore | 3 | ||||
-rw-r--r-- | extra/edit/Makefile | 28 | ||||
-rwxr-xr-x | extra/edit/configure | 44 | ||||
-rw-r--r-- | extra/edit/xdg.c | 129 | ||||
-rw-r--r-- | extra/notify/.gitignore | 3 | ||||
-rw-r--r-- | extra/notify/Makefile | 28 | ||||
-rwxr-xr-x | extra/notify/configure | 44 | ||||
-rw-r--r-- | extra/palaver/.gitignore | 3 | ||||
-rw-r--r-- | extra/palaver/Makefile | 30 | ||||
-rwxr-xr-x | extra/palaver/configure | 45 | ||||
-rw-r--r-- | notify.c (renamed from extra/notify/notify.c) | 0 | ||||
-rw-r--r-- | palaver.c (renamed from extra/palaver/notify.c) | 0 | ||||
-rw-r--r-- | pounce-edit.1 (renamed from extra/edit/pounce-edit.1) | 0 | ||||
-rw-r--r-- | pounce-notify.1 (renamed from extra/notify/pounce-notify.1) | 0 | ||||
-rw-r--r-- | pounce-palaver.1 (renamed from extra/palaver/pounce-palaver.1) | 0 |
16 files changed, 0 insertions, 357 deletions
diff --git a/extra/edit/edit.c b/edit.c index 793e413..793e413 100644 --- a/extra/edit/edit.c +++ b/edit.c diff --git a/extra/edit/.gitignore b/extra/edit/.gitignore deleted file mode 100644 index 626888d..0000000 --- a/extra/edit/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*.o -config.mk -pounce-edit diff --git a/extra/edit/Makefile b/extra/edit/Makefile deleted file mode 100644 index 8bac3a6..0000000 --- a/extra/edit/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -PREFIX ?= /usr/local -BINDIR ?= ${PREFIX}/bin -MANDIR ?= ${PREFIX}/man - -CFLAGS += -std=c11 -Wall -Wextra -Wpedantic -LDADD.libtls = -ltls - --include config.mk - -LDLIBS = ${LDADD.libtls} -OBJS = edit.o xdg.o - -all: pounce-edit - -pounce-edit: ${OBJS} - ${CC} ${LDFLAGS} ${OBJS} ${LDLIBS} -o $@ - -clean: - rm -f ${OBJS} pounce-edit - -install: pounce-edit pounce-edit.1 - install -d ${DESTDIR}${BINDIR} ${DESTDIR}${MANDIR}/man1 - install pounce-edit ${DESTDIR}${BINDIR} - install -m 644 pounce-edit.1 ${DESTDIR}${MANDIR}/man1 - -uninstall: - rm -f ${DESTDIR}${BINDIR}/pounce-edit - rm -f ${DESTDIR}${MANDIR}/man1/pounce-edit.1 diff --git a/extra/edit/configure b/extra/edit/configure deleted file mode 100755 index e180aa5..0000000 --- a/extra/edit/configure +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh -set -eu - -cflags() { - echo "CFLAGS += $*" -} -defstr() { - cflags "-D'$1=\"$2\"'" -} -defvar() { - defstr "$1" "$(pkg-config --variable=$3 $2)${4:-}" -} -ldadd() { - lib=$1; shift - echo "LDADD.${lib} = $*" -} -config() { - pkg-config --print-errors "$@" - cflags $(pkg-config --cflags "$@") - for lib; do ldadd $lib $(pkg-config --libs $lib); done -} - -exec >config.mk - -for opt; do - case "${opt}" in - (--prefix=*) echo "PREFIX = ${opt#*=}" ;; - (--bindir=*) echo "BINDIR = ${opt#*=}" ;; - (--mandir=*) echo "MANDIR = ${opt#*=}" ;; - (*) echo "warning: unsupported option ${opt}" >&2 ;; - esac -done - -case "$(uname)" in - (OpenBSD) - ;; - (Linux) - cflags -D_GNU_SOURCE - config libtls - ;; - (*) - config libtls - ;; -esac diff --git a/extra/edit/xdg.c b/extra/edit/xdg.c deleted file mode 100644 index b9015b2..0000000 --- a/extra/edit/xdg.c +++ /dev/null @@ -1,129 +0,0 @@ -/* Copyright (C) 2019, 2020 June McEnroe <june@causal.agency> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - * - * Additional permission under GNU GPL version 3 section 7: - * - * If you modify this Program, or any covered work, by linking or - * combining it with OpenSSL (or a modified version of that library), - * containing parts covered by the terms of the OpenSSL License and the - * original SSLeay license, the licensors of this Program grant you - * additional permission to convey the resulting work. Corresponding - * Source for a non-source form of such a combination shall include the - * source code for the parts of OpenSSL used as well as that of the - * covered work. - */ - -#include <err.h> -#include <errno.h> -#include <limits.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sys/stat.h> -#include <sysexits.h> - -#define SUBDIR "pounce" - -struct Base { - const char *envHome; - const char *envDirs; - const char *defHome; - const char *defDirs; -}; - -static const struct Base Config = { - .envHome = "XDG_CONFIG_HOME", - .envDirs = "XDG_CONFIG_DIRS", - .defHome = ".config", - .defDirs = "/etc/xdg", -}; - -static const struct Base Data = { - .envHome = "XDG_DATA_HOME", - .envDirs = "XDG_DATA_DIRS", - .defHome = ".local/share", - .defDirs = "/usr/local/share:/usr/share", -}; - -static char *basePath( - struct Base base, char *buf, size_t cap, const char *path, int i -) { - if (path[strspn(path, ".")] == '/') { - if (i > 0) return NULL; - snprintf(buf, cap, "%s", path); - return buf; - } - - if (i > 0) { - const char *dirs = getenv(base.envDirs); - if (!dirs) dirs = base.defDirs; - for (; i > 1; --i) { - dirs += strcspn(dirs, ":"); - dirs += (*dirs == ':'); - } - if (!*dirs) return NULL; - snprintf( - buf, cap, "%.*s/" SUBDIR "/%s", - (int)strcspn(dirs, ":"), dirs, path - ); - return buf; - } - - const char *home = getenv("HOME"); - const char *baseHome = getenv(base.envHome); - if (baseHome) { - snprintf(buf, cap, "%s/" SUBDIR "/%s", baseHome, path); - } else if (home) { - snprintf(buf, cap, "%s/%s/" SUBDIR "/%s", home, base.defHome, path); - } else { - errx(EX_USAGE, "HOME unset"); - } - return buf; -} - -char *configPath(char *buf, size_t cap, const char *path, int i) { - return basePath(Config, buf, cap, path, i); -} - -char *dataPath(char *buf, size_t cap, const char *path, int i) { - return basePath(Data, buf, cap, path, i); -} - -FILE *configOpen(const char *path, const char *mode) { - char buf[PATH_MAX]; - for (int i = 0; configPath(buf, sizeof(buf), path, i); ++i) { - FILE *file = fopen(buf, mode); - if (file) return file; - if (errno != ENOENT) warn("%s", buf); - } - warn("%s", configPath(buf, sizeof(buf), path, 0)); - return NULL; -} - -FILE *dataOpen(const char *path, const char *mode) { - char buf[PATH_MAX]; - for (int i = 0; dataPath(buf, sizeof(buf), path, i); ++i) { - FILE *file = fopen(buf, mode); - if (file) return file; - if (errno != ENOENT) warn("%s", buf); - } - if (mode[0] != 'r') { - int error = mkdir(dataPath(buf, sizeof(buf), "", 0), S_IRWXU); - if (error && errno != EEXIST) warn("%s", buf); - } - FILE *file = fopen(dataPath(buf, sizeof(buf), path, 0), mode); - if (!file) warn("%s", buf); - return file; -} diff --git a/extra/notify/.gitignore b/extra/notify/.gitignore deleted file mode 100644 index acd29ee..0000000 --- a/extra/notify/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*.o -config.mk -pounce-notify diff --git a/extra/notify/Makefile b/extra/notify/Makefile deleted file mode 100644 index 5e8ed93..0000000 --- a/extra/notify/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -PREFIX ?= /usr/local -BINDIR ?= ${PREFIX}/bin -MANDIR ?= ${PREFIX}/man - -CFLAGS += -std=c11 -Wall -Wextra -Wpedantic -LDADD.libtls = -ltls - --include config.mk - -LDLIBS = ${LDADD.libtls} -OBJS = notify.o - -all: pounce-notify - -pounce-notify: ${OBJS} - ${CC} ${LDFLAGS} ${OBJS} ${LDLIBS} -o $@ - -clean: - rm -f ${OBJS} pounce-notify - -install: pounce-notify pounce-notify.1 - install -d ${DESTDIR}${BINDIR} ${DESTDIR}${MANDIR}/man1 - install pounce-notify ${DESTDIR}${BINDIR} - install -m 644 pounce-notify.1 ${DESTDIR}${MANDIR}/man1 - -uninstall: - rm -f ${DESTDIR}${BINDIR}/pounce-notify - rm -f ${DESTDIR}${MANDIR}/man1/pounce-notify.1 diff --git a/extra/notify/configure b/extra/notify/configure deleted file mode 100755 index e180aa5..0000000 --- a/extra/notify/configure +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh -set -eu - -cflags() { - echo "CFLAGS += $*" -} -defstr() { - cflags "-D'$1=\"$2\"'" -} -defvar() { - defstr "$1" "$(pkg-config --variable=$3 $2)${4:-}" -} -ldadd() { - lib=$1; shift - echo "LDADD.${lib} = $*" -} -config() { - pkg-config --print-errors "$@" - cflags $(pkg-config --cflags "$@") - for lib; do ldadd $lib $(pkg-config --libs $lib); done -} - -exec >config.mk - -for opt; do - case "${opt}" in - (--prefix=*) echo "PREFIX = ${opt#*=}" ;; - (--bindir=*) echo "BINDIR = ${opt#*=}" ;; - (--mandir=*) echo "MANDIR = ${opt#*=}" ;; - (*) echo "warning: unsupported option ${opt}" >&2 ;; - esac -done - -case "$(uname)" in - (OpenBSD) - ;; - (Linux) - cflags -D_GNU_SOURCE - config libtls - ;; - (*) - config libtls - ;; -esac diff --git a/extra/palaver/.gitignore b/extra/palaver/.gitignore deleted file mode 100644 index d92ce2e..0000000 --- a/extra/palaver/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*.o -config.mk -pounce-palaver diff --git a/extra/palaver/Makefile b/extra/palaver/Makefile deleted file mode 100644 index fbf10df..0000000 --- a/extra/palaver/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -PREFIX ?= /usr/local -BINDIR ?= ${PREFIX}/bin -MANDIR ?= ${PREFIX}/man - -CFLAGS += -std=c11 -Wall -Wextra -Wpedantic -LDADD.libcurl = -lcurl -LDADD.libtls = -ltls -LDADD.sqlite3 = -lsqlite3 - --include config.mk - -LDLIBS = ${LDADD.libcurl} ${LDADD.libtls} ${LDADD.sqlite3} -OBJS = notify.o - -all: pounce-palaver - -pounce-palaver: ${OBJS} - ${CC} ${LDFLAGS} ${OBJS} ${LDLIBS} -o $@ - -clean: - rm -f ${OBJS} pounce-palaver - -install: pounce-palaver pounce-palaver.1 - install -d ${DESTDIR}${BINDIR} ${DESTDIR}${MANDIR}/man1 - install pounce-palaver ${DESTDIR}${BINDIR} - install -m 644 pounce-palaver.1 ${DESTDIR}${MANDIR}/man1 - -uninstall: - rm -f ${DESTDIR}${BINDIR}/pounce-palaver - rm -f ${DESTDIR}${MANDIR}/man1/pounce-palaver.1 diff --git a/extra/palaver/configure b/extra/palaver/configure deleted file mode 100755 index bce92be..0000000 --- a/extra/palaver/configure +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh -set -eu - -cflags() { - echo "CFLAGS += $*" -} -defstr() { - cflags "-D'$1=\"$2\"'" -} -defvar() { - defstr "$1" "$(pkg-config --variable=$3 $2)${4:-}" -} -ldadd() { - lib=$1; shift - echo "LDADD.${lib} = $*" -} -config() { - pkg-config --print-errors "$@" - cflags $(pkg-config --cflags "$@") - for lib; do ldadd $lib $(pkg-config --libs $lib); done -} - -exec >config.mk - -for opt; do - case "${opt}" in - (--prefix=*) echo "PREFIX = ${opt#*=}" ;; - (--bindir=*) echo "BINDIR = ${opt#*=}" ;; - (--mandir=*) echo "MANDIR = ${opt#*=}" ;; - (*) echo "warning: unsupported option ${opt}" >&2 ;; - esac -done - -case "$(uname)" in - (OpenBSD) - config libcurl sqlite3 - ;; - (Linux) - cflags -D_GNU_SOURCE - config libcurl libtls sqlite3 - ;; - (*) - config libcurl libtls sqlite3 - ;; -esac diff --git a/extra/notify/notify.c b/notify.c index 935ba26..935ba26 100644 --- a/extra/notify/notify.c +++ b/notify.c diff --git a/extra/palaver/notify.c b/palaver.c index 36e4ae1..36e4ae1 100644 --- a/extra/palaver/notify.c +++ b/palaver.c diff --git a/extra/edit/pounce-edit.1 b/pounce-edit.1 index 36c59aa..36c59aa 100644 --- a/extra/edit/pounce-edit.1 +++ b/pounce-edit.1 diff --git a/extra/notify/pounce-notify.1 b/pounce-notify.1 index 628bc25..628bc25 100644 --- a/extra/notify/pounce-notify.1 +++ b/pounce-notify.1 diff --git a/extra/palaver/pounce-palaver.1 b/pounce-palaver.1 index da3937a..da3937a 100644 --- a/extra/palaver/pounce-palaver.1 +++ b/pounce-palaver.1 |