* Europagate, 1994-1995.
*
* $Log: iso2709.h,v $
- * Revision 1.5 1995/02/23 08:32:12 adam
+ * Revision 1.6 1995/03/08 12:36:35 adam
+ * New function: dbc2709_cvt.
+ *
+ * Revision 1.5 1995/02/23 08:32:12 adam
* Changed header.
*
* Revision 1.3 1995/02/10 17:05:14 adam
char *iso2709_read (FILE *inf);
Iso2709Rec iso2709_cvt (const char *buf);
+Iso2709Rec dbc2709_cvt (const char *buf);
void iso2709_rm (Iso2709Rec rec);
void iso2709_display (Iso2709Rec rec, FILE *out);
* Europagate, 1994-1995.
*
* $Log: iso2709.c,v $
- * Revision 1.8 1995/03/08 12:03:15 adam
+ * Revision 1.9 1995/03/08 12:36:39 adam
+ * New function: dbc2709_cvt.
+ *
+ * Revision 1.8 1995/03/08 12:03:15 adam
* Hack: When tags 00? are used, every separator (DC[1-3]) marks
* the end of the data field.
*
return buf;
}
-Iso2709Rec iso2709_cvt (const char *buf)
+
+static Iso2709Rec iso2709_cvt_g (const char *buf, int use_dbc)
{
struct iso2709_dir **dpp, *dp;
int pos = 24;
*fpp = malloc (sizeof(**fpp));
(*fpp)->next = NULL;
- if (p->indicator_length && memcmp (dp->tag, "00", 2))
+ if (p->indicator_length && (memcmp (dp->tag, "00", 2) || use_dbc))
{
dp->indicator = malloc (p->indicator_length+1);
strncpyx (dp->indicator, buf+dpos, p->indicator_length);
}
else
dp->indicator = NULL;
- printf ("tag=%.3s, dpos = %d, (0%o)\n", dp->tag, dpos, dpos);
if (memcmp (dp->tag, "00", 2))
tag00 = 0;
else
while (1)
{
int dpos_n;
- if (p->identifier_length && !tag00)
+ if (p->identifier_length && (!tag00 || use_dbc))
{
(*fpp)->identifier = malloc (p->identifier_length+1);
strncpyx ((*fpp)->identifier, buf+dpos+1,
strncpyx ((*fpp)->data, buf+dpos, dpos_n - dpos);
dpos = dpos_n;
- if (buf[dpos] == ISO2709_FS || buf[dpos] == ISO2709_RS || tag00)
+ if (buf[dpos] == ISO2709_FS || buf[dpos] == ISO2709_RS)
break;
fpp = &(*fpp)->next;
return p;
}
+Iso2709Rec iso2709_cvt (const char *buf)
+{
+ return iso2709_cvt_g (buf, 0);
+}
+
+Iso2709Rec dbc2709_cvt (const char *buf)
+{
+ return iso2709_cvt_g (buf, 1);
+}
+
void iso2709_rm (Iso2709Rec rec)
{
struct iso2709_dir *dir, *dir1;