/*
dtaus.c - Datenträgeraustausch mit einer Bank
- Copyright (c) 1996 Martin Schulze <joey@artis.uni-oldenburg.de>
+ Copyright (c) 1996,8 Martin Schulze <joey@artis.uni-oldenburg.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
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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
$Id$
*/
{"BLZ", 7, 8, REQ},
{"Referenz", 70, 10, OPT},
{"Datum", 50, 6, IGN},
+ {"Euro", 127, 1, OPT},
{NULL, 0, 0}
};
#define A_BLZ 3
#define A_REF 4
#define A_DATE 5
-#define A_LEN 6
+#define A_EURO 6
+#define A_LEN 7
dtaus_record recC[] = {
{"Name", 93, 27, REQ},
{"myName", 128, 27, OPT},
{"myKonto", 69, 10, OPT},
{"myBLZ", 61, 8, OPT},
+ {"Euro", 182, 1, IGN},
{"Text", 187, 29, OPT},
{"Extension", 216, 29, OPT},
{NULL, 0, 0}
#define C_MYNAM 6
#define C_MYKTO 7
#define C_MYBLZ 8
-#define C_TEXT 9
-#define C_EXT 10
-#define C_LEN 11
+#define C_EURO 9
+#define C_TEXT 10
+#define C_EXT 11
+#define C_LEN 12
dtaus_record recE[] = {
{"Anzahl", 10, 7, IGN},
return 0;
}
+ i=A_NAME;if (values[i] && strlen(values[i]) > recA[i].len)
+ values[i][recA[i].len] = '\0';
+
dtaus_prepareA(buf);
buf[5] = values[A_TRANS][0];
buf[6] = values[A_TRANS][1];
return 0;
}
+ i=C_TEXT;if (values[i] && strlen(values[i]) > recC[i].len)
+ values[i][recC[i].len] = '\0';
+ i=C_ZWECK;if (values[i] && strlen(values[i]) > recC[i].len)
+ values[i][recC[i].len] = '\0';
+ i=C_MYNAM;if (values[i] && strlen(values[i]) > recC[i].len)
+ values[i][recC[i].len] = '\0';
+ i=C_TEXT;if (values[i] && strlen(values[i]) > recC[i].len)
+ values[i][recC[i].len] = '\0';
+ i=C_EXT;if (values[i] && strlen(values[i]) > recC[i].len)
+ values[i][recC[i].len] = '\0';
+
dtaus_prepareC(buf);
if (!values[C_TEXT]) {
buf[1] = '1';
return 1;
}
+void printctln(FILE *f, char *field, char *value)
+{
+ if (strlen(field) && strlen(value))
+ fprintf(f, " %s\t%s\n", field, value);
+}
+
+
/*
* Third: Some high level routines
*/
for (index=A_TRANS; index < A_DATE; index++) {
bufp = buf + recA[index].pos;
memcpy(tmp, bufp, recA[index].len); tmp[recA[index].len] = '\0';
- fprintf(fcontrol, " %s\t%s\n", recA[index].name, strip_zeros(strip_spaces(tmp)));
+ printctln(fcontrol, recA[index].name, strip_zeros(strip_spaces(tmp)));
}
index = A_DATE; bufp = buf + recA[index].pos;
memcpy(tmp, bufp, recA[index].len); tmp[recA[index].len] = '\0';
- fprintf(fcontrol, " %s\t%s\n", recA[index].name, strip_spaces(tmp));
+ printctln(fcontrol, recA[index].name, strip_spaces(tmp));
+
+ index = A_EURO; bufp = buf + recA[index].pos;
+ memcpy(tmp, bufp, recA[index].len); tmp[recA[index].len] = '\0';
+ printctln(fcontrol, recA[index].name, strip_zeros(strip_spaces(tmp)));
fprintf(fcontrol, "}\n\n");
} else {
if (dtaus_nextrec(bufp, fdtaus) == 1) {
fprintf(fcontrol, "{\n");
- for (index=C_NAME; index <= C_MYBLZ; index++) {
+ for (index=C_NAME; index <= C_EURO; index++) {
bufp = buf + recC[index].pos;
memcpy(tmp, bufp, recC[index].len); tmp[recC[index].len] = '\0';
if (index == C_VAL)
- fprintf(fcontrol, " %s\t%s\n", recC[index].name, strip_zeros(string2real(tmp)));
+ printctln(fcontrol, recC[index].name, strip_zeros(string2real(tmp)));
else if (index == C_TRANS)
- fprintf(fcontrol, " %s\t%s\n", recC[index].name, string2trans(tmp));
+ printctln(fcontrol, recC[index].name, strip_zeros(string2trans(tmp)));
else
- fprintf(fcontrol, " %s\t%s\n", recC[index].name, strip_zeros(strip_spaces(tmp)));
+ printctln(fcontrol, recC[index].name, strip_zeros(strip_spaces(tmp)));
}
for (index=C_TEXT; index <= C_EXT; index++) {
bufp = buf + recC[index].pos;
memcpy(x, bufp, 2); tmp[2] = '\0'; bufp+=2;
memcpy(tmp, bufp, recC[index].len-2); tmp[recC[index].len-2] = '\0';
- fprintf(fcontrol, " %s\t%s\n", string2ext(x), strip_spaces(tmp));
+ printctln(fcontrol, string2ext(x), strip_spaces(tmp));
}
}
bufp = buf + recE[index].pos;
memcpy(tmp, bufp, recE[index].len); tmp[recE[index].len] = '\0';
if (index == E_VAL)
- fprintf(fcontrol, " %s\t%s\n", recE[index].name, strip_zeros(string2real(tmp)));
+ printctln(fcontrol, recE[index].name, strip_zeros(string2real(tmp)));
else
- fprintf(fcontrol, " %s\t%s\n", recE[index].name, strip_zeros(tmp));
+ printctln(fcontrol, recE[index].name, strip_zeros(tmp));
}
fprintf(fcontrol, "}\n");
if (recC[recindex].type != IGN)
if ((valC[recindex] = (char *)malloc (strlen(line)+1)))
strcpy(valC[recindex], line);
+ else
+ return 0;
control_nextline ((void *)line, 100, fcontrol);
}
if (!dtaus_writeC(fdtaus, valA, valC)) {