Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,10 @@ Thumbs.db
core
*.core

# Generated web assets (auto-created by make)
src/gui/web/*.html.h
src/gui/web/*.css.h
src/gui/web/*.js.h

*.md
*.txt
38 changes: 23 additions & 15 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
{
"configurations": [
{
"name": "windows-gcc-x64",
"compilerPath": "C:/msys64/mingw64/bin/gcc.exe",
"intelliSenseMode": "windows-gcc-x64",
"cStandard": "${default}",
"cppStandard": "${default}",
"includePath": [
"${workspaceFolder}/**"
],
"defines": []
}
],
"version": 4
}
"configurations": [
{
"name": "Cygwin",
"compilerPath": "C:/cygwin64/bin/gcc.exe",
"cStandard": "c17",
"intelliSenseMode": "linux-gcc-x64",
"includePath": [
"${workspaceFolder}/**",
"${workspaceFolder}/src/gui",
"${workspaceFolder}/src/gui/web",
"${workspaceFolder}/include",
"${workspaceFolder}/lib/mongoose"
],
"defines": [
"__CYGWIN__"
],
"env": {
"PATH": "C:/cygwin64/bin;${env:PATH}"
}
}
],
"version": 4
}
30 changes: 27 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
CC = gcc
CFLAGS = -Wall -Wextra -Wpedantic -I. -Iinclude
CFLAGS = -Wall -Wextra -Wpedantic -I. -Iinclude -Ilib/mongoose
SRC = $(wildcard src/*.c) \
$(wildcard src/**/*.c) \
$(wildcard src/modules/datastructures/*.c) \
$(wildcard src/modules/builtins/*.c) \
$(wildcard src/modules/autocomplete/*.c) \

SRC := $(filter-out src/modules/builtin.c, $(SRC))
SRC := $(filter-out src/modules/builtin.c src/gui/web_main.c, $(SRC))
OUT = shell

WEB_SRC = src/gui/web_main.c
WEB_OUT = moss-web
WEB_HTML = src/gui/web/index.html
WEB_CSS = src/gui/web/styles.css
WEB_JS = src/gui/web/main.js

WEB_HDRS = $(WEB_HTML:.html=.html.h) $(WEB_CSS:.css=.css.h) $(WEB_JS:.js=.js.h)

TEST_SRC = $(wildcard tests/*.c)
TEST_BINS = $(TEST_SRC:.c=)
TEST_LIBS = $(filter-out src/main.c, $(SRC))
Expand All @@ -18,6 +26,20 @@ all: $(OUT)
$(OUT): $(SRC)
$(CC) $(CFLAGS) $(SRC) -o $(OUT)

web: $(WEB_OUT)

$(WEB_OUT): $(WEB_SRC) $(WEB_HDRS)
$(CC) $(CFLAGS) $(WEB_SRC) lib/mongoose/mongoose.c -o $(WEB_OUT)
Comment on lines +29 to +32

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Make web build the shell binary too.

src/gui/web_main.c starts ./shell on launch, but make web only builds moss-web. After make clean && make web, the web server can start up only to fail its PTY exec path immediately.

Suggested fix
-web: $(WEB_OUT)
+web: $(OUT) $(WEB_OUT)

-$(WEB_OUT): $(WEB_SRC) $(WEB_HDRS)
+$(WEB_OUT): $(OUT) $(WEB_SRC) $(WEB_HDRS)
 	$(CC) $(CFLAGS) $(WEB_SRC) lib/mongoose/mongoose.c -o $(WEB_OUT)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
web: $(WEB_OUT)
$(WEB_OUT): $(WEB_SRC) $(WEB_HDRS)
$(CC) $(CFLAGS) $(WEB_SRC) lib/mongoose/mongoose.c -o $(WEB_OUT)
web: $(OUT) $(WEB_OUT)
$(WEB_OUT): $(OUT) $(WEB_SRC) $(WEB_HDRS)
$(CC) $(CFLAGS) $(WEB_SRC) lib/mongoose/mongoose.c -o $(WEB_OUT)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Makefile` around lines 29 - 32, The web build target only produces moss-web,
but web_main.c launches ./shell at runtime, so make web must also build the
shell binary. Update the Makefile’s web target/dependencies so it triggers the
shell build as part of the same invocation, using the existing web and shell
build rules or by adding the shell artifact as a prerequisite of web. Locate the
fix in the web and WEB_OUT targets so the built web server always has shell
available after make clean && make web.


%.html.h: %.html
perl scripts/embed.pl $< $(subst .,_,$(notdir $(basename $<)))_html

%.css.h: %.css
perl scripts/embed.pl $< $(subst .,_,$(notdir $(basename $<)))_css

%.js.h: %.js
perl scripts/embed.pl $< $(subst .,_,$(notdir $(basename $<)))_js

test: $(TEST_BINS)
@echo "Running all tests..."
@for test in $(TEST_BINS); do\
Expand All @@ -28,11 +50,13 @@ test: $(TEST_BINS)
$(TEST_BINS): tests/%: tests/%.c $(TEST_LIBS)
$(CC) $(CFLAGS) $< $(TEST_LIBS) -o $@ -lcmocka

.PHONY: all test clean scan check-mem
.PHONY: all test clean scan check-mem web

clean:
rm -f $(OUT)
rm -f $(TEST_BINS)
rm -f $(WEB_OUT)
rm -f $(WEB_HDRS)

scan:
cppcheck --enable=all --force -Iinclude src/
1 change: 1 addition & 0 deletions file
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Accidental stray file committed.

A file named file containing only test appears to be an unintentional commit artifact. Remove it before merging.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@file` at line 1, The committed stray file named file is accidental and should
be removed from the change set before merging. Delete the artifact entirely so
it is not included in the repository, and verify no references remain to this
unintended file.

7 changes: 7 additions & 0 deletions lib/mongoose/errtest.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <stdio.h>
#include <string.h>
#include <errno.h>
int main() {
printf("errno 88: %s\n", strerror(88));
return 0;
}
Loading
Loading