Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
76877ba
Added libtelnet to vendor directory and Makefile
amnuts Apr 5, 2020
dbbb9da
Some very much not working telnet cocde
amnuts Jun 27, 2021
b6d754d
Tiny progression on libtelnet integration
amnuts Oct 8, 2021
685cc4c
Merge branch 'develop' into libtelnet
amnuts Nov 11, 2024
e6189a1
Write via libtelnet and flexible write_sock/write_telnet functions.
amnuts Nov 12, 2024
450071e
Updated headers
amnuts Nov 12, 2024
a33994b
Don't be implicit about where headers are located
amnuts Nov 23, 2024
b30be99
Don't be implicit about where headers are located
amnuts Nov 23, 2024
6b52627
Updated vendors
amnuts Nov 23, 2024
2bb1cca
Fixed segfault with cmdcount due to %
amnuts Nov 23, 2024
c6693b9
Fixed same %%issue with the more functionality
amnuts Nov 23, 2024
962ef1e
Fixed formatting issue with preview
amnuts Nov 23, 2024
3494e19
Fixed percentage output for speech, previews, pager, etc. by just fla…
amnuts Nov 23, 2024
cf666b3
Fixed typos
amnuts Nov 23, 2024
e8df9d6
Merge pull request #19 from amnuts/tweaks
amnuts Nov 23, 2024
ce6a75c
Merge pull request #18 from amnuts/libtelnet
amnuts Nov 23, 2024
a800df6
Excellent PR feedback from @Uzume
amnuts Nov 23, 2024
9424429
I seemed to have broken the look command
amnuts Nov 23, 2024
598eb7f
Fixed segfault with netlinks when verification fails
amnuts Nov 23, 2024
d26a292
Minor fixes
amnuts Nov 24, 2024
16c6ad3
Merge pull request #21 from amnuts/tweaks
amnuts Nov 24, 2024
7033402
Moved compiling to clang
amnuts Nov 24, 2024
1710485
WIP changes list
amnuts Nov 24, 2024
c6955ff
Moved C version to GNU23 and added pedantic flag
amnuts Jan 18, 2025
3d55f12
Fix issues from pedantic flag
amnuts Jan 18, 2025
ce38ccd
'version' property no longer valid for docker
amnuts Jan 18, 2025
9bdfa5c
Merge pull request #22 from amnuts/clang
amnuts Jan 18, 2025
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
43 changes: 32 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@
BINDIR = $(CURDIR)/build
INCDIR = $(CURDIR)/src/includes
PERMS = 755
CC = gcc
C_FLAGS = -g -Wall -W -MMD
CC = clang
# -std=gnu23 = Use the C23 standard with GNU extras
# -g = Add debugging information to the executable
# -Wall = Enable all compiler warnings
# -Wextra = Extra warnings not covered by the above
# -MMD = Generate dependency files
# -Wpedantic = Be pedantic about the code
C_FLAGS = -std=gnu23 -g -Wall -Wextra -MMD -Wpedantic
CC_FLAGS = -I$(INCDIR)
LD_FLAGS =

Expand Down Expand Up @@ -43,10 +49,18 @@ IDENTD_OBJS = $(addprefix $(IDENTD_OBJ_DIR)/,$(notdir $(IDENTD_SRC:.c=.o)))
#
# Locations of vendors libraries
#
VENDOR_SDS_SRC_DIR = $(TALKER_SRC_DIR)/vendors/sds
VENDOR_SDS_OBJ_DIR = $(TALKER_OBJ_DIR)
VENDOR_SDS_SRC = $(wildcard $(VENDOR_SDS_SRC_DIR)/*.c)
VENDOR_SDS_OBJS = $(addprefix $(VENDOR_SDS_OBJ_DIR)/,$(notdir $(VENDOR_SDS_SRC:.c=.o)))

# SDS: https://github.com/antirez/sds
VENDOR_SDS_SRC_DIR = $(TALKER_SRC_DIR)/vendors/sds
VENDOR_SDS_OBJ_DIR = $(TALKER_OBJ_DIR)
VENDOR_SDS_SRC = $(wildcard $(VENDOR_SDS_SRC_DIR)/*.c)
VENDOR_SDS_OBJS = $(addprefix $(VENDOR_SDS_OBJ_DIR)/,$(notdir $(VENDOR_SDS_SRC:.c=.o)))

# libtelnet: https://github.com/seanmiddleditch/libtelnet
VENDOR_LIBTELNET_SRC_DIR = $(TALKER_SRC_DIR)/vendors/libtelnet
VENDOR_LIBTELNET_OBJ_DIR = $(TALKER_OBJ_DIR)
VENDOR_LIBTELNET_SRC = $(wildcard $(VENDOR_LIBTELNET_SRC_DIR)/*.c)
VENDOR_LIBTELNET_OBJS = $(addprefix $(VENDOR_LIBTELNET_OBJ_DIR)/,$(notdir $(VENDOR_LIBTELNET_SRC:.c=.o)))

#
# Platform-specific libraries that need to be included
Expand Down Expand Up @@ -79,6 +93,7 @@ distclean: clean
rm -f $(TALKER_SRC_DIR)/*.[ch]~ $(TALKER_SRC_DIR)/*.[ch].bak
rm -f $(IDENTD_SRC_DIR)/*.[ch]~ $(IDENTD_SRC_DIR)/*.[ch].bak
rm -f $(VENDOR_SDS_SRC_DIR)/*.[ch]~ $(VENDOR_SDS_SRC_DIR)/*.[ch].bak
rm -f $(VENDOR_LIBTELNET_SRC_DIR)/*.[ch]~ $(VENDOR_LIBTELNET_SRC_DIR)/*.[ch].bak
rm -f $(TALKER_BIN) $(BINDIR)/$(TALKER_BIN)
rm -f $(IDENTD_BIN) $(BINDIR)/$(IDENTD_BIN)
rm -f $(INCDIR)/*.[ch]~ $(INCDIR)/*.[ch].bak
Expand All @@ -88,27 +103,28 @@ clean:
rm -f $(TALKER_OBJS) $(TALKER_OBJS:.o=.d)
rm -f $(IDENTD_OBJS) $(IDENTD_OBJS:.o=.d)
rm -f $(VENDOR_SDS_OBJS) $(VENDOR_SDS_OBJS:.o=.d)
rm -f $(VENDOR_LIBTELNET_OBJS) $(VENDOR_LIBTELNET_OBJS:.o=.d)

install: $(BINDIR)/$(TALKER_BIN) $(BINDIR)/$(IDENTD_BIN)

build: $(TALKER_BIN) $(IDENTD_BIN)

compile: $(TALKER_OBJS) $(IDENTD_OBJS) $(VENDOR_SDS_OBJS)
compile: $(TALKER_OBJS) $(IDENTD_OBJS) $(VENDOR_SDS_OBJS) $(VENDOR_LIBTELNET_OBJS)

print-%: ; @echo $* = $($*)

vpath %.c $(TALKER_SRC_DIR) $(TALKER_SRC_DIR)/commands $(IDENTD_SRC_DIR) $(VENDOR_SDS_SRC_DIR)
vpath %.c $(TALKER_SRC_DIR) $(TALKER_SRC_DIR)/commands $(IDENTD_SRC_DIR) $(VENDOR_SDS_SRC_DIR) $(VENDOR_LIBTELNET_SRC_DIR)

$(BINDIR)/$(TALKER_BIN) $(BINDIR)/$(IDENTD_BIN): $(BINDIR)/%: %
@echo "Installing $< ..."
chmod $(PERMS) $<
mv $< $(BINDIR)

$(TALKER_BIN): $(TALKER_OBJS) $(VENDOR_SDS_OBJS)
$(TALKER_BIN): $(TALKER_OBJS) $(VENDOR_SDS_OBJS) $(VENDOR_LIBTELNET_OBJS)
@echo "Linking $@ ..."
$(CC) $(LD_FLAGS) $^ $(TALKER_LIBS) -o $@

$(IDENTD_BIN): $(IDENTD_OBJS) $(VENDOR_SDS_OBJS)
$(IDENTD_BIN): $(IDENTD_OBJS) $(VENDOR_SDS_OBJS) $(VENDOR_LIBTELNET_OBJS)
@echo "Linking $@ ..."
$(CC) $(LD_FLAGS) $^ $(IDENTD_LIBS) -o $@

Expand All @@ -127,4 +143,9 @@ $(VENDOR_SDS_OBJS): $(VENDOR_SDS_OBJ_DIR)/%.o: %.c
@test -d $(VENDOR_SDS_OBJ_DIR) || mkdir $(VENDOR_SDS_OBJ_DIR)
$(CC) $(C_FLAGS) $(CC_FLAGS) $(TALKER_FLAGS) -c -o $@ $<

-include $(TALKER_OBJS:.o=.d) $(IDENTD_OBJS:.o=.d) $(VENDOR_SDS_OBJS:.o=.d)
$(VENDOR_LIBTELNET_OBJS): $(VENDOR_LIBTELNET_OBJ_DIR)/%.o: %.c
@echo "Compiling libtelnet library $< ... ($@)"
@test -d $(VENDOR_LIBTELNET_OBJ_DIR) || mkdir $(VENDOR_LIBTELNET_OBJ_DIR)
$(CC) $(C_FLAGS) $(CC_FLAGS) $(TALKER_FLAGS) -c -o $@ $<

-include $(TALKER_OBJS:.o=.d) $(IDENTD_OBJS:.o=.d) $(VENDOR_SDS_OBJS:.o=.d) $(VENDOR_LIBTELNET_OBJS:.o=.d)
17 changes: 3 additions & 14 deletions docker-setup.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,14 @@
#!/usr/bin/env bash

MACHINE=$(uname -m)
if [ "$MACHINE" == "x86_64" ] || [ "$MACHINE" == "i686" ]; then
OS_ARCH="amd64"
elif [ "$MACHINE" == "aarch64" ] || [ "$MACHINE" == "arm64" ]; then
OS_ARCH="arm64v8"
else
OS_ARCH="amd64"
echo "Unknown platform - falling back to amd64"
fi

CONFIG_FILE="$(pwd)/files/datafiles/config"
MAIN_PORT=$(grep "\bmainport\b" "$CONFIG_FILE" | awk '{ print $2 }')
WIZ_PORT=$(grep "\bwizport\b" "$CONFIG_FILE" | awk '{ print $2 }')
LINK_PORT=$(grep "\blinkport\b" "$CONFIG_FILE" | awk '{ print $2 }')

cat << EOT > Dockerfile
FROM ${OS_ARCH}/alpine
FROM alpine:latest

RUN apk add build-base supervisor bash busybox-extras gdb
RUN apk add --no-cache build-base bash busybox-extras clang gdb lldb supervisor
COPY supervisord.conf /etc/supervisord.conf

WORKDIR /amnuts
Expand All @@ -30,7 +20,6 @@ CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
EOT

cat << EOT > docker-compose.yml
version: "3"
services:
amnuts:
build: ./
Expand All @@ -49,4 +38,4 @@ services:
- seccomp:unconfined
cap_add:
- SYS_PTRACE
EOT
EOT
18 changes: 18 additions & 0 deletions docs/amnuts_changes
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,24 @@
Information on the changes between different version of Amnuts
+------------------------------------------------------------------------------+

2.5.0
-----

Added libtelnet vendor library to help with telnet negotiation
Added workaround to libtelnet to be able to use the '%' symbol in speech :)

Updated the cmdcount command code to make it better

Fixed display bug in the preview command

2.4.0
-----

Almost all of the commands have been moved to their own files, so a fair bit of reworking structure
Added the SDS vendor library to start marking string copying/formatting/sizes a little safer, and made a start on that (long, long) journey
A docker setup has been added for those who want to run or compile Amnuts in a container
Various typos fixed
Some docs updated

2.3.0
-----
Expand Down
Loading