summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
3aa92ae)
. C1 = Logical length of record C, i.e. 187 + number of extension records.
``Die Satzlängenangabe gezieht sich mit Ausnahme des konstanten
Teils nicht auf die Satzabschnittlänge der Disketten, sondern auf
die logische Satzlänge (konstanter Teil 187 Bytes +
Erweiterungsteil(e) zu je 29 Bytes), max. "0622".''
What does this mean? There can only be 15 extension records and an
extension record has the size of 29 bytes. Hence the old code was
wrong and the very old code was correct. *sigh*
. C18 = Number of extension records.
``00 = Es folgt kein Erweiterungsteil.
01-15 = Anzahl der Erweiterungsteile á 29 Bytes''
Other things:
. Generalized size in C1 (it's four digits, not only three, the first
is not use though...)
. Moved calculation of C18 into dtaus_prepareC()
. Corrected stripping of the original Text field, should be
superflous, but anyway...
. Corrected decoding of C18 when decoding a dtaus file
#define C_EXT 11
#define C_LEN 12
#define C_EXT 11
#define C_LEN 12
dtaus_record recE[] = {
{"Anzahl", 10, 7, IGN},
dtaus_record recE[] = {
{"Anzahl", 10, 7, IGN},
{
int i;
int appendix = 0;
{
int i;
int appendix = 0;
if (normaltext)
appendix = 1;
if (normaltext)
appendix = 1;
- if (maxtext) {
- res = div (maxtext-1, 4);
- appendix += res.quot;
- if (res.rem) appendix++;
- }
i = 187 + (appendix * 29);
/* Bail out if the number is too large, shouldn't be possible though */
if (i >= 1000)
exit (1);
i = 187 + (appendix * 29);
/* Bail out if the number is too large, shouldn't be possible though */
if (i >= 1000)
exit (1);
+ buf[0] = (i/1000)+48;i-=(i/1000)*100;
buf[1] = (i/100)+48;i-=(i/100)*100;
buf[2] = (i/10)+48;i-=(i/10)*10;
buf[3] = i+48;
buf[1] = (i/100)+48;i-=(i/100)*100;
buf[2] = (i/10)+48;i-=(i/10)*10;
buf[3] = i+48;
buf[182] = ' '; /* C17a (Currency) */
#endif
for (i=183;i<183+2; i++) buf[i] = ' '; /* C17b */
buf[182] = ' '; /* C17a (Currency) */
#endif
for (i=183;i<183+2; i++) buf[i] = ' '; /* C17b */
- for (i=185;i<185+2; i++) buf[i] = '0'; /* C18 (#Extension) */
for (i=187;i<187+(29*2); i++) buf[i] = ' '; /* C19-C22 (misc text) */
for (i=245;i<245+11; i++) buf[i] = ' '; /* C23 */
for (i=187;i<187+(29*2); i++) buf[i] = ' '; /* C19-C22 (misc text) */
for (i=245;i<245+11; i++) buf[i] = ' '; /* C23 */
+
+ buf[185+0] = (appendix/10)+48;appendix-=(appendix/10)*10;
+ buf[185+1] = appendix+48;
int i, k;
int maxtext = 0;
int fieldnr;
int i, k;
int maxtext = 0;
int fieldnr;
- if (text)
- for (maxtext=0;text[maxtext];maxtext++);
+ /* Just count */
+ if (text) for (maxtext=0;text[maxtext];maxtext++);
#if DEBUG
for (i=0; (recC[i].name); i++)
#if DEBUG
for (i=0; (recC[i].name); i++)
}
i=C_TEXT;if (values[i] && strlen(values[i]) > recC[i].len)
}
i=C_TEXT;if (values[i] && strlen(values[i]) > recC[i].len)
- values[i][recC[i].len] = '\0';
+ values[i][recC[i].len-2] = '\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_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, values[C_TEXT] != NULL, maxtext);
for (i=0; i<5; i++) buf[recC[C_TRANS].pos+i] = tmp[i];
dtaus_prepareC (buf, values[C_TEXT] != NULL, maxtext);
for (i=0; i<5; i++) buf[recC[C_TRANS].pos+i] = tmp[i];
buf[recC[C_EXT].pos+1] = '2';
sprintf (tmp, "%-27.27s", upcase(text[0]));
for (i=0; i<recC[C_EXT].len-2; i++) buf[recC[C_EXT].pos+2+i] = tmp[i];
buf[recC[C_EXT].pos+1] = '2';
sprintf (tmp, "%-27.27s", upcase(text[0]));
for (i=0; i<recC[C_EXT].len-2; i++) buf[recC[C_EXT].pos+2+i] = tmp[i];
-
- res = div (maxtext-1, 4);
- i=res.quot;
- if (res.rem) i++;
-
- buf[185+0] = (i/10)+48;i-=(i/10)*10;
- buf[185+1] = i+48;
char x[30];
int index;
int extC;
char x[30];
int index;
int extC;
if (!cdtaus) {
if (!(fdtaus = fopen("DTAUS0.TXT", "r")))
if (!cdtaus) {
if (!(fdtaus = fopen("DTAUS0.TXT", "r")))
/* Number of extension records for this C record */
extC = dtaus_int(buf, 185, 2);
/* Number of extension records for this C record */
extC = dtaus_int(buf, 185, 2);
+ extC -= 2;
+ if (extC > 0) {
+ res = div (extC, 4);
+ extC = res.quot;
+ if (res.rem) extC++;
+ }
}
if (dtaus_nextrec(buf, fdtaus) != 1)
bzero (buf, sizeof(buf));
}
if (dtaus_nextrec(buf, fdtaus) != 1)
bzero (buf, sizeof(buf));