"Fossies" - the Fresh Open Source Software Archive

Member "DB_File-1.852/version.c" (5 Feb 2019, 2287 Bytes) of package /linux/privat/DB_File-1.852.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "version.c" see the Fossies "Dox" file reference documentation.

    1 /* 
    2 
    3  version.c -- Perl 5 interface to Berkeley DB 
    4 
    5  written by Paul Marquess <Paul.Marquess@btinternet.com>
    6  last modified 2nd Jan 2002
    7  version 1.802
    8 
    9  All comments/suggestions/problems are welcome
   10 
   11      Copyright (c) 1995-2002 Paul Marquess. All rights reserved.
   12      This program is free software; you can redistribute it and/or
   13      modify it under the same terms as Perl itself.
   14 
   15  Changes:
   16         1.71 -  Support for Berkeley DB version 3.
   17         Support for Berkeley DB 2/3's backward compatibility mode.
   18         1.72 -  No change.
   19         1.73 -  Added support for threading
   20         1.74 -  Added Perl core patch 7801.
   21 
   22 
   23 */
   24 
   25 #define PERL_NO_GET_CONTEXT
   26 #include "EXTERN.h"  
   27 #include "perl.h"
   28 #include "XSUB.h"
   29 
   30 #include <db.h>
   31 
   32 void
   33 #ifdef CAN_PROTOTYPE
   34 __getBerkeleyDBInfo(void)
   35 #else
   36 __getBerkeleyDBInfo()
   37 #endif
   38 {
   39 #ifdef dTHX 
   40     dTHX;
   41 #endif    
   42     SV * version_sv = perl_get_sv("DB_File::db_version", GV_ADD|GV_ADDMULTI) ;
   43     SV * ver_sv = perl_get_sv("DB_File::db_ver", GV_ADD|GV_ADDMULTI) ;
   44     SV * compat_sv = perl_get_sv("DB_File::db_185_compat", GV_ADD|GV_ADDMULTI) ;
   45 
   46 #ifdef DB_VERSION_MAJOR
   47     int Major, Minor, Patch ;
   48 
   49     (void)db_version(&Major, &Minor, &Patch) ;
   50 
   51     /* Check that the versions of db.h and libdb.a are the same */
   52     if (Major != DB_VERSION_MAJOR || Minor != DB_VERSION_MINOR )
   53         /* || Patch != DB_VERSION_PATCH) */
   54 
   55     croak("\nDB_File was build with libdb version %d.%d.%d,\nbut you are attempting to run it with libdb version %d.%d.%d\n",
   56         DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH, 
   57         Major, Minor, Patch) ;
   58     
   59     /* check that libdb is recent enough  -- we need 2.3.4 or greater */
   60     if (Major == 2 && (Minor < 3 || (Minor ==  3 && Patch < 4)))
   61     croak("DB_File needs Berkeley DB 2.3.4 or greater, you have %d.%d.%d\n",
   62          Major, Minor, Patch) ;
   63  
   64     {
   65         char buffer[40] ;
   66         sprintf(buffer, "%d.%d", Major, Minor) ;
   67         sv_setpv(version_sv, buffer) ; 
   68         sprintf(buffer, "%d.%03d%03d", Major, Minor, Patch) ;
   69         sv_setpv(ver_sv, buffer) ; 
   70     }
   71  
   72 #else /* ! DB_VERSION_MAJOR */
   73     sv_setiv(version_sv, 1) ;
   74     sv_setiv(ver_sv, 1) ;
   75 #endif /* ! DB_VERSION_MAJOR */
   76 
   77 #ifdef COMPAT185
   78     sv_setiv(compat_sv, 1) ;
   79 #else /* ! COMPAT185 */
   80     sv_setiv(compat_sv, 0) ;
   81 #endif /* ! COMPAT185 */
   82 
   83 }