commit 800bed9ac19bb834559c383e0f100526e252c3bf
Author: mrgrouse <mrgrouse@mrgrouse.com>
Date: Thu, 20 Aug 2026 00:15:05 -0400
repo init
Diffstat:
| A | Makefile | | | 30 | ++++++++++++++++++++++++++++++ |
| A | main.c | | | 44 | ++++++++++++++++++++++++++++++++++++++++++++ |
2 files changed, 74 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile
@@ -0,0 +1,30 @@
+CC = clang
+.DEFAULT_GOAL := shopping-list
+
+CFLAGS = -O2 -Werror -Wall -Wextra
+DEBUG_CFLAGS = -O0 -Werror -Wall -Wextra -g
+
+#LDFLAGS = -lform -lncursesw
+#LDFLAGS=-fPIE -static # for static linking with [sabotage-linux/netbsd-curses]
+
+SRCS = ./*.c
+OBJS = $(SRCS:.c=.o)
+BIN=shit
+
+PREFIX=/usr/local
+
+shopping-list: o
+ $(CC) $(CFLAGS) $(OBJS) -o $(BIN) $(LDFLAGS)
+
+o:
+ $(CC) $(CFLAGS) -c $(SRCS)
+
+debug:
+ $(CC) $(DEBUG_CFLAGS) $(SRCS) -o $(BIN) $(LDFLAGS)
+
+clean:
+ rm -f $(BIN) $(OBJS)
+
+install: shopping-list
+ cp -f $(BIN) $(PREFIX)/bin/$(BIN)
+ echo "$(BIN) installed at $(PREFIX)/bin/$(BIN)"
diff --git a/main.c b/main.c
@@ -0,0 +1,44 @@
+/* what the fuck are we doing here:
+ *
+ * find file in $XDG_DOCUMENTS_HOME
+ * if dont exist, create
+ * read from it
+ * functions: list $l, add $item [$list], delete $item [$list], new $list
+ *
+ * in each file: item name, price, hyperlink
+ *
+ * !! in each of the following find the file and error if not found !!
+ *
+ * new:
+ * create new file lol
+ *
+ * list:
+ * read and print in pretty manner
+ *
+ * add:
+ * append item name, price and hyperlink to file
+ *
+ * delete:
+ * delete certain item with $id
+ *
+ *
+ */
+#include <stdio.h>
+int main(int argc, char *argv[]) {
+ switch(argv[1][0]) {
+ case 'n':
+ new_list(argv[2]);
+ break;
+ case 'l':
+ list_items(argv[2]);
+ break;
+ case 'a':
+ add_item(argv[2], argv[3]);
+ break;
+ case 'd':
+ if (argc <= 3)
+ del_item(argv[])
+ }
+
+ return 0;
+}