annotate osdep/setenv.c @ 24424:0c4f1a88eaae

warning fixes: input.c: In function 'mp_input_set_section': input.c:1640: warning: suggest parentheses around assignment used as truth value input.c:1643: warning: suggest parentheses around assignment used as truth value mga_common.c: In function 'mga_init': mga_common.c:394: warning: suggest parentheses around assignment used as truth value playtreeparser.c: In function 'parse_smil': playtreeparser.c:523: warning: suggest parentheses around assignment used as truth value libmpdemux/demux_ts.c: In function 'ts_parse': libmpdemux/demux_ts.c:2795: warning: suggest parentheses around assignment used as truth value libmpdemux/demux_ts.c: In function 'demux_open_ts': libmpdemux/demux_ts.c:591: warning: 'frame_length' may be used uninitialized in this function
author diego
date Thu, 13 Sep 2007 13:16:30 +0000
parents 936209c39ed1
children 5cfef41a1771
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
21853
d0d487227d60 consistent include path
diego
parents: 17245
diff changeset
3 #include "config.h"
17245
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 #include <stdlib.h>
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
6 #include <string.h>
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
7 #ifndef MP_DEBUG
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
8 #define NDEBUG
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
9 #endif
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
10 #include <assert.h>
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
11
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
12 int setenv(const char *name, const char *val, int overwrite)
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 len = strlen(name) + strlen(val) + 2;
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
15 char *env = malloc(len);
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
16 if (!env) { return -1; }
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
17
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
18 assert(overwrite != 0);
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 strcpy(env, name);
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
21 strcat(env, "=");
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
22 strcat(env, val);
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
23 putenv(env);
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
24
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
25 return 0;
44c24de55f9d - move our setenv() fallback implementation to osdep
al
parents:
diff changeset
26 }