Version v0.3.41 - -m Suppress miniz library warnings, auto-select pad when only one available

This commit is contained in:
2025-12-27 11:49:29 -05:00
parent 6fe12e0c1c
commit e126e30889
4 changed files with 34 additions and 12 deletions

View File

@@ -1,25 +1,40 @@
CC = gcc
CFLAGS = -Wall -Wextra -std=c99 -Isrc -Isrc/miniz -Isrc/microtar
CFLAGS_MINIZ = -Wall -Wextra -std=c99 -D_POSIX_C_SOURCE=200112L -Isrc -Isrc/miniz -Isrc/microtar -Wno-unused-function -Wno-implicit-function-declaration
LIBS = -lm
LIBS_STATIC = -static -lm
ARCH = $(shell uname -m)
TARGET = build/otp-$(ARCH)
SOURCES = $(wildcard src/*.c) $(wildcard src/miniz/*.c) $(wildcard src/microtar/*.c)
SOURCES = $(wildcard src/*.c)
MINIZ_SOURCES = $(wildcard src/miniz/*.c)
MICROTAR_SOURCES = $(wildcard src/microtar/*.c)
OBJS = $(SOURCES:.c=.o)
MINIZ_OBJS = $(MINIZ_SOURCES:.c=.o)
MICROTAR_OBJS = $(MICROTAR_SOURCES:.c=.o)
ALL_OBJS = $(OBJS) $(MINIZ_OBJS) $(MICROTAR_OBJS)
# Default build target
$(TARGET): $(OBJS)
$(TARGET): $(ALL_OBJS)
@mkdir -p build
$(CC) $(CFLAGS) -o $(TARGET) $(OBJS) $(LIBS)
@rm -f $(OBJS)
$(CC) $(CFLAGS) -o $(TARGET) $(ALL_OBJS) $(LIBS)
@rm -f $(ALL_OBJS)
# Static linking target
static: $(OBJS)
static: $(ALL_OBJS)
@mkdir -p build
$(CC) $(CFLAGS) -o $(TARGET) $(OBJS) $(LIBS_STATIC)
@rm -f $(OBJS)
$(CC) $(CFLAGS) -o $(TARGET) $(ALL_OBJS) $(LIBS_STATIC)
@rm -f $(ALL_OBJS)
%.o: %.c
# Compile main source files with full warnings
src/%.o: src/%.c
$(CC) $(CFLAGS) -c $< -o $@
# Compile miniz library files with reduced warnings
src/miniz/%.o: src/miniz/%.c
$(CC) $(CFLAGS_MINIZ) -c $< -o $@
# Compile microtar library files normally
src/microtar/%.o: src/microtar/%.c
$(CC) $(CFLAGS) -c $< -o $@
clean:

View File

@@ -58,14 +58,14 @@ One-time pads can be trivially encrypted and decrypted using pencil and paper, m
### Download Pre-Built Binaries
**[Download Current Linux x86](https://git.laantungir.net/laantungir/otp/releases/download/v0.3.39/otp-v0.3.39-linux-x86_64)**
**[Download Current Linux x86](https://git.laantungir.net/laantungir/otp/releases/download/v0.3.40/otp-v0.3.40-linux-x86_64)**
**[Download Current Raspberry Pi 64](https://git.laantungir.net/laantungir/otp/releases/download/v0.3.39/otp-v0.3.39-linux-arm64)**
**[Download Current Raspberry Pi 64](https://git.laantungir.net/laantungir/otp/releases/download/v0.3.40/otp-v0.3.40-linux-arm64)**
After downloading:
```bash
# Rename for convenience, then make executable
mv otp-v0.3.39-linux-x86_64 otp
mv otp-v0.3.40-linux-x86_64 otp
chmod +x otp
# Run it

View File

@@ -23,7 +23,7 @@
#include <ctype.h>
// Version - Updated automatically by build.sh
#define OTP_VERSION "v0.3.39"
#define OTP_VERSION "v0.3.40"
// Constants
#define MAX_INPUT_SIZE 4096

View File

@@ -470,6 +470,13 @@ char* select_pad_interactive(const char* title, const char* prompt, pad_filter_t
return NULL;
}
// If only one pad available, auto-select it
if (pad_count == 1) {
printf("\n%s\n", title);
printf("Only one pad available - auto-selecting: %.16s...\n\n", pads[0].chksum);
return strdup(pads[0].chksum);
}
// Calculate minimal unique prefixes for each pad
char prefixes[100][65];
int prefix_lengths[100];