From: Adam Dickmeiss Date: Wed, 8 Mar 1995 12:36:35 +0000 (+0000) Subject: New function: dbc2709_cvt. X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=c698f8c8545d6f2eecd1f8fdcef39fcc38ba1a6d;p=egate.git New function: dbc2709_cvt. --- diff --git a/include/iso2709.h b/include/iso2709.h index 0700ec1..4f46513 100644 --- a/include/iso2709.h +++ b/include/iso2709.h @@ -4,7 +4,10 @@ * 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 @@ -29,6 +32,7 @@ typedef struct iso2709_rec *Iso2709Rec; 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); diff --git a/include/iso2709p.h b/include/iso2709p.h index b78e582..1f5390b 100644 --- a/include/iso2709p.h +++ b/include/iso2709p.h @@ -4,7 +4,10 @@ * Europagate, 1994-1995. * * $Log: iso2709p.h,v $ - * Revision 1.5 1995/02/23 08:32:12 adam + * Revision 1.6 1995/03/08 12:36:36 adam + * New function: dbc2709_cvt. + * + * Revision 1.5 1995/02/23 08:32:12 adam * Changed header. * * Revision 1.3 1995/02/15 17:43:08 adam @@ -57,8 +60,11 @@ struct iso2709_rec { struct iso2709_dir *directory; }; +/* IS3: */ #define ISO2709_RS 035 +/* IS2: */ #define ISO2709_FS 036 +/* IS1: */ #define ISO2709_IDFS 037 diff --git a/util/iso2709.c b/util/iso2709.c index 9df6e25..4001dcb 100644 --- a/util/iso2709.c +++ b/util/iso2709.c @@ -4,7 +4,10 @@ * 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. * @@ -93,7 +96,8 @@ char *iso2709_read (FILE *inf) 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; @@ -149,7 +153,7 @@ Iso2709Rec iso2709_cvt (const char *buf) *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); @@ -157,7 +161,6 @@ Iso2709Rec iso2709_cvt (const char *buf) } 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 @@ -165,7 +168,7 @@ Iso2709Rec iso2709_cvt (const char *buf) 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, @@ -184,7 +187,7 @@ Iso2709Rec iso2709_cvt (const char *buf) 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; @@ -195,6 +198,16 @@ Iso2709Rec iso2709_cvt (const char *buf) 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;