[MPlayer-cvslog] CVS: main/osdep setenv.c, NONE, 1.1 Makefile, 1.19, 1.20

Alexander Strasser beastd syncmail at mplayerhq.hu
Mon Dec 26 04:16:50 CET 2005


CVS change done by Alexander Strasser (beastd)

Update of /cvsroot/mplayer/main/osdep
In directory mail:/var2/tmp/cvs-serv10532/osdep

Modified Files:
	Makefile 
Added Files:
	setenv.c 
Log Message:
- move our setenv() fallback implementation to osdep
- assert that the override param is nonzero (zero is not implemented)
- correct return value type to int

based on a patch by Diego
fixes bugzilla bug #342


--- NEW FILE ---
/* setenv implementation for systems lacking it. */

#include "../config.h"

#ifndef HAVE_SETENV

#include <stdlib.h>
#include <string.h>
#ifndef MP_DEBUG
  #define NDEBUG
#endif
#include <assert.h>

int setenv(const char *name, const char *val, int overwrite)
{
  int len  = strlen(name) + strlen(val) + 2;
  char *env = malloc(len);
  if (!env) { return -1; }

  assert(overwrite != 0);

  strcpy(env, name);
  strcat(env, "=");
  strcat(env, val);
  putenv(env);

  return 0;
}
#endif

Index: Makefile
===================================================================
RCS file: /cvsroot/mplayer/main/osdep/Makefile,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- Makefile	18 Aug 2005 11:26:04 -0000	1.19
+++ Makefile	26 Dec 2005 03:16:48 -0000	1.20
@@ -4,7 +4,7 @@
 LIBNAME = libosdep.a
 
 SRCS= shmem.c strsep.c strl.c vsscanf.c scandir.c gettimeofday.c fseeko.c \
-      swab.c
+      swab.c setenv.c
       # timer.c
 
 getch = getch2.c




More information about the MPlayer-cvslog mailing list