- Added short description for control files
authorJoey Schulze <joey@infodrom.org>
Tue, 4 Jan 2000 16:10:42 +0000 (16:10 +0000)
committerJoey Schulze <joey@infodrom.org>
Tue, 4 Jan 2000 16:10:42 +0000 (16:10 +0000)
 - Ensured that BLZ and KTO consist only of digits, even if the
   user has specified something different.  Banks won't accept files
   otherwise.

 - Applied fix for a y2k issue that prevents some banks from
   accepting the files.

 - Improved README file, added links to the web page and the mailing list.

 - Added TODO file

 - This shall become version 0.4

ChangeLog
Makefile
README
TODO [new file with mode: 0644]
dtaus.5 [new file with mode: 0644]
dtaus.c

index f6d9b7c..05dd684 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2000-01-04  Martin Schulze  <joey@finlandia.infodrom.north.de>
+
+       * Version 0.4
+
+       * Added short description for control files
+
+       * Ensured that BLZ and KTO consist only of digits, even if the
+       user has specified something different.  Banks won't accept files
+       otherwise.
+
+       * Applied fix for a y2k issue that prevents some banks from
+       accepting the files.
+
 1998-11-16  Martin Schulze  <joey@finlandia.infodrom.north.de>
 
        * Added information about different types of dtaus files to README
index 33aaebe..d4f61db 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
 #   Makefile - Datentraegeraustausch mit einer Bank
-#   Copyright (c) 1996,8  Martin Schulze <joey@artis.uni-oldenburg.de>
+#   Copyright (c) 1996,8,2000  Martin Schulze <joey@infodrom.north.de>
 #
 #   This program is free software; you can redistribute it and/or modify
 #   it under the terms of the GNU General Public License as published by
diff --git a/README b/README
index 5cfa889..999a548 100644 (file)
--- a/README
+++ b/README
@@ -47,6 +47,13 @@ the two-letter code within the double quotes.
     "GB" für Gutschriften Bankseitig
     "GK" für Gutschriften Kundenseitig
 
+More Information
+----------------
+
+  Web: http://www.infodrom.north.de/dtaus/
+
+  Mail: dtaus@infodrom.north.de (Majordomo and SmartList driven)
+
 
 Good luck!
 
diff --git a/TODO b/TODO
new file mode 100644 (file)
index 0000000..2e06a44
--- /dev/null
+++ b/TODO
@@ -0,0 +1,20 @@
+$Id$
+
+TODO List
+---------
+
+ . Include full support for new upcoming Euro currency.
+
+ . Include consistency test for dtaus files.  It is possible to check
+   all BLZ and KTO against some patterns.  At ping.de some algorithms
+   were implemented.  There's also a list of valid BLZs somewhere
+
+ . Add some nice GUI for control file creation
+
+ . Add proper documentation of the control file
+
+ . Add support for more text fields
+
+
+                                               Martin Schulze
+                                          <joey@infodrom.north.de>
diff --git a/dtaus.5 b/dtaus.5
new file mode 100644 (file)
index 0000000..8203529
--- /dev/null
+++ b/dtaus.5
@@ -0,0 +1,80 @@
+.\" dtaus - Converter for DTAUS files
+.\" Copyright (c) 2000  Martin Schulze <joey@infodrom.north.de>
+.\"
+.\" This program is free software; you can redistribute it and/ormodify
+.\" it under the terms of the GNU General Public License as published by
+.\" the Free Software Foundation; either version 2 of the License, or
+.\" (at your option) any later version.
+.\"
+.\" This program is distributed in the hope that it will be useful,
+.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
+.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+.\" GNU General Public License for more details.
+.\"
+.\" You should have received a copy of the GNU General Public License
+.\" along with this program; if not, write to the Free Software
+.\" Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+.\"
+.TH DTAUS 5 "4 January 2000" "" ""
+.SH NAME
+dtaus \- Converter for DTAUS files
+.SH DESCRIPTION
+The
+.BR dtaus (1)
+program reads and writes German DTAUS files.  DTAUS is an acronym for
+.BR D aten T räger AUS tausch.
+It is used by German credit institutes in order to implement money
+exchanges between accounts and credit institutes.  These files are
+always called
+.IR dtaus0.txt .
+
+Since they are shipped in a weird ascii format that is not quite
+readable and writable for humans a special control format was
+implemented.  The
+.BR dtaus (1)
+program reads and writes such a control file and generates a proper
+DTAUS file if requested.
+
+.SH "CONTROL FILE"
+The control file implements a very simple format.  Empty lines and
+those beginning with a hash (`#') mark are ignored.  The remaining
+file is splitted into three major parts: one BEGIN record, several
+regular records and one optional END record, which is ignored when the
+file is read but is extracted from the
+.I dtaus0.txt
+file.
+
+Here's a short sample for a control file:
+
+  BEGIN {
+    Art   LK
+    Name  Martin Schulze
+    Konto 123545
+    BLZ   2004002
+  }
+
+  {
+    Transaktion Einzug
+    Name   Martha Schulze
+    Konto  98832
+    BLZ    2004003
+    Betrag 20.00
+    Zweck  Gebühr Wohnheimnetz
+    Text   Anschluß u. 11+12.97
+  }
+
+  ...
+
+German Umlauts are converted on the fly so you don't need to care
+about them.  Since the
+.I dtaus0.txt
+file only uses uppercase letters every text is also converted to
+uppercase.
+
+Except for the way records are delimited the format should be self
+explanatory.
+
+.SH "SEE ALSO"
+DTAUS files use a special but simple and freely documented format.
+It is included in the distribution of dtaus as
+.IR dtaus.txt .
diff --git a/dtaus.c b/dtaus.c
index f76cbda..8f16662 100644 (file)
--- a/dtaus.c
+++ b/dtaus.c
@@ -155,7 +155,8 @@ char *downcase(char *s)
   static char x[100];
   char *cp;
 
-  strcpy (x, s);
+  memset (x, 0, sizeof (x));
+  strncpy (x, s, 99);
   
   for (cp=x;*cp;cp++)
     if (isupper(*cp))
@@ -182,7 +183,20 @@ char *strip_zeros (char *s)
   return p;
 }
 
-char dtaus_char(void *buf, unsigned int pos)
+char *strip_nondigits (char *s)
+{
+  char *p;
+  char *x;
+
+  for (x=s,p=s;*x;*x++)
+    if (isdigit (*x))
+      *(p++) = *x;
+  *(p++) = '\0';
+
+  return s;
+}
+
+char dtaus_char (void *buf, unsigned int pos)
 {
   static char res;
   char *bufp = buf;
@@ -430,7 +444,7 @@ char *get_date()
 
   timer = time ( NULL );
   loctime = localtime(&timer);
-  sprintf(res, "%02d.%02d.%02d", loctime->tm_mday, loctime->tm_mon+1, loctime->tm_year);
+  sprintf(res, "%02d.%02d.%02d", loctime->tm_mday, loctime->tm_mon+1, loctime->tm_year % 100);
   return res;
 }
 
@@ -451,7 +465,7 @@ void dtaus_prepareA(char *buf)
   buf[3] = '8';
   buf[4] = 'A';
   for (i=15;i<15+8; i++) buf[i] = '0';
-  sprintf(tmp, "%02d%02d%2d", loctime->tm_mday, loctime->tm_mon+1, loctime->tm_year);
+  sprintf(tmp, "%02d%02d%02d", loctime->tm_mday, loctime->tm_mon+1, loctime->tm_year % 100);
   for (i=0; i<6; i++) buf[50+i] = tmp[i];
   for (i=56;i<56+4; i++) buf[i] = ' ';
   for (i=70;i<70+10; i++) buf[i] = '0';
@@ -517,11 +531,11 @@ int dtaus_writeA(FILE *f, char **values)
   dtaus_prepareA(buf);
   buf[5] = values[A_TRANS][0];
   buf[6] = values[A_TRANS][1];
-  sprintf (tmp, "%s", padzeroclip(values[A_BLZ],8));
+  sprintf (tmp, "%s", padzeroclip (strip_nondigits (values[A_BLZ]),8));
   for (i=0; i<8; i++) buf[recA[A_BLZ].pos+i] = tmp[i];
   sprintf (tmp, "%-27s", upcase(values[A_NAME]));
   for (i=0; i<27; i++) buf[recA[A_NAME].pos+i] = tmp[i];
-  sprintf (tmp, "%s", padzeroclip(values[A_KTO],10));
+  sprintf (tmp, "%s", padzeroclip (strip_nondigits (values[A_KTO]),10));
   for (i=0; i<10; i++) buf[recA[A_KTO].pos+i] = tmp[i];
 
   fputs(buf, f);
@@ -570,21 +584,21 @@ int dtaus_writeC(FILE *f, char **valuesA, char **values)
   }
   for (i=0; i<5; i++) buf[recC[C_TRANS].pos+i] = tmp[i];
   if (values[C_MYBLZ])
-    sprintf (tmp, "%s", padzeroclip(values[C_MYBLZ],8));
+    sprintf (tmp, "%s", padzeroclip (strip_nondigits (values[C_MYBLZ]),8));
   else
-    sprintf (tmp, "%s", padzeroclip(valuesA[A_BLZ],8));
+    sprintf (tmp, "%s", padzeroclip (strip_nondigits (valuesA[A_BLZ]),8));
   for (i=0; i<recC[C_MYBLZ].len; i++) buf[5+i] = tmp[i];
   for (i=0; i<recC[C_MYBLZ].len; i++) buf[recC[C_MYBLZ].pos+i] = tmp[i];
-  sprintf (tmp, "%s", padzeroclip(values[C_BLZ],8));
+  sprintf (tmp, "%s", padzeroclip (strip_nondigits (values[C_BLZ]),8));
   for (i=0; i<recC[C_BLZ].len; i++) buf[recC[C_BLZ].pos+i] = tmp[i];
-  sprintf (tmp, "%s", padzeroclip(values[C_KTO],10));
+  sprintf (tmp, "%s", padzeroclip (strip_nondigits (values[C_KTO]),10));
   for (i=0; i<recC[C_KTO].len; i++) buf[recC[C_KTO].pos+i] = tmp[i];
-  sprintf (tmp, "%s", padzeroclip(real2string(values[C_VAL]),11));
+  sprintf (tmp, "%s", padzeroclip (real2string(values[C_VAL]),11));
   for (i=0; i<recC[C_VAL].len; i++) buf[recC[C_VAL].pos+i] = tmp[i];
   if (values[C_MYKTO])
-    sprintf (tmp, "%s", padzeroclip(values[C_MYKTO],10));
+    sprintf (tmp, "%s", padzeroclip (strip_nondigits (values[C_MYKTO]),10));
   else
-    sprintf (tmp, "%s", padzeroclip(valuesA[A_KTO],10));
+    sprintf (tmp, "%s", padzeroclip (strip_nondigits (valuesA[A_KTO]),10));
   for (i=0; i<recC[C_MYKTO].len; i++) buf[recC[C_MYKTO].pos+i] = tmp[i];
   sprintf (tmp, "%-27s", upcase(values[C_NAME]));
   for (i=0; i<recC[C_NAME].len; i++) buf[recC[C_NAME].pos+i] = tmp[i];
@@ -622,16 +636,16 @@ int dtaus_writeE(FILE *f, int count, bigint sum, bigint blz, bigint kto)
   sprintf (tmp, "%07d", count);
   for (i=0; i<recE[E_COUNT].len; i++) buf[recE[E_COUNT].pos+i] = tmp[i];
   bigint_sprintf (tmp, "%s", sum);
-  padzeroclip(tmp,13);
+  padzeroclip (tmp,13);
   for (i=0; i<recE[E_VAL].len; i++) buf[recE[E_VAL].pos+i] = tmp[i];
   bigint_sprintf (tmp, "%s", sum);
-  padzeroclip(tmp,13);
+  padzeroclip (tmp,13);
   for (i=0; i<recE[E_VAL].len; i++) buf[recE[E_VAL].pos+i] = tmp[i];
   bigint_sprintf (tmp, "%s", kto);
-  padzeroclip(tmp,17);
+  padzeroclip (tmp,17);
   for (i=0; i<recE[E_KTO].len; i++) buf[recE[E_KTO].pos+i] = tmp[i];
   bigint_sprintf (tmp, "%s", blz);
-  padzeroclip(tmp,17);
+  padzeroclip (tmp,17);
   for (i=0; i<recE[E_BLZ].len; i++) buf[recE[E_BLZ].pos+i] = tmp[i];
 
   fputs(buf, f);