--- /dev/null
+.\" 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 .
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))
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;
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;
}
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';
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);
}
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];
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);