hachem.wtf
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2026-09-02 01:19:50 +0200
committerhachem <im@hachem.wtf>2026-09-02 01:19:50 +0200
commitef15ee2b634058a8199c31223e5e2ec9784be031 (patch)
treef1b0de7d47a04a26f8c3814e729564d3edef34dc
parent363c188831bdbd75c5f5cd4ac861e9331adaf1af (diff)
setup: project
-rw-r--r--.gitignore8
-rw-r--r--Makefile45
-rw-r--r--README.md17
-rw-r--r--compile_commands.json27
-rw-r--r--src/main.c6
5 files changed, 101 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..a2e9350
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,8 @@
+bin/
+
+compile_options.json
+compile_flags.txt
+.clangd
+
+.DS_Store
+
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..cb5d10d
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,45 @@
+CC := clang
+
+CFLAGS := -Wall \
+ -Wextra \
+ -Wpedantic \
+ -Wconversion \
+ -Wsign-conversion \
+ -Wshadow \
+ -Wstrict-prototypes \
+ -Wmissing-prototypes \
+ -g \
+ -fno-omit-frame-pointer \
+ -fsanitize=address,undefined \
+ -std=c17 \
+ -Isrc
+
+LDFLAGS := -fsanitize=address,undefined
+
+CPPCHECKFLAGS := --project=compile_commands.json \
+ --enable=warning,style,performance,portability \
+ --error-exitcode=1
+
+TARGET := bin/jafm
+
+SRC := $(shell find src -name '*.c')
+OBJ := $(SRC:src/%.c=bin/%.o)
+
+all: $(TARGET)
+
+$(TARGET): $(OBJ)
+ @mkdir -p $(@D)
+ $(CC) $^ -o $@ $(LDFLAGS)
+
+bin/%.o: src/%.c
+ @mkdir -p $(@D)
+ $(CC) $(CFLAGS) -c $< -o $@
+
+check:
+ bear -- make clean all
+ cppcheck $(CPPCHECKFLAGS)
+
+clean:
+ rm -rf bin
+
+.PHONY: all check clean
diff --git a/README.md b/README.md
index 1d37b80..3b9ad37 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,15 @@
-# jafm
-just a fucking manual.
+# just a fucking manual
+
+jafm is just a convenient utility program that searches through your man pages instead of making you find the man page yourself. I find it genuinely insane how illiterate the default `man` command can be. I was making a simple HTTP server in C, and, as you know, I wanted to look up the man page for `sockaddr_in`. But every single time I tried `man sockaddr_in`, `man` would go: `No manual entry for sockaddr_in`. And this *should* work, because it works on Linux. But, as it so happens, I am not on Linux all the time.
+
+The documentation for `sockaddr_in` was there. It was inside another man page. So naturally, I had to somehow figure out which random man page contained the thing I was looking for. jafm fixes that. It just looks through **all your man pages**, tells you where it found your query, gives you a selector, and opens the man page for you.
+
+```sh
+$ jafm sockaddr_in
+```
+
+That's it. I find it genuinely unacceptable that this is not an already solved issue.
+
+## License
+
+JAFM is licensed under the MIT License. See [LICENSE](LICENSE) for more information.
diff --git a/compile_commands.json b/compile_commands.json
new file mode 100644
index 0000000..3fe792c
--- /dev/null
+++ b/compile_commands.json
@@ -0,0 +1,27 @@
+[
+ {
+ "file": "src/main.c",
+ "arguments": [
+ "/opt/homebrew/opt/llvm/bin/clang",
+ "-Wall",
+ "-Wextra",
+ "-Wpedantic",
+ "-Wconversion",
+ "-Wsign-conversion",
+ "-Wshadow",
+ "-Wstrict-prototypes",
+ "-Wmissing-prototypes",
+ "-g",
+ "-fno-omit-frame-pointer",
+ "-fsanitize=address,undefined",
+ "-std=c17",
+ "-Isrc",
+ "-c",
+ "src/main.c",
+ "-o",
+ "bin/main.o"
+ ],
+ "directory": "/Users/hachem/dev/jafm",
+ "output": "bin/main.o"
+ }
+] \ No newline at end of file
diff --git a/src/main.c b/src/main.c
new file mode 100644
index 0000000..45f759c
--- /dev/null
+++ b/src/main.c
@@ -0,0 +1,6 @@
+#include <stdio.h>
+
+int main(void)
+{
+ (void) puts("type shi");
+}