X-Git-Url: https://git.infodrom.org/?p=infodrom%2Fdtaus;a=blobdiff_plain;f=dtaus.c;h=e8f935e4f068e9fd4722bfc44dfcb2f09b88f92b;hp=70785f64005b93deda544d898cabf4e95beaedb6;hb=5c04191ccc8b40a8a78fd5dbe1b89ef00932fe89;hpb=8d1968b976c324581401cc9c977434e0cbe20849 diff --git a/dtaus.c b/dtaus.c index 70785f6..e8f935e 100644 --- a/dtaus.c +++ b/dtaus.c @@ -60,6 +60,7 @@ dtaus_record recA[] = { {"BLZ", 7, 8, REQ}, {"Referenz", 70, 10, OPT}, {"Datum", 50, 6, IGN}, + {"Ausfuehrung", 95, 8, OPT}, {"Euro", 127, 1, OPT}, {NULL, 0, 0} }; @@ -70,8 +71,9 @@ dtaus_record recA[] = { #define A_BLZ 3 #define A_REF 4 #define A_DATE 5 -#define A_EURO 6 -#define A_LEN 7 +#define A_TODO 6 +#define A_EURO 7 +#define A_LEN 8 dtaus_record recC[] = { {"Name", 93, 27, REQ}, @@ -146,7 +148,7 @@ dtaus_record recE[] = { size_t dtaus_nextrec (void **buf, FILE *f) { - bzero (buf, 128); + memset (buf, 0, 128); return fread(buf, 128, 1, f); } @@ -364,8 +366,8 @@ char *extract_ident (char *line) static char word[30]; if (strlen(line) > 0) { - x = index (line, ' '); - y = index (line, '\t'); + x = strchr (line, ' '); + y = strchr (line, '\t'); if (!x && !y) { strncpy(word, line, 29); @@ -438,8 +440,8 @@ size_t control_nextline (void **buf, int len, FILE *f) char *cp; int i; - bzero (line, sizeof(line)); - bzero (buf, len); + memset (line, 0, sizeof(line)); + memset (buf, 0, len); cp = line; while (!strlen(line) && (cp = fgets(line, 100, f))) { @@ -492,7 +494,7 @@ void dtaus_prepareA (char *buf) struct tm *loctime; char tmp[10]; - bzero (buf, 129); + memset (buf, 0, 129); timer = time ( NULL ); loctime = localtime(&timer); @@ -508,12 +510,12 @@ void dtaus_prepareA (char *buf) for (i=70;i<70+10; i++) buf[i] = '0'; /* A10 */ for (i=80;i<80+48; i++) buf[i] = ' '; /* A11 */ #ifdef DEFAULT_EURO - buf[127] = '1'; /* A12 (Currency) */ + buf[recA[A_EURO].pos] = '1'; /* A12 (Currency) */ #else if (use_euro) - buf[127] = '1'; /* A12 (Currency) */ + buf[recA[A_EURO].pos] = '1'; /* A12 (Currency) */ else - buf[127] = ' '; /* A12 (Currency) */ + buf[recA[A_EURO].pos] = ' '; /* A12 (Currency) */ #endif } @@ -526,7 +528,7 @@ void dtaus_prepareC (char *buf, int normaltext, int maxtext) int i; int appendix = 0; - bzero (buf, 257); + memset (buf, 0, 257); if (normaltext) appendix = 1; @@ -546,17 +548,17 @@ void dtaus_prepareC (char *buf, int normaltext, int maxtext) for (i=31;i<31+13; i++) buf[i] = '0'; /* C6 */ buf[49] = ' '; /* C8 */ for (i=50;i<50+11; i++) buf[i] = '0'; /* C9 (Betrag) */ - for (i=79;i<79+11; i++) buf[i] = '0'; /* C12 (Euro) */ + for (i=79;i<79+11; i++) buf[i] = '0'; /* C12 (Betrag Euro) */ for (i=90;i<90+3; i++) buf[i] = ' '; /* C13 */ for (i=93;i<90+27; i++) buf[i] = ' '; /* C14a (Kunde) */ for (i=120;i<120+8; i++) buf[i] = ' '; /* C14b */ #ifdef DEFAULT_EURO - buf[182] = '1'; /* C17a (Currency) */ + buf[recC[C_EURO].pos] = '1'; /* C17a (Currency) */ #else if (use_euro) - buf[182] = '1'; /* C17a (Currency) */ + buf[recC[C_EURO].pos] = '1'; /* C17a (Currency) */ else - buf[182] = ' '; /* C17a (Currency) */ + buf[recC[C_EURO].pos] = ' '; /* C17a (Currency) */ #endif for (i=183;i<183+2; i++) buf[i] = ' '; /* C17b */ for (i=187;i<187+(29*2); i++) buf[i] = ' '; /* C19-C22 (misc text) */ @@ -574,7 +576,7 @@ void dtaus_prepareE (char *buf) { int i; - bzero (buf, 129); + memset (buf, 0, 129); buf[0] = '0'; buf[1] = '1'; buf[2] = '2'; @@ -609,12 +611,16 @@ 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 (strip_nondigits (values[A_BLZ]),8)); - for (i=0; i<8; i++) buf[recA[A_BLZ].pos+i] = tmp[i]; + sprintf (tmp, "%s", padzeroclip (strip_nondigits (values[A_BLZ]),recA[A_BLZ].len)); + for (i=0; i