home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / dbase_c.zip / DBDUPL.C < prev    next >
Text File  |  1989-03-20  |  1KB  |  30 lines

  1.  
  2. #include  "libc.h"
  3. #include  "dbase.h"
  4.  
  5.  
  6. /***************************************************************
  7. *  db_dupl(dp_ptr) duplicates a DBASE file  description  block *
  8. * and returns a pointer to the block.  It aborts the processing*
  9. * if there is insufficient memory to create the block.         *
  10. ***************************************************************/
  11. db_dupl(filename,db_ptr)
  12.    DBASE_FILE  *db_ptr ;
  13.    char        filename[] ;    
  14.    {DBASE_FILE *db_new ;
  15.    
  16.    /*----- open the new file and allocate file descriptor space -----*/
  17.    if( (db_new=db_open(filename)) == ERROR ) {
  18.       printf("\nInsufficient HEAP space to create the block");
  19.       printf("\nCalled from db_dupl");
  20.    }
  21.  
  22.    /*----- there was enough space, copy the old block and set */
  23.    /*----- the change indicator                               */
  24.    blockmv(db_ptr,db_new,DB_HDR_SZ);
  25.    db_new->chng_ind = TRUE ;
  26.  
  27.    return(db_new) ;
  28.  
  29. }
  30.