28744
+ ��膩��鰹申鐃順�渇��膩��� 1 /*
+ ��膩��鰹申鐃順�渇��膩��� 2 * setenv implementation for systems lacking it.
+ ��膩��鰹申鐃順�渇��膩��� 3 *
+ ��膩��鰹申鐃順�渇��膩��� 4 * This file is part of MPlayer.
+ ��膩��鰹申鐃順�渇��膩��� 5 *
+ ��膩��鰹申鐃順�渇��膩��� 6 * MPlayer is free software; you can redistribute it and/or modify
+ ��膩��鰹申鐃順�渇��膩��� 7 * it under the terms of the GNU General Public License as published by
+ ��膩��鰹申鐃順�渇��膩��� 8 * the Free Software Foundation; either version 2 of the License, or
+ ��膩��鰹申鐃順�渇��膩��� 9 * (at your option) any later version.
+ ��膩��鰹申鐃順�渇��膩��� 10 *
+ ��膩��鰹申鐃順�渇��膩��� 11 * MPlayer is distributed in the hope that it will be useful,
+ ��膩��鰹申鐃順�渇��膩��� 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ��膩��鰹申鐃順�渇��膩��� 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ��膩��鰹申鐃順�渇��膩��� 14 * GNU General Public License for more details.
+ ��膩��鰹申鐃順�渇��膩��� 15 *
+ ��膩��鰹申鐃順�渇��膩��� 16 * You should have received a copy of the GNU General Public License along
+ ��膩��鰹申鐃順�渇��膩��� 17 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
+ ��膩��鰹申鐃順�渇��膩��� 18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ ��膩��鰹申鐃順�渇��膩��� 19 */
17245
+ ��膩��鰹申鐃順�渇��膩��� 20
21853
+ ��膩��鰹申鐃順�渇��膩��� 21 #include "config.h"
17245
+ ��膩��鰹申鐃順�渇��膩��� 22
+ ��膩��鰹申鐃順�渇��膩��� 23 #include <stdlib.h>
+ ��膩��鰹申鐃順�渇��膩��� 24 #include <string.h>
+ ��膩��鰹申鐃順�渇��膩��� 25 #ifndef MP_DEBUG
+ ��膩��鰹申鐃順�渇��膩��� 26 #define NDEBUG
+ ��膩��鰹申鐃順�渇��膩��� 27 #endif
+ ��膩��鰹申鐃順�渇��膩��� 28 #include <assert.h>
+ ��膩��鰹申鐃順�渇��膩��� 29
+ ��膩��鰹申鐃順�渇��膩��� 30 int setenv(const char *name, const char *val, int overwrite)
+ ��膩��鰹申鐃順�渇��膩��� 31 {
+ ��膩��鰹申鐃順�渇��膩��� 32 int len = strlen(name) + strlen(val) + 2;
+ ��膩��鰹申鐃順�渇��膩��� 33 char *env = malloc(len);
+ ��膩��鰹申鐃順�渇��膩��� 34 if (!env) { return -1; }
+ ��膩��鰹申鐃順�渇��膩��� 35
+ ��膩��鰹申鐃順�渇��膩��� 36 assert(overwrite != 0);
+ ��膩��鰹申鐃順�渇��膩��� 37
+ ��膩��鰹申鐃順�渇��膩��� 38 strcpy(env, name);
+ ��膩��鰹申鐃順�渇��膩��� 39 strcat(env, "=");
+ ��膩��鰹申鐃順�渇��膩��� 40 strcat(env, val);
+ ��膩��鰹申鐃順�渇��膩��� 41 putenv(env);
+ ��膩��鰹申鐃順�渇��膩��� 42
+ ��膩��鰹申鐃順�渇��膩��� 43 return 0;
+ ��膩��鰹申鐃順�渇��膩��� 44 }