Skip to content

Commit

Permalink
Merge pull request #120 from thbeu/update-dbfinfo
Browse files Browse the repository at this point in the history
Support printing date and logical fields
  • Loading branch information
rouault authored Mar 17, 2024
2 parents fac819d + 0232557 commit dd15731
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions contrib/dbfinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,24 @@ int main(int argc, char **argv)
printf("Info for %s\n", argv[1]);

/* -------------------------------------------------------------------- */
/* If there is no data in this file let the user know. */
/* If there is no data in this file let the user know. */
/* -------------------------------------------------------------------- */
const int iCount = DBFGetFieldCount(hDBF);
printf("%d Columns, %d Records in file\n", iCount,
DBFGetRecordCount(hDBF));

/* -------------------------------------------------------------------- */
/* Compute offsets to use when printing each of the field */
/* values. We make each field as wide as the field title+1, or */
/* the field value + 1. */
/* Compute offsets to use when printing each of the field */
/* values. We make each field as wide as the field title+1, or */
/* the field value + 1. */
/* -------------------------------------------------------------------- */
char ftype[32];
int nDecimals;
int nWidth;

for (int i = 0; i < DBFGetFieldCount(hDBF); i++)
{
char szTitle[12];
char szTitle[XBASE_FLDNAME_LEN_READ + 1];

switch (DBFGetFieldInfo(hDBF, i, szTitle, &nWidth, &nDecimals))
{
Expand All @@ -69,6 +69,14 @@ int main(int argc, char **argv)
strcpy(ftype, "float");
break;

case FTLogical:
strcpy(ftype, "logical");
break;

case FTDate:
strcpy(ftype, "date");
break;

case FTInvalid:
strcpy(ftype, "invalid/unsupported");
break;
Expand Down

0 comments on commit dd15731

Please sign in to comment.