Import ebook2cw-0.8.5.

ebook2cw is a command line program which converts a plain text ebook to
morse code MP3 or OGG files. It works on several platforms, including
Windows, Linux, FreeBSD and OpenBSD.

It automatically splits and numbers the output files by chapters.

From Enzo Nicosia; thanks!

ok sthen@
This commit is contained in:
bentley
2025-12-22 13:39:52 +00:00
parent ff9ab100d4
commit 0af0d45d3c
6 changed files with 152 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
COMMENT = convert ebooks to CW (Morse code)
DISTNAME = ebook2cw-0.8.5
CATEGORIES = comms hamradio
HOMEPAGE = https://fkurz.net/ham/ebook2cw.html
MAINTAINER = Enzo Nicosia <me@katolaz.net>
# GPLv2+
PERMIT_PACKAGE = Yes
WANTLIB += c m mp3lame ogg vorbis vorbisenc intl
SITES = https://fkurz.net/ham/ebook2cw/
BUILD_DEPENDS = devel/gettext,-tools
LIB_DEPENDS = audio/lame \
audio/libvorbis \
audio/libogg \
devel/gettext,-runtime
USE_GMAKE = Yes
MAKE_FLAGS = DESTDIR=${PREFIX}
FAKE_FLAGS = DESTDIR=${WRKINST}${PREFIX}
NO_TEST = yes
DEBUG_PACKAGES = ${BUILD_PACKAGES}
.include <bsd.port.mk>
+2
View File
@@ -0,0 +1,2 @@
SHA256 (ebook2cw-0.8.5.tar.gz) = Vx9zTxISO0r/utkLVd1MljCyVK/jQ/piH8URS5vSX8M=
SIZE (ebook2cw-0.8.5.tar.gz) = 34619
+37
View File
@@ -0,0 +1,37 @@
share/doc/ebook2cw/examples is used in manual and the code (to copy
across a default) so not patching to use share/examples here
Index: Makefile
--- Makefile.orig
+++ Makefile
@@ -22,6 +22,9 @@ UNAME := $(shell uname)
ifeq ($(UNAME), Darwin)
LDFLAGS += -lintl
+else ifeq ($(UNAME), OpenBSD)
+ LDFLAGS += -lintl -L/usr/local/lib
+ CFLAGS += -I/usr/local/include
endif
all: ebook2cw
@@ -40,13 +43,13 @@ static:
$(CC) -static ebook2cw.c $(LDFLAGS) -lm $(CFLAGS) -o ebook2cw
install:
- install -d -v $(DESTDIR)/share/man/man1/
- install -d -v $(DESTDIR)/bin/
- install -d -v $(DESTDIR)/share/doc/ebook2cw/
- install -d -v $(DESTDIR)/share/doc/ebook2cw/examples/
- install -d -v $(DESTDIR)/share/locale/de/LC_MESSAGES/
- install -s -m 0755 ebook2cw $(DESTDIR)/bin/
- install -m 0644 ebook2cw.1 $(DESTDIR)/share/man/man1/
+ install -d $(DESTDIR)/man/man1/
+ install -d $(DESTDIR)/bin/
+ install -d $(DESTDIR)/share/doc/ebook2cw/
+ install -d $(DESTDIR)/share/doc/ebook2cw/examples/
+ install -d $(DESTDIR)/share/locale/de/LC_MESSAGES/
+ install $(INSTALL_STRIP) -m 0755 ebook2cw $(DESTDIR)/bin/
+ install -m 0644 ebook2cw.1 $(DESTDIR)/man/man1/
install -m 0644 README $(DESTDIR)/share/doc/ebook2cw/
install -m 0644 ebook2cw.conf $(DESTDIR)/share/doc/ebook2cw/examples/
install -m 0644 isomap.txt $(DESTDIR)/share/doc/ebook2cw/examples/
+68
View File
@@ -0,0 +1,68 @@
Index: ebook2cw.c
--- ebook2cw.c.orig
+++ ebook2cw.c
@@ -394,7 +394,7 @@ cw.encoding = UTF8;
else {
sscanf(querystring, "s=%d&e=%d&f=%d&t=%9000s", &cw.wpm, &cw.farnsworth, &cw.freq, text);
}
- strcat(text, " ");
+ strlcat(text, " ", sizeof(text));
urldecode(text);
if (cw.wpm == 0 || cw.freq == 0) {
@@ -407,7 +407,7 @@ cw.encoding = UTF8;
init_cw(&cw); /* generate raw dit, dah */
if (strlen(cw.chapterstr)) {
- strcat(cw.chapterstr, " ");
+ strlcat(cw.chapterstr, " ", sizeof(cw.chapterstr));
}
cw.original_wpm = cw.wpm; /* may be changed by QRQing */
@@ -1496,7 +1496,7 @@ char *mapstring (char * string, CWP *cw) {
break;
}
else if (cw->isomapindex[i] == c) {
- strcat(new, cw->isomap[i]);
+ strlcat(new, cw->isomap[i], sizeof(new));
replaced = 1;
break;
}
@@ -1529,7 +1529,7 @@ char *mapstring (char * string, CWP *cw) {
break;
}
else if (cw->utf8mapindex[i] == j) {
- strcat(new, cw->utf8map[i]);
+ strlcat(new, cw->utf8map[i], sizeof(new));
replaced = 1;
break;
}
@@ -2090,8 +2090,8 @@ void init_cwp (CWP *cw) {
cw->noisebuf_size = NOISEBUFFER;
cw->mp3buffer_size = MP3BUFFER;
cw->ditlen = 0;
- strcpy(cw->chapterstr, _("CHAPTER"));
- strcpy(cw->chapterfilename, _("Chapter"));
+ strncpy(cw->chapterstr, _("CHAPTER"), sizeof(cw->chapterstr));
+ strncpy(cw->chapterfilename, _("Chapter"), sizeof(cw->chapterfilename));
cw->chaptertime = 0;
cw->chapterwords = 0;
@@ -2104,12 +2104,12 @@ void init_cwp (CWP *cw) {
cw->linecount = 1;
cw->linepos = 0;
- strcpy(cw->configfile, "ebook2cw.conf");
+ strncpy(cw->configfile, "ebook2cw.conf", sizeof(cw->configfile));
- strcpy(cw->id3_author, _("CW audio book"));
- strcpy(cw->id3_title, "");
- strcpy(cw->id3_comment, _("Generated by ebook2cw"));
- strcpy(cw->id3_year, "");
+ strncpy(cw->id3_author, _("CW audio book"), sizeof(cw->id3_author));
+ strncpy(cw->id3_title, "", sizeof(cw->id3_title));
+ strncpy(cw->id3_comment, _("Generated by ebook2cw"), sizeof(cw->id3_comment));
+ strncpy(cw->id3_year, "", sizeof(cw->id3_year));
cw->outfile_length = 0;
+5
View File
@@ -0,0 +1,5 @@
ebook2cw is a command line program which converts a plain text ebook to
morse code MP3 or OGG files. It works on several platforms, including
Windows, Linux, FreeBSD and OpenBSD.
It automatically splits and numbers the output files by chapters.
+9
View File
@@ -0,0 +1,9 @@
@bin bin/ebook2cw
@man man/man1/ebook2cw.1
share/doc/ebook2cw/
share/doc/ebook2cw/README
share/doc/ebook2cw/examples/
share/doc/ebook2cw/examples/ebook2cw.conf
share/doc/ebook2cw/examples/isomap.txt
share/doc/ebook2cw/examples/utf8map.txt
share/locale/de/LC_MESSAGES/ebook2cw.mo