From 9bd972a5beb226671f24319789b19a1f762d0329 Mon Sep 17 00:00:00 2001 From: Fabian Kurz Date: Thu, 3 Jul 2008 13:13:55 +0000 Subject: [PATCH] readconfig, etc. --- ChangeLog | 2 +- ebook2cw.bat | 25 +++++++++++++++++++++++++ ebook2cw.c | 17 ++++++----------- isomap.txt | 35 +++++++++++++++++------------------ releases/md5sums.txt | 10 ---------- utf8map.txt | 40 +++++++++++++++++++--------------------- 6 files changed, 68 insertions(+), 61 deletions(-) create mode 100644 ebook2cw.bat delete mode 100644 releases/md5sums.txt diff --git a/ChangeLog b/ChangeLog index dd20421..81de49f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -0.7.0 / 2008-06-?? Fabian Kurz +0.7.0 / 2008-07-03 Fabian Kurz * Paragraph separator () can be disabled by -p command line switch (suggested by DJ3KU). * All command line parameters can now also be set in the config diff --git a/ebook2cw.bat b/ebook2cw.bat new file mode 100644 index 0000000..94af6ae --- /dev/null +++ b/ebook2cw.bat @@ -0,0 +1,25 @@ +@echo off +echo ebook2cw - Batch file for Windows. +echo - +echo Usage: You will be promted for a filename and (at your option) +echo additional parameters for ebook2cw (such as wpm, tone freq etc). +echo - +echo If a config file (ebook2cw.conf) was found in the current directory, +echo the settings in this file are used, but any settings you specify +echo here will override those. +echo - +echo - +echo Enter the name of the text file to convert to CW. Note that you can +echo simply drag and drop a file from the Windows Explorer to this window. +echo - +set /p file="Text file: " +echo - +echo Enter any additional command line parameters for ebook2cw, or leave +echo just press enter to use the values from ebook2cw.conf. +echo - +set /p par="Parameters: " +echo - +ebook2cw.exe %par% %file% +echo Done. +pause + diff --git a/ebook2cw.c b/ebook2cw.c index 4d20393..642f38f 100644 --- a/ebook2cw.c +++ b/ebook2cw.c @@ -89,7 +89,7 @@ int use_isomapping = 0; int use_utf8mapping = 0; /* Config file location */ -char *configfile = "ebook2cw.conf"; +char configfile[1024] = "ebook2cw.conf"; /* ID3-tag data: author and title */ char id3_author[80]="CW audio book"; @@ -124,15 +124,11 @@ int main (int argc, char** argv) { printf("ebook2cw %s - (c) 2008 by Fabian Kurz, DJ1YFK\n\n", VERSION); - /* Find and read ebook2cw.conf - * - * TODO: Find in ~/.ebook2cw/ - * + /* + * Find and read ebook2cw.conf */ - if (fopen(configfile, "r") != NULL) { - readconfig(); - } + readconfig(); while((i=getopt(argc,argv, "o:w:W:e:f:uc:k:Q:R:pF:s:b:q:a:t:y:S:hn"))!= -1){ setparameter(i, optarg); @@ -653,11 +649,10 @@ void readconfig (void) { char tmp[81] = ""; char p; /* parameter */ char v[80]=""; /* value */ - static char mapfile[256]=""; + static char mapfile[1024]=""; if ((conf = fopen(configfile, "r")) == NULL) { - fprintf(stderr, "Error: Unable to open config file %s!\n", configfile); - exit(EXIT_FAILURE); + return; /* No config found -> silently ignore */ } printf("Reading configuration file: %s\n\n", configfile); diff --git a/isomap.txt b/isomap.txt index 622c1e4..22d9c73 100644 --- a/isomap.txt +++ b/isomap.txt @@ -1,18 +1,17 @@ -# Example ISO8859 character mapping file of ebook2cw. -# -# The format of each line is: -# x=yyy -# -# where x is the character to be mapped to the string yyy -# -# x is a single character, yyy is a string of up to 3 characters. - - -ä=ae -ö=oe -ü=ue -Ä=aw -Ü=ue -Ö=oe -ß=sz - +# Example ISO8859 character mapping file of ebook2cw. +# +# The format of each line is: +# x=yyy +# +# where x is the character to be mapped to the string yyy +# +# x is a single character, yyy is a string of up to 3 characters. + +ä=ae +ö=oe +ü=ue +Ä=aw +Ü=ue +Ö=oe +ß=sz + diff --git a/releases/md5sums.txt b/releases/md5sums.txt deleted file mode 100644 index 9d22c8e..0000000 --- a/releases/md5sums.txt +++ /dev/null @@ -1,10 +0,0 @@ -d586035356b3040af0d4ebc82205b335 releases/ebook2cw-0.4.0.tar.gz -0df0ae175e71743aaea1c6d9526966dc releases/ebook2cw-0.5.0.tar.gz -1c170b6593ad2b8c6fdef55b5ead9a54 releases/ebook2cw-0.5.1.tar.gz -a40768d09676012d62d60852dd59449c releases/ebook2cw-0.5.3.tar.gz -57fafc5382fa38c4e646f1deaf116ae0 releases/ebook2cw-0.6.0.tar.gz -f843ff84f3a8fa5234e5c1fe694d26c6 releases/ebook2cw-0.6.1.tar.gz -58accf8bbd8d1f5b582c444b107fac84 releases/ebook2cw-0.6.2.tar.gz -0c8b2f40812f8405f5dc266e95d9590f releases/ebook2cw-0.6.3.tar.gz -bea78588dada08449a7065fe6222ca75 releases/ebook2cw-0.6.4.tar.gz -9b00b5c4093ed02c75ccadea0b4734d2 releases/ebook2cw-0.7.0.tar.gz diff --git a/utf8map.txt b/utf8map.txt index 33b23ab..f38d4ae 100644 --- a/utf8map.txt +++ b/utf8map.txt @@ -1,21 +1,19 @@ -# UTF-8 mapping example for ebook2cw.. -# -# The format of each line is: -# x=yyy -# -# where x is the character to be mapped to the string yyy -# -# x is a single character, yyy is a string of up to 3 characters. - -ä=ae -ü=ue -ö=oe -Ä=ae -Ü=ue -Ö=oe -ß=sz - - - - - +# UTF-8 mapping example for ebook2cw.. +# +# The format of each line is: +# x=yyy +# +# where x is the character to be mapped to the string yyy +# +# x is a single character, yyy is a string of up to 3 characters. + +ä=ae +ü=ue +ö=oe +Ä=ae +Ü=ue +Ö=oe +ß=sz + + +