Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e45aa04b05 | |||
| 8e1fcdb108 | |||
| 29f4a67c1c |
@@ -199,3 +199,5 @@ When contributing:
|
||||
1. The version will automatically increment on builds
|
||||
2. For major features, consider manually creating minor version tags
|
||||
3. Generated version files (`src/version.*`, `VERSION`) should not be committed
|
||||
# Test change
|
||||
# Testing -m flag
|
||||
|
||||
45
build.sh
45
build.sh
@@ -13,6 +13,23 @@ print_success() { echo -e "${GREEN}[SUCCESS]${NC} $1"; }
|
||||
print_warning() { echo -e "${YELLOW}[WARNING]${NC} $1"; }
|
||||
print_error() { echo -e "${RED}[ERROR]${NC} $1"; }
|
||||
|
||||
# Global variable for commit message
|
||||
COMMIT_MESSAGE=""
|
||||
|
||||
# Parse command line arguments for -m flag
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
-m|--message)
|
||||
COMMIT_MESSAGE="$2"
|
||||
shift 2
|
||||
;;
|
||||
*)
|
||||
# Keep other arguments for main logic
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Function to automatically increment version
|
||||
increment_version() {
|
||||
print_status "Incrementing version..."
|
||||
@@ -57,8 +74,22 @@ increment_version() {
|
||||
print_warning "Failed to stage changes (maybe not a git repository)"
|
||||
fi
|
||||
|
||||
# Commit changes with version message
|
||||
if git commit -m "Version $NEW_VERSION - Automatic version increment" 2>/dev/null; then
|
||||
# Handle commit message - use global variable if set, otherwise prompt
|
||||
if [[ -z "$COMMIT_MESSAGE" ]]; then
|
||||
echo ""
|
||||
print_status "Please enter a meaningful commit message for version $NEW_VERSION:"
|
||||
echo -n "> "
|
||||
read -r COMMIT_MESSAGE
|
||||
fi
|
||||
|
||||
# Check if user provided a message
|
||||
if [[ -z "$COMMIT_MESSAGE" ]]; then
|
||||
print_warning "No commit message provided. Using default message."
|
||||
COMMIT_MESSAGE="Automatic version increment"
|
||||
fi
|
||||
|
||||
# Commit changes with user-provided message
|
||||
if git commit -m "Version $NEW_VERSION - $COMMIT_MESSAGE" 2>/dev/null; then
|
||||
print_success "Committed changes for version $NEW_VERSION"
|
||||
else
|
||||
print_warning "Failed to commit changes (maybe no changes to commit or not a git repository)"
|
||||
@@ -227,7 +258,10 @@ case "${1:-build}" in
|
||||
;;
|
||||
*)
|
||||
echo "OTP Cipher Build Script"
|
||||
echo "Usage: $0 {build|static|clean|install|uninstall|version}"
|
||||
echo "Usage: $0 [-m \"commit message\"] {build|static|clean|install|uninstall|version}"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " -m, --message \"text\" - Specify commit message (skips interactive prompt)"
|
||||
echo ""
|
||||
echo "Commands:"
|
||||
echo " build - Build project with automatic version increment (default)"
|
||||
@@ -236,6 +270,11 @@ case "${1:-build}" in
|
||||
echo " install - Install to system (requires build first)"
|
||||
echo " uninstall - Remove from system"
|
||||
echo " version - Generate version files only"
|
||||
echo ""
|
||||
echo "Examples:"
|
||||
echo " $0 build"
|
||||
echo " $0 -m \"Fixed checksum parsing bug\" build"
|
||||
echo " $0 --message \"Added new feature\" static"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
8
otp.c
8
otp.c
@@ -920,7 +920,7 @@ int encrypt_text(const char* pad_identifier) {
|
||||
}
|
||||
|
||||
// Output in ASCII armor format
|
||||
printf("\n-----BEGIN OTP MESSAGE-----\n");
|
||||
printf("\n\n-----BEGIN OTP MESSAGE-----\n");
|
||||
printf("Version: %s\n", get_version());
|
||||
printf("Pad-ChkSum: %s\n", chksum_hex);
|
||||
printf("Pad-Offset: %lu\n", current_offset);
|
||||
@@ -932,7 +932,7 @@ int encrypt_text(const char* pad_identifier) {
|
||||
printf("%.64s\n", base64_cipher + i);
|
||||
}
|
||||
|
||||
printf("-----END OTP MESSAGE-----\n\n");
|
||||
printf("-----END OTP MESSAGE-----\n\n\n");
|
||||
|
||||
// Cleanup
|
||||
free(pad_data);
|
||||
@@ -972,8 +972,8 @@ int decrypt_text(const char* pad_identifier) {
|
||||
|
||||
if (!found_begin) continue;
|
||||
|
||||
if (strncmp(line, "Pad-ChkSum: ", 10) == 0) {
|
||||
strncpy(stored_chksum, line + 10, 64);
|
||||
if (strncmp(line, "Pad-ChkSum: ", 12) == 0) {
|
||||
strncpy(stored_chksum, line + 12, 64);
|
||||
stored_chksum[64] = '\0';
|
||||
}
|
||||
else if (strncmp(line, "Pad-Offset: ", 12) == 0) {
|
||||
|
||||
Reference in New Issue
Block a user