annotate osdep/setenv.c @ 17715:9e1fb2aeeed9

don't fall back to MP_CMD_TV_LAST_CHANNEL after MP_CMD_DVB_SETCHANNEL; patch by calking a ieee d org
author nicodvb
date Thu, 02 Mar 2006 21:19:57 +0000
parents 44c24de55f9d
children d0d487227d60
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17245
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
1 /* setenv implementation for systems lacking it. */
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
2
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
3 #include "../config.h"
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
4
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
5 #ifndef HAVE_SETENV
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
6
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
7 #include <stdlib.h>
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
8 #include <string.h>
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
9 #ifndef MP_DEBUG
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
10 #define NDEBUG
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
11 #endif
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
12 #include <assert.h>
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
13
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
14 int setenv(const char *name, const char *val, int overwrite)
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
15 {
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
16 int len = strlen(name) + strlen(val) + 2;
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
17 char *env = malloc(len);
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
18 if (!env) { return -1; }
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
19
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
20 assert(overwrite != 0);
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
21
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
22 strcpy(env, name);
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
23 strcat(env, "=");
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
24 strcat(env, val);
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
25 putenv(env);
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
26
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
27 return 0;
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
28 }
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
29 #endif