commit f082a001ce8274b85ab1795a2bf274265e3432a5
parent eb4902aead7bbddf37a9a3950f6fac8a32244025
Author: lash <dev@holbrook.no>
Date: Tue, 11 Jun 2024 17:35:01 +0100
Add case aux
Diffstat:
3 files changed, 63 insertions(+), 0 deletions(-)
diff --git a/src/aux/liblash/src/case/Makefile b/src/aux/liblash/src/case/Makefile
@@ -0,0 +1,27 @@
+OBJS := $(patsubst %.c,%.o,$(filter-out test.c,$(wildcard *.c)))
+SOBJS := $(patsubst %.c,%.so.o,$(filter-out test.c,$(wildcard *.c)))
+INCLUDES := -I.
+CFLAGS += $(INCLUDES)
+VERSION = 0.0.1
+CFLAGS += -Wall -Werror
+
+all: $(OBJS)
+
+test: all
+ $(CC) $(CFLAGS) test.c case.o -o test.out $(LDFLAGS)
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c $< -o $@ $(LDFLAGS)
+
+clean:
+ rm -vf *.o
+ rm -vf *.out
+ rm -vf *.tar.gz
+
+archive:
+ git archive --format=tar.gz HEAD -o case-$(VERSION).tar.gz
+
+%.so.o: %.c
+ $(CC) $(CFLAGS) -c $< -o $@ -fpic
+
+shared: $(SOBJS)
diff --git a/src/aux/liblash/src/case/case.c b/src/aux/liblash/src/case/case.c
@@ -0,0 +1,29 @@
+void uc(char *b) {
+ int i;
+ char v;
+
+ i = 0;
+ v = 1;
+ while(v > 0) {
+ v = *(b+i);
+ if (v > 0x60 && v < 0x7b) {
+ *(b+i) -= 0x20;
+ }
+ i++;
+ }
+}
+
+void lc(char *b) {
+ int i;
+ char v;
+
+ i = 0;
+ v = 1;
+ while(v > 0) {
+ v = *(b+i);
+ if (v > 0x40 && v < 0x5b) {
+ *(b+i) += 0x20;
+ }
+ i++;
+ }
+}
diff --git a/src/aux/liblash/src/case/case.h b/src/aux/liblash/src/case/case.h
@@ -0,0 +1,7 @@
+#ifndef LASH_CASE_H_
+#define LASH_CASE_H_
+
+void uc(char *b);
+void lc(char *b);
+
+#endif