diff --git a/Makefile b/Makefile index 48e45b3..2399b3f 100644 --- a/Makefile +++ b/Makefile @@ -49,11 +49,6 @@ PROGRAMS= \ alpine-programs: apk add $(PROGRAMS) -.PHONY: arch-doas -arch-doas: - cd dist/doas-sudo - makepkg -si - .PHONY: arch-yay arch-yay: git clone "https://aur.archlinux.org/yay.git" || true diff --git a/data/Makefile b/data/Makefile new file mode 100644 index 0000000..f378636 --- /dev/null +++ b/data/Makefile @@ -0,0 +1,4 @@ +all: ; +clean: ; +sane: ; +.PHONY: all clean sane diff --git a/data/data b/data/data index 98cf4f5..50f78b9 100755 --- a/data/data +++ b/data/data @@ -54,7 +54,7 @@ get_cpu_temp() { get_current_desktop() { case "$WM" in - (bspwm) printf "[%b] " "$(bspc query -D -d focused --names)" ;; + (bspwm) printf "[%b] " "$(bspc query -D -d focused --names) 2>/dev/null" ;; esac } @@ -68,9 +68,9 @@ get_memory_usage() { } get_public_ip() { - PUBLIC_IP4="$(curl -4 "$PUBLIC_IP_FETCH_URL" --no-progress-meter 2>/dev/null \ + PUBLIC_IP4="$(curl -4 --connect-timeout 5 "$PUBLIC_IP_FETCH_URL" --no-progress-meter 2>/dev/null \ || printf "-1")" - PUBLIC_IP6="$(curl -6 "$PUBLIC_IP6_FETCH_URL" --no-progress-meter 2>/dev/null \ + PUBLIC_IP6="$(curl -6 --connect-timeout 5 "$PUBLIC_IP6_FETCH_URL" --no-progress-meter 2>/dev/null \ || printf "-1")" if [ "$PUBLIC_IP4" = "-1" ] && [ "$PUBLIC_IP6" = "-1" ]; then printf "[error fetching address]" diff --git a/dist/Makefile b/dist/Makefile index 466bf68..6f7e33d 100644 --- a/dist/Makefile +++ b/dist/Makefile @@ -5,6 +5,22 @@ bin: battery: bin/battery bin/battery: bin ../battery/battery cp ../battery/battery* bin/ +../battery/battery: + $(MAKE) -C ../battery sane + +.PHONY: data +data: bin/data battery lowercase nonzero str streq +bin/data: bin ../data/data + cp ../data/data bin/ +../data/data: + $(MAKE) -C ../data sane + +.PHONY: lowercase +lowercase: bin/lowercase +bin/lowercase: bin ../lowercase/lowercase + cp ../lowercase/lowercase bin/lowercase +../lowercase/lowercase: + $(MAKE) -C ../lowercase sane .PHONY: nonzero nonzero: bin/nonzero @@ -20,7 +36,16 @@ bin/str: bin ../str/str ../str/str: $(MAKE) -C ../str sane +.PHONY: streq +streq: bin/streq +bin/streq: bin ../streq/streq + cp ../streq/streq bin/streq +../streq/streq: + $(MAKE) -C ../streq sane + .PHONY: volume volume: bin/volume bin/volume: bin ../volume/volume cp ../volume/volume* bin/ +../volume/volume: + $(MAKE) -C ../volume/volume sane diff --git a/streq/Makefile b/streq/Makefile new file mode 100644 index 0000000..9725de1 --- /dev/null +++ b/streq/Makefile @@ -0,0 +1,11 @@ +all: streq + +clean: + rm -r streq + +sane: streq + +streq: streq.c + $(CC) -o streq streq.c + +.PHONY: all clean sane diff --git a/streq/streq.c b/streq/streq.c index 248649f..5787e6b 100644 --- a/streq/streq.c +++ b/streq/streq.c @@ -1,6 +1,6 @@ -#include -#include -#include "libio.h" +#include /* fprintf(3) */ +#include /* stderr, stdin, stdout */ +#include /* EX_USAGE */ static char *program_name = "streq"; @@ -9,11 +9,8 @@ int main(int argc, char *argv[]){ int j; if(argc < 3){ - write(2, "Usage: ", 7); - if(argv[0] == NULL) - argv[0] = program_name; - fdprint(2, argv[0]); - write(2, " [strings...]\n", 14); + fprintf(stderr, "Usage: %s [string] [string...]\n", + argv[0] == NULL ? program_name : argv[0]); return EX_USAGE; }