home *** CD-ROM | disk | FTP | other *** search
/ Datatid 1999 #6 / Datatid_1999-06.iso / internet / Tango352Promo / P.SQL / PTKPKG.1 / CBBMAIN.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-11-10  |  18.1 KB  |  605 lines

  1. /*************************************************************************
  2. **
  3. **  Copyright 1982-1997 Pervasive Software Inc. All Rights Reserved
  4. **
  5. *************************************************************************/
  6. /***************************************************************************
  7.   CBBMain.cpp
  8.     This is a simple sample designed to allow you to confirm your
  9.     ability to compile, link, and execute a Btrieve application for
  10.     your target environment using your compiler tools.
  11.  
  12.     This program demonstrates the C/C++ interface for Btrieve for MS
  13.     Windows NT and Windows 95 with Borland's C++ Builder.
  14.  
  15.     This program does the following operations on the sample database:
  16.     - gets the Microkernel Database Engine version
  17.     - opens sample.btr
  18.     - gets a record on a known value of Key 0
  19.     - displays the retrieved record
  20.     - performs a stat operation
  21.     - creates an empty 'clone' of sample.btr and opens it
  22.     - performs a 'Get Next Extended' operation to extract a subset
  23.       of the records in sample.btr
  24.     - inserts those records into the cloned file
  25.     - closes both files
  26.  
  27.     To compile this sample, you must make the following files from the
  28.     Btrieve "C" interface directory available to the IDE:
  29.     - btrapi.c
  30.     - btrapi.h
  31.     - btrconst.h
  32.  
  33.     IMPORTANT:
  34.     You must specify the complete path to the directory that contains
  35.     the sample Btrieve data file, 'sample.btr'.  See IMPORTANT, below.
  36.  
  37. ****************************************************************************/
  38. //---------------------------------------------------------------------------
  39. #include <vcl\vcl.h>
  40. #pragma hdrstop
  41.  
  42. #include "CBBMain.h"
  43. #include <btrapi.h>
  44. #include <btrconst.h>
  45. //---------------------------------------------------------------------------
  46. #pragma resource "*.dfm"
  47.  
  48. /***************************************************************************
  49.   Constants
  50. ****************************************************************************/
  51. #define EXIT_WITH_ERROR     1
  52. #define TRUE                1
  53. #define FALSE               0
  54. #define VERSION_OFFSET      0
  55. #define REVISION_OFFSET     2
  56. #define PLATFORM_ID_OFFSET  4
  57. #define MY_THREAD_ID        50
  58.  
  59.  
  60. /* Don't pad our structures */
  61. /* Borland's help says this is the default.  Don't believe it. */
  62. #pragma option -a1
  63.  
  64. /***************************************************************************
  65.   Type definitions for Client ID and version Structures
  66. ****************************************************************************/
  67. typedef struct
  68. {
  69.   BTI_CHAR networkAndNode[12];
  70.   BTI_CHAR applicationID[2];
  71.   BTI_WORD threadID;
  72. } CLIENT_ID;
  73.  
  74. typedef struct
  75. {
  76.   BTI_SINT  Version;
  77.   BTI_SINT  Revision;
  78.   BTI_CHAR  MKDEId;
  79. } VERSION_STRUCT;
  80.  
  81. /***************************************************************************
  82.   Definition of record from 'sample.btr'
  83. ****************************************************************************/
  84. typedef struct
  85. {
  86.   BTI_LONG  ID;
  87.   BTI_CHAR  FirstName[16];
  88.   BTI_CHAR  LastName[26];
  89.   BTI_CHAR  Street[31];
  90.   BTI_CHAR  City[31];
  91.   BTI_CHAR  State[3];
  92.   BTI_CHAR  Zip[11];
  93.   BTI_CHAR  Country[21];
  94.   BTI_CHAR  Phone[14];
  95. } PERSON_STRUCT;
  96.  
  97. /***************************************************************************
  98.   Type definitions for Stat/Create structure
  99. ****************************************************************************/
  100. typedef struct
  101. {
  102.   BTI_SINT recLength;
  103.   BTI_SINT pageSize;
  104.   BTI_SINT indexCount;
  105.   BTI_CHAR reserved[4];
  106.   BTI_SINT flags;
  107.   BTI_BYTE dupPointers;
  108.   BTI_BYTE notUsed;
  109.   BTI_SINT allocations;
  110. } FILE_SPECS;
  111.  
  112. typedef struct
  113. {
  114.   BTI_SINT position;
  115.   BTI_SINT length;
  116.   BTI_SINT flags;
  117.   BTI_CHAR reserved[4];
  118.   BTI_CHAR type;
  119.   BTI_CHAR null;
  120.   BTI_CHAR notUsed[2];
  121.   BTI_BYTE manualKeyNumber;
  122.   BTI_BYTE acsNumber;
  123. } KEY_SPECS;
  124.  
  125. typedef struct
  126. {
  127.   FILE_SPECS fileSpecs;
  128.   KEY_SPECS  keySpecs[5];
  129. } FILE_CREATE_BUF;
  130.  
  131. /***************************************************************************
  132.   Structure type definitions for Get Next Extended operation
  133. ****************************************************************************/
  134. typedef struct
  135. {
  136.   BTI_SINT    descriptionLen;
  137.   BTI_CHAR    currencyConst[2];
  138.   BTI_SINT    rejectCount;
  139.   BTI_SINT    numberTerms;
  140. } GNE_HEADER;
  141.  
  142. typedef struct
  143. {
  144.   BTI_CHAR    fieldType;
  145.   BTI_SINT    fieldLen;
  146.   BTI_SINT    fieldOffset;
  147.   BTI_CHAR    comparisonCode;
  148.   BTI_CHAR    connector;
  149.   BTI_CHAR value[3];
  150. } TERM_HEADER;
  151.  
  152. typedef struct
  153. {
  154.   BTI_SINT    maxRecsToRetrieve;
  155.   BTI_SINT    noFieldsToRetrieve;
  156. } RETRIEVAL_HEADER;
  157.  
  158. typedef struct
  159. {
  160.   BTI_SINT    fieldLen;
  161.   BTI_SINT    fieldOffset;
  162. } FIELD_RETRIEVAL_HEADER;
  163.  
  164. typedef struct
  165. {
  166.   GNE_HEADER              gneHeader;
  167.   TERM_HEADER             term1;
  168.   TERM_HEADER             term2;
  169.   RETRIEVAL_HEADER        retrieval;
  170.   FIELD_RETRIEVAL_HEADER  recordRet;
  171. } PRE_GNE_BUFFER;
  172.  
  173. typedef struct
  174. {
  175.   BTI_SINT      recLen;
  176.   BTI_LONG      recPos;
  177.   PERSON_STRUCT personRecord;
  178. } RETURNED_REC;
  179.  
  180. typedef struct
  181. {
  182.   BTI_SINT      numReturned;
  183.   RETURNED_REC  recs[20];
  184. } POST_GNE_BUFFER;
  185.  
  186. typedef union
  187. {
  188.   PRE_GNE_BUFFER  preBuf;
  189.   POST_GNE_BUFFER postBuf;
  190. } GNE_BUFFER, BTI_FAR* GNE_BUFFER_PTR;
  191.  
  192. //---------------------------------------------------------------------------
  193. // non-exported forward declarations
  194. void printLB(TListBox *LB, char *msg);
  195.  
  196. TForm1 *Form1;
  197. //---------------------------------------------------------------------------
  198. __fastcall TForm1::TForm1(TComponent* Owner)
  199.     : TForm(Owner)
  200. {
  201. }
  202. //---------------------------------------------------------------------------
  203. void __fastcall TForm1::ExitButtonClick(TObject *Sender)
  204. {
  205.     Form1->Close();
  206. }
  207. //---------------------------------------------------------------------------
  208. void __fastcall TForm1::RunButtonClick(TObject *Sender)
  209. {
  210.     runTest();
  211. }
  212.  
  213. /************************************************************************
  214.   Helper function to write to ListBox
  215. ************************************************************************/
  216. void printLB(TListBox *LB, char *msg)
  217. {
  218.     LB->Items->Add(msg);
  219. }
  220.  
  221.  
  222. /************************************************************************
  223.   This is where all the work gets done
  224. ************************************************************************/
  225. BTI_SINT runTest(void)
  226. {
  227.   /* Btrieve function parameters */
  228.   BTI_BYTE posBlock1[128];
  229.   BTI_BYTE posBlock2[128];
  230.   BTI_BYTE dataBuf[255];
  231.   BTI_WORD dataLen;
  232.   BTI_BYTE keyBuf1[255];
  233.   BTI_BYTE keyBuf2[255];
  234.   BTI_WORD keyNum = 0;
  235.  
  236.   BTI_BYTE btrieveLoaded = FALSE;
  237.   BTI_LONG personID;
  238.   BTI_BYTE file1Open = FALSE;
  239.   BTI_BYTE file2Open = FALSE;
  240.   BTI_SINT status;
  241.   BTI_SINT getStatus;
  242.   BTI_SINT i;
  243.   BTI_SINT posCtr;
  244.  
  245.   CLIENT_ID       clientID;
  246.   VERSION_STRUCT  versionBuffer[3];
  247.   FILE_CREATE_BUF fileCreateBuf;
  248.   GNE_BUFFER_PTR  gneBuffer;
  249.   PERSON_STRUCT   personRecord;
  250.  
  251.   BTI_CHAR tmpBuf[1024];
  252.  
  253.   /************************************************************************
  254.      Print the program title
  255.   ************************************************************************/
  256.   printLB(Form1->ListBox1,
  257.         "**** Btrieve -- C++ Builder Sample ****" );
  258.  
  259.   /* set up the Client ID */
  260.   memset(clientID.networkAndNode, 0, sizeof(clientID.networkAndNode));
  261.   memcpy(clientID.applicationID, "MT", 2);  /* must be greater than "AA" */
  262.   clientID.threadID = MY_THREAD_ID;
  263.  
  264.   memset(versionBuffer, 0, sizeof(versionBuffer));
  265.   dataLen = sizeof(versionBuffer);
  266.  
  267.   status = BTRVID(
  268.               B_VERSION,
  269.               posBlock1,
  270.               &versionBuffer,
  271.               &dataLen,
  272.               keyBuf1,
  273.               keyNum,
  274.               (BTI_BUFFER_PTR)&clientID);
  275.  
  276.   if (status == B_NO_ERROR)
  277.   {
  278.     strcpy(tmpBuf, "Btrieve Versions returned are: " );
  279.        printLB(Form1->ListBox1, tmpBuf);
  280.     for (i = 0; i < 3; i++) {
  281.       if (versionBuffer[i].Version != 0)
  282.       {
  283.         sprintf(tmpBuf, "   %d.%d %c", versionBuffer[i].Version,
  284.                 versionBuffer[i].Revision,
  285.                 versionBuffer[i].MKDEId );
  286.            printLB(Form1->ListBox1, tmpBuf);
  287.       }
  288.     }
  289.     printLB(Form1->ListBox1, "");
  290.     btrieveLoaded = TRUE;
  291.   }
  292.   else
  293.   {
  294.     sprintf(tmpBuf, "Btrieve B_VERSION status = %d", status );
  295.     printLB(Form1->ListBox1, tmpBuf);
  296.     if ( status != B_RECORD_MANAGER_INACTIVE )
  297.     {
  298.       btrieveLoaded = TRUE;
  299.     }
  300.   }
  301.  
  302.   /* clear buffers */
  303.   if (status == B_NO_ERROR)
  304.   {
  305.     memset(dataBuf, 0, sizeof(dataBuf));
  306.     memset(keyBuf1, 0, sizeof(keyBuf1));
  307.     memset(keyBuf2, 0, sizeof(keyBuf2));
  308.   }
  309.  
  310.   /* open sample.btr */
  311.   if (status == B_NO_ERROR)
  312.   {
  313.     /********************************************************************
  314.        IMPORTANT: You should modify the following to specify the
  315.                   complete path to 'sample.btr' for your environment.
  316.     ********************************************************************/
  317.     strcpy((BTI_CHAR *)keyBuf1, "c:\\pvsw\\samples\\sample.btr");
  318.     strcpy((BTI_CHAR *)keyBuf2, "c:\\pvsw\\samples\\sample2.btr");
  319.  
  320.     keyNum  = 0;
  321.     dataLen = 0;
  322.  
  323.     status = BTRVID(
  324.                 B_OPEN,
  325.                 posBlock1,
  326.                 dataBuf,
  327.                 &dataLen,
  328.                 keyBuf1,
  329.                 keyNum,
  330.                 (BTI_BUFFER_PTR)&clientID);
  331.  
  332.     sprintf(tmpBuf, "Btrieve B_OPEN status = %d", status );
  333.     printLB(Form1->ListBox1, tmpBuf);
  334.     if (status == B_NO_ERROR)
  335.     {
  336.       file1Open = TRUE;
  337.     }
  338.   }
  339.  
  340.   /* get the record with key 0 = 263512477 using B_GET_EQUAL */
  341.   if (status == B_NO_ERROR)
  342.   {
  343.     memset(&personRecord, 0, sizeof(personRecord));
  344.     dataLen = sizeof(personRecord);
  345.     personID = 263512477;    /* this is really a social security number */
  346.     *(BTI_LONG BTI_FAR *)&keyBuf1[0] = personID;
  347.     keyNum = 0;
  348.  
  349.     status = BTRVID(
  350.                 B_GET_EQUAL,
  351.                 posBlock1,
  352.                 &personRecord,
  353.                 &dataLen,
  354.                 keyBuf1,
  355.                 keyNum,
  356.                 (BTI_BUFFER_PTR)&clientID);
  357.  
  358.     sprintf(tmpBuf, "Btrieve B_GET_EQUAL status = %d", status );
  359.     printLB(Form1->ListBox1, tmpBuf);
  360.     if (status == B_NO_ERROR)
  361.     {
  362.       sprintf(tmpBuf, "" );
  363.       printLB(Form1->ListBox1, tmpBuf);
  364.       sprintf(tmpBuf, "The retrieved record is:" );
  365.       printLB(Form1->ListBox1, tmpBuf);
  366.       sprintf(tmpBuf, "ID:      %ld", personRecord.ID );
  367.       printLB(Form1->ListBox1, tmpBuf);
  368.       sprintf(tmpBuf, "Name:    %s %s", personRecord.FirstName,
  369.                                         personRecord.LastName );
  370.       printLB(Form1->ListBox1, tmpBuf);
  371.       sprintf(tmpBuf, "Street:  %s", personRecord.Street );
  372.       printLB(Form1->ListBox1, tmpBuf);
  373.       sprintf(tmpBuf, "City:    %s", personRecord.City );
  374.       printLB(Form1->ListBox1, tmpBuf);
  375.       sprintf(tmpBuf, "State:   %s", personRecord.State );
  376.       printLB(Form1->ListBox1, tmpBuf);
  377.       sprintf(tmpBuf, "Zip:     %s", personRecord.Zip );
  378.       printLB(Form1->ListBox1, tmpBuf);
  379.       sprintf(tmpBuf, "Country: %s", personRecord.Country );
  380.       printLB(Form1->ListBox1, tmpBuf);
  381.       sprintf(tmpBuf, "Phone:   %s", personRecord.Phone );
  382.       printLB(Form1->ListBox1, tmpBuf);
  383.       sprintf(tmpBuf, "" );
  384.       printLB(Form1->ListBox1, tmpBuf);
  385.     }
  386.   }
  387.  
  388.   /* perform a stat operation to populate the create buffer */
  389.  
  390.   memset(&fileCreateBuf, 0, sizeof(fileCreateBuf));
  391.   dataLen = sizeof(fileCreateBuf);
  392.   keyNum = (BTI_WORD)-1;
  393.  
  394.   status = BTRVID(B_STAT,
  395.                 posBlock1,
  396.                 &fileCreateBuf,
  397.                 &dataLen,
  398.                 keyBuf1,
  399.                 keyNum,
  400.                 (BTI_BUFFER_PTR)&clientID);
  401.  
  402.   if (status == B_NO_ERROR)
  403.   {
  404.     /* create and open sample2.btr */
  405.     keyNum = 0;
  406.     dataLen = sizeof(fileCreateBuf);
  407.     status = BTRVID(B_CREATE,
  408.                   posBlock2,
  409.                   &fileCreateBuf,
  410.                   &dataLen,
  411.                   keyBuf2,
  412.                   keyNum,
  413.                   (BTI_BUFFER_PTR)&clientID);
  414.  
  415.     sprintf(tmpBuf, "Btrieve B_CREATE status = %d", status );
  416.     printLB(Form1->ListBox1, tmpBuf);
  417.   }
  418.  
  419.   if (status == B_NO_ERROR)
  420.   {
  421.     keyNum = 0;
  422.     dataLen = 0;
  423.  
  424.     status = BTRVID(
  425.                 B_OPEN,
  426.                 posBlock2,
  427.                 dataBuf,
  428.                 &dataLen,
  429.                 keyBuf2,
  430.                 keyNum,
  431.                 (BTI_BUFFER_PTR)&clientID);
  432.  
  433.     sprintf(tmpBuf, "Btrieve B_OPEN status = %d", status );
  434.     printLB(Form1->ListBox1, tmpBuf);
  435.     if (status == B_NO_ERROR)
  436.     {
  437.       file2Open = TRUE;
  438.     }
  439.   }
  440.  
  441.   /* now extract data from the original file, insert into new one */
  442.   if (status == B_NO_ERROR)
  443.   {
  444.     /* getFirst to establish currency */
  445.     keyNum = 2; /* STATE-CITY index */
  446.     memset(&personRecord, 0, sizeof(personRecord));
  447.     memset(&keyBuf2[0], 0, sizeof(keyBuf2));
  448.     dataLen = sizeof(personRecord);
  449.  
  450.     getStatus = BTRVID(
  451.                    B_GET_FIRST,
  452.                    posBlock1,
  453.                    &personRecord,
  454.                    &dataLen,
  455.                    keyBuf1,
  456.                    keyNum,
  457.                    (BTI_BUFFER_PTR)&clientID);
  458.  
  459.     sprintf(tmpBuf, "Btrieve B_GET_FIRST status = %d", getStatus );
  460.     printLB(Form1->ListBox1, tmpBuf);
  461.   }
  462.  
  463.   gneBuffer = (GNE_BUFFER_PTR)malloc(sizeof(GNE_BUFFER));
  464.   if (gneBuffer == NULL)
  465.   {
  466.     strcpy(tmpBuf, "Insufficient memory to allocate buffer" );
  467.        printLB(Form1->ListBox1, tmpBuf);
  468.     return(EXIT_WITH_ERROR);
  469.   }
  470.   memset(gneBuffer, 0, sizeof(GNE_BUFFER));
  471.   memcpy(&gneBuffer->preBuf.gneHeader.currencyConst[0], "UC", 2);
  472.   while (getStatus == B_NO_ERROR)
  473.   {
  474.     gneBuffer->preBuf.gneHeader.rejectCount = 0;
  475.     gneBuffer->preBuf.gneHeader.numberTerms = 2;
  476.     posCtr = sizeof(GNE_HEADER);
  477.  
  478.     /* fill in the first condition */
  479.     gneBuffer->preBuf.term1.fieldType = 11;
  480.     gneBuffer->preBuf.term1.fieldLen = 3;
  481.     gneBuffer->preBuf.term1.fieldOffset = 108;
  482.     gneBuffer->preBuf.term1.comparisonCode = 1;
  483.     gneBuffer->preBuf.term1.connector = 2;
  484.     memcpy(&gneBuffer->preBuf.term1.value[0], "TX", 2);
  485.     posCtr += sizeof(TERM_HEADER);
  486.  
  487.     /* fill in the second condition */
  488.     gneBuffer->preBuf.term2.fieldType = 11;
  489.     gneBuffer->preBuf.term2.fieldLen = 3;
  490.     gneBuffer->preBuf.term2.fieldOffset = 108;
  491.     gneBuffer->preBuf.term2.comparisonCode = 1;
  492.     gneBuffer->preBuf.term2.connector = 0;
  493.     memcpy(&gneBuffer->preBuf.term2.value[0], "CA", 2);
  494.     posCtr += sizeof(TERM_HEADER);
  495.  
  496.     /* fill in the projection header to retrieve whole record */
  497.     gneBuffer->preBuf.retrieval.maxRecsToRetrieve = 20;
  498.     gneBuffer->preBuf.retrieval.noFieldsToRetrieve = 1;
  499.     posCtr += sizeof(RETRIEVAL_HEADER);
  500.     gneBuffer->preBuf.recordRet.fieldLen = sizeof(PERSON_STRUCT);
  501.     gneBuffer->preBuf.recordRet.fieldOffset = 0;
  502.     posCtr += sizeof(FIELD_RETRIEVAL_HEADER);
  503.     gneBuffer->preBuf.gneHeader.descriptionLen = posCtr;
  504.  
  505.     dataLen = sizeof(GNE_BUFFER);
  506.     getStatus = BTRVID(
  507.                    B_GET_NEXT_EXTENDED,
  508.                    posBlock1,
  509.                    gneBuffer,
  510.                    &dataLen,
  511.                    keyBuf1,
  512.                    keyNum,
  513.                    (BTI_BUFFER_PTR)&clientID);
  514.  
  515.     sprintf(tmpBuf, "Btrieve B_GET_NEXT_EXTENDED status = %d", getStatus );
  516.     printLB(Form1->ListBox1, tmpBuf);
  517.  
  518.     /* Get Next Extended can reach end of file and still return some records */
  519.     if ((getStatus == B_NO_ERROR) || (getStatus == B_END_OF_FILE))
  520.     {
  521.       sprintf(tmpBuf, "GetNextExtended returned %d records.", gneBuffer->postBuf.numReturned);
  522.          printLB(Form1->ListBox1, tmpBuf);
  523.       for (i = 0; i < gneBuffer->postBuf.numReturned; i++)
  524.       {
  525.         dataLen = sizeof(PERSON_STRUCT);
  526.         memcpy(dataBuf, &gneBuffer->postBuf.recs[i].personRecord, dataLen);
  527.         status = BTRVID(
  528.                     B_INSERT,
  529.                     posBlock2,
  530.                     dataBuf,
  531.                     &dataLen,
  532.                     keyBuf2,
  533.                     -1,   /* no currency change */
  534.                     (BTI_BUFFER_PTR)&clientID);
  535.       }
  536.       sprintf(tmpBuf, "Inserted %d records in new file, status = %d",
  537.               gneBuffer->postBuf.numReturned, status);
  538.          printLB(Form1->ListBox1, tmpBuf);
  539.     }
  540.     memset(gneBuffer, 0, sizeof(GNE_BUFFER));
  541.     memcpy(&gneBuffer->preBuf.gneHeader.currencyConst[0], "EG", 2);
  542.   }
  543.  
  544.   free(gneBuffer);
  545.   gneBuffer = NULL;
  546.  
  547.   /* close open files */
  548.   if (file1Open)
  549.   {
  550.     dataLen = 0;
  551.  
  552.     status = BTRVID(
  553.                 B_CLOSE,
  554.                 posBlock1,
  555.                 dataBuf,
  556.                 &dataLen,
  557.                 keyBuf1,
  558.                 keyNum,
  559.                 (BTI_BUFFER_PTR)&clientID);
  560.  
  561.     sprintf(tmpBuf, "Btrieve B_CLOSE status (sample.btr) = %d", status );
  562.     printLB(Form1->ListBox1, tmpBuf);
  563.   }
  564.  
  565.   if (file2Open)
  566.   {
  567.     dataLen = 0;
  568.  
  569.     status = BTRVID(
  570.                 B_CLOSE,
  571.                 posBlock2,
  572.                 dataBuf,
  573.                 &dataLen,
  574.                 keyBuf2,
  575.                 keyNum,
  576.                 (BTI_BUFFER_PTR)&clientID);
  577.  
  578.     sprintf(tmpBuf, "Btrieve B_CLOSE status (sample2.btr) = %d", status );
  579.     printLB(Form1->ListBox1, tmpBuf);
  580.   }
  581.  
  582.   /**********************************************************************
  583.      ISSUE THE BTRIEVE STOP OPERATION - For multi-tasking environments,
  584.      such as MS Windows, OS2, and NLM, 'stop' frees all Btrieve resources
  585.      for this client.  In DOS and Extended DOS, it removes the Btrieve
  586.      engine from memory.  In multi-tasking environments, the engine will
  587.      not unload on 'stop' unless it has no more clients.
  588.   ***********************************************************************/
  589.   if (btrieveLoaded)
  590.   {
  591.     dataLen = 0;
  592.     status = BTRVID(B_STOP, posBlock1, dataBuf, &dataLen, keyBuf1, keyNum,
  593.              (BTI_BUFFER_PTR)&clientID);
  594.     sprintf(tmpBuf, "Btrieve B_STOP status = %d", status );
  595.     printLB(Form1->ListBox1, tmpBuf);
  596.     if (status != B_NO_ERROR)
  597.     {
  598.        status = EXIT_WITH_ERROR;
  599.     }
  600.   }
  601.  
  602.   return(status);
  603. }
  604.  
  605.