view osdep/setenv.c @ 24198:2404117b534c

r24050: MP3 audio encoder was renamed to libmp3lame in FFmpeg. r24055: Document how to encode with some libavcodec audio codecs. r24056: AC3 --> AC-3 r24063: Document how to encode with some more libavcodec audio codecs. r24084: small libavcodec audio codec clarifications r24109: Sort libavcodec encoders. r24110: Add some missing libavcodec video encoders. r24125: Automatic TV channels scanning ability for MPlayer. r24136: Wording and markup improvements for the -tvscan option. r24137: misc markup fixes r24216: Add missed in r24212 strings definitions
author kraymer
date Sun, 26 Aug 2007 20:44:05 +0000
parents 936209c39ed1
children 5cfef41a1771
line wrap: on
line source

/* setenv implementation for systems lacking it. */

#include "config.h"

#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;
}