home *** CD-ROM | disk | FTP | other *** search
/ ST-Computer Leser-CD 2001 January / LCD_01_2001.iso / develop / cookies / ldg / test / cooktest.c next >
Encoding:
C/C++ Source or Header  |  2000-05-03  |  1.5 KB  |  55 lines

  1. /* Filename                    : Cooktest.c - Example for use of cookie shared library (LDG)
  2.  * Number of functions    : 1
  3.  * Version                    : 1.01
  4.  * Author                    : Nicolas Richeton ( nicolas.richeton@free.fr )
  5.  * Last update                : 20/04/2000
  6.  * Statut                    : Freeware
  7.  * Downloaded from        : http://nicosoft.free.atari.fr
  8.  * Comments                    : Based on the work of Thomas Much
  9.  * History                    : 20/04/2000 - Added LDG version
  10.  *                        16/02/2000 - First version
  11.  */
  12.  
  13. #include    <stdio.h>
  14. #include    <portab.h>
  15. #include    <mgx_dos.h>
  16. #include    <mt_aes.h>
  17. #include    <ldg.h>
  18. #include "../cook_ldg.h"
  19.  
  20. EXTERN AESPB ldg_aespb;
  21.  
  22. ULONG main( VOID )
  23. {    
  24.     ULONG    dummy;
  25.     WORD    app_id;
  26.     
  27.     app_id = appl_init();
  28.     printf( "\nTest for Dynamic lib 'cookies.ldg'\nBy Nicolas Richeton\n" );
  29.     
  30.     Cookie_lib  = ldg_exec( app_id, "cookies.ldg" );    /* Load lib */
  31.     
  32.     if( Cookie_lib )
  33.     {
  34.         printf( "\ncookies.ldg successfully loaded" );
  35.         Cookie_Init();                                                /* Init Lib */
  36.         printf( "\nInit OK" );
  37.         
  38.         if( ( *Cookie_NewCookie )( 'CLDG', 0x10 ) )        /* Install Cookie */
  39.             printf( "\nTest cookie 'CLDG' installed" );
  40.             
  41.         if( ( *Cookie_GetCookie )( 'CLDG', &dummy) )        /* Read Cookie */
  42.             printf( "\nTest cookie 'CLDG' found" );
  43.             
  44.         if( ( *Cookie_RemoveCookie )( 'CLDG' ) )            /* Remove Cookie */
  45.             printf( "\nTest cookie 'CLDG' removed" );
  46.         
  47.         ldg_term( app_id,  Cookie_lib );                        /* Close lib */
  48.     }
  49.     else
  50.         printf( "\nError while loading 'cookie.ldg'" );
  51.  
  52.     appl_exit();
  53.     
  54.     return( 0 );
  55. }