include/SDL_getenv.h
changeset 1330 450721ad5436
parent 1312 c9b51268668f
child 1336 3692456e7b0f
equal deleted inserted replaced
1329:bc67bbf87818 1330:450721ad5436
    21 */
    21 */
    22 
    22 
    23 #ifndef _SDL_getenv_h
    23 #ifndef _SDL_getenv_h
    24 #define _SDL_getenv_h
    24 #define _SDL_getenv_h
    25 
    25 
       
    26 #include "SDL_config.h"
       
    27 
       
    28 #ifdef HAVE_STDLIB_H
       
    29 #include <stdlib.h>
       
    30 #endif
       
    31 
    26 #include "begin_code.h"
    32 #include "begin_code.h"
    27 /* Set up for C function definitions, even when using C++ */
    33 /* Set up for C function definitions, even when using C++ */
    28 #ifdef __cplusplus
    34 #ifdef __cplusplus
    29 extern "C" {
    35 extern "C" {
    30 #endif
    36 #endif
    31 
    37 
    32 /* Not all environments have a working getenv()/putenv() */
    38 #ifdef HAVE_GETENV
    33 
    39 #define SDL_getenv	getenv
    34 #if defined(macintosh) || defined(WIN32) || defined(_WIN32_WCE)
    40 #else
    35 #define NEED_SDL_GETENV
    41 #define getenv		SDL_getenv
       
    42 extern DECLSPEC char * SDLCALL SDL_getenv(const char *name);
    36 #endif
    43 #endif
    37 
    44 
    38 #ifdef NEED_SDL_GETENV
    45 #ifdef HAVE_PUTENV
    39 
    46 #define SDL_putenv	putenv
    40 /* Put a variable of the form "name=value" into the environment */
    47 #else
       
    48 #define putenv		SDL_putenv
    41 extern DECLSPEC int SDLCALL SDL_putenv(const char *variable);
    49 extern DECLSPEC int SDLCALL SDL_putenv(const char *variable);
    42 #define putenv(X)   SDL_putenv(X)
    50 #endif
    43 
       
    44 /* Retrieve a variable named "name" from the environment */
       
    45 extern DECLSPEC char * SDLCALL SDL_getenv(const char *name);
       
    46 #define getenv(X)     SDL_getenv(X)
       
    47 
       
    48 #endif /* NEED_GETENV */
       
    49 
    51 
    50 /* Ends C function definitions when using C++ */
    52 /* Ends C function definitions when using C++ */
    51 #ifdef __cplusplus
    53 #ifdef __cplusplus
    52 }
    54 }
    53 #endif
    55 #endif