1
0
Fork 0

more stuff

This commit is contained in:
dtb 2022-09-18 12:17:49 -04:00
parent 4206d6dee5
commit 3b9ff7ddb4
6 changed files with 48 additions and 16 deletions

View File

@ -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

4
data/Makefile Normal file
View File

@ -0,0 +1,4 @@
all: ;
clean: ;
sane: ;
.PHONY: all clean sane

View File

@ -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]"

25
dist/Makefile vendored
View File

@ -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

11
streq/Makefile Normal file
View File

@ -0,0 +1,11 @@
all: streq
clean:
rm -r streq
sane: streq
streq: streq.c
$(CC) -o streq streq.c
.PHONY: all clean sane

View File

@ -1,6 +1,6 @@
#include <sysexits.h>
#include <unistd.h>
#include "libio.h"
#include <stdio.h> /* fprintf(3) */
#include <stdlib.h> /* stderr, stdin, stdout */
#include <sysexits.h> /* 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;
}