Ticket #342: setenv.patch

File setenv.patch, 2.7 KB (added by diego@…, 21 years ago)

setenv implementation in osdep/

  • libao2/ao_sdl.c

    RCS file: /cvsroot/mplayer/main/libao2/ao_sdl.c,v
    retrieving revision 1.41
    diff -u -r1.41 ao_sdl.c
     
    122122
    123123// end ring buffer stuff
    124124
    125 #if defined(__MINGW32__) || defined(HPUX) || defined(sgi) || (defined(sun) && defined(__svr4__))
    126 /* setenv is missing on win32, solaris, IRIX and HPUX */
    127 static void setenv(const char *name, const char *val, int _xx)
    128 {
    129   int len  = strlen(name) + strlen(val) + 2;
    130   char *env = malloc(len);
    131 
    132   if (env != NULL) {
    133     strcpy(env, name);
    134     strcat(env, "=");
    135     strcat(env, val);
    136     putenv(env);
    137   }
    138 }
    139 #endif
    140 
    141125
    142126// to set/get/query special features/parameters
    143127static int control(int cmd,void *arg){
  • libvo/vo_sdl.c

    RCS file: /cvsroot/mplayer/main/libvo/vo_sdl.c,v
    retrieving revision 1.122
    diff -u -r1.122 vo_sdl.c
     
    138138#include <SDL.h>
    139139//#include <SDL/SDL_syswm.h>
    140140
    141 #if defined(__MINGW32__) || defined(HPUX) || defined(sgi) || (defined(sun) && defined(__svr4__))
    142 /* setenv is missing on win32, solaris, IRIX and HPUX */
    143 static void setenv(const char *name, const char *val, int _xx)
    144 {
    145     int len  = strlen(name) + strlen(val) + 2;
    146     char *env = malloc(len);
    147 
    148     if (env != NULL) {
    149         strcpy(env, name);
    150         strcat(env, "=");
    151         strcat(env, val);
    152         putenv(env);
    153     }
    154 }
    155 #endif
    156 
    157141
    158142#ifdef SDL_ENABLE_LOCKS
    159143#define SDL_OVR_LOCK(x)        if (SDL_LockYUVOverlay (priv->overlay)) { \
  • osdep/Makefile

    RCS file: /cvsroot/mplayer/main/osdep/Makefile,v
    retrieving revision 1.19
    diff -u -r1.19 Makefile
     
    44LIBNAME = libosdep.a
    55
    66SRCS= shmem.c strsep.c strl.c vsscanf.c scandir.c gettimeofday.c fseeko.c \
    7       swab.c
     7      swab.c setenv.c
    88      # timer.c
    99
    1010getch = getch2.c
  • new file osdep/setenv.c

    - +  
     1/* setenv implementation for systems lacking setenv in stdlib.h. */
     2
     3#ifndef HAVE_SETENV
     4
     5#include <stdlib.h>
     6#include <string.h>
     7
     8static void setenv(const char *name, const char *val, int _xx)
     9{
     10    int len  = strlen(name) + strlen(val) + 2;
     11    char *env = malloc(len);
     12
     13    if (env != NULL) {
     14                          strcpy(env, name);
     15                          strcat(env, "=");
     16                          strcat(env, val);
     17                          putenv(env);
     18    }
     19}
     20#endif