亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? putenv.c

?? C標準庫源代碼,能提高對C的理解,不錯的哦
?? C
字號:
/***
*putenv.c - put an environment variable into the environment
*
*       Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved.
*
*Purpose:
*       defines _putenv() - adds a new variable to environment; does not
*       change global environment, only the process' environment.
*
*******************************************************************************/

#ifdef _WIN32


#include <windows.h>
#include <cruntime.h>
#include <internal.h>
#include <mtdll.h>
#include <stdlib.h>
#include <string.h>
#include <tchar.h>
#include <dbgint.h>

#ifndef CRTDLL

/*
 * Flag checked by getenv() and _putenv() to determine if the environment has
 * been initialized.
 */
extern int __env_initialized;

#endif  /* CRTDLL */

/***
*int _putenv(option) - add/replace/remove variable in environment
*
*Purpose:
*       option should be of the form "option=value".  If a string with the
*       given option part already exists, it is replaced with the given
*       string; otherwise the given string is added to the environment.
*       If the string is of the form "option=", then the string is
*       removed from the environment, if it exists.  If the string has
*       no equals sign, error is returned.
*
*Entry:
*       char *option - option string to set in the environment list.
*           should be of the form "option=value".
*
*Exit:
*       returns 0 if OK, -1 if fails.
*
*Exceptions:
*
*Warning:
*       This code will not work if variables are removed from the
*       environment by deleting them from environ[].  Use _putenv("option=")
*       to remove a variable.
*
*******************************************************************************/

#ifdef _MT

#ifdef WPRFLAG
int __cdecl _wputenv (
#else  /* WPRFLAG */
int __cdecl _putenv (
#endif  /* WPRFLAG */
        const _TSCHAR *option
        )
{
        int retval;

        _mlock(_ENV_LOCK);

#ifdef WPRFLAG
        retval = _wputenv_lk(option);
#else  /* WPRFLAG */
        retval = _putenv_lk(option);
#endif  /* WPRFLAG */

        _munlock(_ENV_LOCK);

        return retval;
}

#ifdef WPRFLAG
int __cdecl _wputenv_lk (
#else  /* WPRFLAG */
int __cdecl _putenv_lk (
#endif  /* WPRFLAG */
        const _TSCHAR *option
        )

#else  /* _MT */

#ifdef WPRFLAG
int __cdecl _wputenv (
#else  /* WPRFLAG */
int __cdecl _putenv (
#endif  /* WPRFLAG */
        const _TSCHAR *option
        )

#endif  /* _MT */

{
        int size;
        _TSCHAR * newoption;

#ifndef CRTDLL
        /*
         * Make sure the environment is initialized.
         */
        if  ( !__env_initialized )
            return -1;
#endif  /* CRTDLL */

        /*
         * At startup, we obtain the 'native' flavor of environment strings
         * from the OS. So a "main" program has _environ and a "wmain" has
         * _wenviron loaded at startup. Only when the user gets or puts the
         * 'other' flavor do we convert it.
         */

        /* copy the new environent string */
        if ( (newoption = (_TSCHAR *)_malloc_crt((_tcslen(option)+1) *
             sizeof(_TSCHAR))) == NULL )
            return -1;

        _tcscpy(newoption, option);

#ifdef WPRFLAG
        if (__crtwsetenv(newoption, 1) != 0)
            return -1;

        /* If other environment type exists, set it */
        if (_environ)
        {
            char *mboption;

            /* find out how much space is needed */
            if ( (size = WideCharToMultiByte(CP_OEMCP, 0, option, -1, NULL,
                 0, NULL, NULL)) == 0 )
                return -1;

            /* allocate space for variable */
            if ((mboption = (char *) _malloc_crt(size * sizeof(char))) == NULL)
                return -1;

            /* convert it */
            if ( WideCharToMultiByte(CP_OEMCP, 0, option, -1, mboption, size,
                 NULL, NULL) == 0 )
                return -1;

            /* set it - this is not primary call, so set primary == 0 */
            if (__crtsetenv(mboption, 0) != 0)
                return -1;
        }
#else  /* WPRFLAG */
        /* Set requested environment type, primary call */
        if (__crtsetenv(newoption, 1) != 0)
            return -1;

        /* If other environment type exists, set it */
        if (_wenviron)
        {
            wchar_t *woption;

            /* find out how much space is needed */
            if ( (size = MultiByteToWideChar(CP_OEMCP, 0, option, -1, NULL, 0))
                 == 0)
                return -1;

            /* allocate space for variable */
            if ( (woption = (wchar_t *) _malloc_crt(size * sizeof(wchar_t)))
                 == NULL )
                return -1;

            /* convert it */
            if ( MultiByteToWideChar(CP_OEMCP, 0, option, -1, woption, size)
                 == 0 )
                return -1;

            /* set it - this is not primary call, so set primary == 0 */
            if (__crtwsetenv(woption, 0) != 0)
                return -1;
        }
#endif  /* WPRFLAG */

        return 0;
}



/***
*int findenv(name, len) - [STATIC]
*
*Purpose:
*       Scan for the given string within the environment
*
*Entry:
*
*Exit:
*       Returns the offset in "environ[]" of the given variable
*       Returns the negative of the length of environ[] if not found.
*       Returns 0 if the environment is empty.
*
*       [NOTE: That a 0 return can mean that the environment is empty
*       or that the string was found as the first entry in the array.]
*
*Exceptions:
*
*******************************************************************************/

#ifdef WPRFLAG
static int __cdecl wfindenv (
#else  /* WPRFLAG */
static int __cdecl findenv (
#endif  /* WPRFLAG */
        const _TSCHAR *name,
        int len
        )
{
        _TSCHAR **env;

        for ( env = _tenviron ; *env != NULL ; env++ ) {
            /*
             * See if first len characters match, up to case
             */
            if ( _tcsnicoll(name, *env, len) == 0 )
                /*
                 * the next character of the environment string must
                 * be an '=' or a '\0'
                 */
                if ( (*env)[len] == _T('=') || (*env)[len] == _T('\0') )
                    return(env - _tenviron);
//
// We cannot break here since findenv must report the total number of strings.
//              else
//                  break;
        }

        return(-(env - _tenviron));
}


#else  /* _WIN32 */


#include <cruntime.h>
#include <errno.h>
#include <malloc.h>
#include <stdlib.h>
#include <string.h>
#include <internal.h>
#include <mtdll.h>
#include <memory.h>
#include <dbgint.h>

static int __cdecl findenv(const char *name, int len);

/***
*int _putenv(option) - add/replace/remove variable in environment
*
*Purpose:
*       option should be of the form "option=value".  If a string with the
*       given option part already exists, it is replaced with the given
*       string; otherwise the given string is added to the environment.
*       If the string is of the form "option=", then the string is
*       removed from the environment, if it exists.  If the string has
*       no equals sign, error is returned.
*
*Entry:
*       char *option - option string to set in the environment list.
*           should be of the form "option=value".
*
*Exit:
*       returns 0 if OK, -1 if fails.
*
*Exceptions:
*
*Warning:
*       This code will not work if variables are removed from the
*       environment by deleting them from environ[].  Use _putenv("option=")
*       to remove a variable.
*
*******************************************************************************/

#ifdef _MT

int __cdecl _putenv (
        const char *option
        )
{
        int retval;

        _mlock(_ENV_LOCK);

        retval = _putenv_lk(option);

        _munlock(_ENV_LOCK);

        return retval;
}

int __cdecl _putenv_lk (
        const char *option
        )

#else  /* _MT */

int __cdecl _putenv (
        const char *option
        )

#endif  /* _MT */

{
        char **env;
        const char *equal;
        int ix;
        int remove;     /* 1 means remove string from environment */

        /* check that the option string is valid and find the equal sign
         */
        if ( (option == NULL) || ((equal = strchr(option, '=')) == NULL) )
            return(-1);

        /* check for the special case of '=' being the very first character
         * of option. though the use of '=' in an environment variable name
         * is documented as being illegal, the 'current directory' strings
         * all look like this:
         *
         *  =<Drive Letter>:=<Drive Letter><fully qualified path>
         *
         * handle this by setting the equal pointer to point to the second
         * '=' if it exists. Otherwise, handle as before.
         */
        if ( option == equal )
            if ( (equal = strchr(option + 1, '=')) == NULL )
                equal = option;

        /* if the character following '=' is null, we are removing the
         * the environment variable. Otherwise, we are adding or updating
         * an environment variable.
         */
        remove = (*(equal + 1) == '\0');

        /* see if _environ array exists */
        if (_environ == NULL) {
            if ( remove )
                return 0;
            else {
                /* get an array and init it to NULL */
                if ( (_environ = _malloc_crt(sizeof(void *))) == NULL)
                    return -1;
                *_environ = NULL;
            }
        }

        /* init env pointer */

        env = _environ;

        /* See if the string is already in the environment */

        ix = findenv(option, equal - option);

        if ((ix >= 0) && (*env != NULL)) {
            /* String is already in the environment -- overwrite/remove it.
             */
            if (remove) {
                /* removing -- move all the later strings up */
                for ( ; env[ix] != NULL; ++ix) {
                    env[ix] = env[ix+1];
                }

                /* shrink the environment memory block
                   (ix now has number of strings, including NULL) --
                   this realloc probably can't fail, since we're
                   shrinking a mem block, but we're careful anyway. */
                if (env = (char **) _realloc_crt(env, ix * sizeof(char *)))
                    _environ = env;
            }
            else {
                /* replace the option */
                env[ix] = (char *) option;
            }
        }
        else {
            /*
             * String is NOT in the environment
             */
            if ( !remove )  {

                /*
                 * Append the string to the environ table. Note that
                 * table must be grown to do this.
                 */
                if (ix < 0)
                    ix = -ix;    /* ix = length of environ table */

                if ( (env = (char **)_realloc_crt(env, sizeof(char *) *
                    (ix + 2))) == NULL )
                    return -1;

                env[ix] = (char *)option;
                env[ix + 1] = NULL;
                _environ = env;
            }
            else
                /*
                 * We are asked to remove an environment var that
                 * isn't there...just return success
                 */
                return 0;
        }

        return 0;
}


/***
*int findenv(name, len) - [STATIC]
*
*Purpose:
*       Scan for the given string within the environment
*
*Entry:
*
*Exit:
*       Returns the offset in "environ[]" of the given variable
*       Returns the negative of the length of environ[] if not found.
*       Returns 0 if the environment is empty.
*
*       [NOTE: That a 0 return can mean that the environment is empty
*       or that the string was found as the first entry in the array.]
*
*Exceptions:
*
*******************************************************************************/

static int __cdecl findenv (
        const char *name,
        int len
        )
{
        char **env;

        for ( env = _environ ; *env != NULL ; env++ ) {
            /*
             * See if first len characters match, up to case
             */
            if ( _strnicmp(name, *env, len) == 0 )
                /*
                 * the next character of the environment string must
                 * be an '=' or a '\0'
                 */
                if ( (*env)[len] == '=' || (*env)[len] == '\0' )
                    return(env - _environ);
//
// We cannot break here since findenv must report the total number of strings.
//              else
//                  break;
        }

        return(-(env - _environ));
}



#endif  /* _WIN32 */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
在线一区二区三区四区五区 | 色菇凉天天综合网| 国产成人一区在线| 国产一区二区三区精品视频| 精品无码三级在线观看视频| 久久国产精品99久久人人澡| 黑人精品欧美一区二区蜜桃| 国产一区二区精品久久91| 国产91综合一区在线观看| 成人免费毛片嘿嘿连载视频| 91美女精品福利| 色av一区二区| 欧美一区二区在线看| 精品久久久久久久久久久久久久久| 欧美一级片在线| 久久久久99精品一区| 亚洲欧洲色图综合| 天堂在线亚洲视频| 黑人巨大精品欧美一区| 成人激情图片网| 欧美亚洲免费在线一区| 精品国产百合女同互慰| **欧美大码日韩| 日韩国产精品久久久久久亚洲| 久久99久国产精品黄毛片色诱| 成人动漫一区二区在线| 欧美欧美欧美欧美首页| 国产日韩欧美高清| 亚洲一区二区三区在线播放 | 久久久久99精品一区| 亚洲欧美日韩综合aⅴ视频| 丝袜美腿成人在线| 国产传媒欧美日韩成人| 欧美在线不卡一区| 久久新电视剧免费观看| 亚洲尤物视频在线| 国产成人精品亚洲日本在线桃色| 欧美综合一区二区| 国产亚洲精品资源在线26u| 亚洲国产精品一区二区久久恐怖片| 国内成人精品2018免费看| 欧美性高清videossexo| 国产日韩av一区| 日本成人中文字幕在线视频| 99国产一区二区三精品乱码| 精品免费视频.| 亚欧色一区w666天堂| 99久久综合精品| 久久综合av免费| 日本在线播放一区二区三区| 欧美亚洲免费在线一区| 日韩美女视频一区二区| 国产激情91久久精品导航| 日韩免费视频一区二区| 亚洲成人av在线电影| 91成人免费电影| 亚洲私人黄色宅男| 成人国产精品免费观看| 久久久综合精品| 国产一区二区在线视频| 日韩精品一区二区三区蜜臀 | 天天色综合天天| 欧美亚洲尤物久久| 一二三区精品视频| 91成人网在线| 亚洲午夜国产一区99re久久| 91黄色免费网站| 亚洲曰韩产成在线| 欧美三级乱人伦电影| 亚洲图片一区二区| 欧美三级韩国三级日本一级| 亚洲国产wwwccc36天堂| 欧美日韩国产影片| 青青草成人在线观看| 欧美日韩1234| 天天免费综合色| 日韩一级高清毛片| 精品在线观看视频| 久久久久97国产精华液好用吗| 国产一区二区在线观看免费| 精品欧美乱码久久久久久1区2区| 狠狠色丁香婷婷综合| 中文字幕欧美激情一区| 99re热视频这里只精品| 亚洲午夜影视影院在线观看| 欧美一区二区视频免费观看| 麻豆91精品91久久久的内涵| 久久久久久久精| 色婷婷一区二区三区四区| 五月婷婷另类国产| 日韩精品一区二区三区四区视频| 国产一区不卡精品| 最新中文字幕一区二区三区 | 日韩欧美一级在线播放| 国产剧情在线观看一区二区| 国产精品欧美一区喷水| 在线观看国产日韩| 久久9热精品视频| 国产精品久久久久久久久搜平片| 欧美伊人精品成人久久综合97| 麻豆传媒一区二区三区| 国产精品乱码人人做人人爱| 色综合激情久久| 九九在线精品视频| 一区二区三区日本| 精品久久人人做人人爰| 色八戒一区二区三区| 国产裸体歌舞团一区二区| 中文字幕一区二区三区在线观看| 欧美精品三级日韩久久| 成人av资源在线| 美日韩一区二区三区| 国产精品电影院| 精品国产乱码久久久久久1区2区 | 亚洲综合色网站| 久久久久国产一区二区三区四区| 欧美性大战xxxxx久久久| 国产激情精品久久久第一区二区| 亚洲一区二区在线播放相泽| 国产精品婷婷午夜在线观看| 日韩欧美成人一区二区| 日本久久电影网| 成人动漫一区二区在线| 久久91精品久久久久久秒播| 亚洲第一av色| 亚洲美女免费视频| 国产清纯美女被跳蛋高潮一区二区久久w | 综合久久给合久久狠狠狠97色| 日韩欧美在线1卡| 欧美久久一区二区| 欧美午夜视频网站| 色综合咪咪久久| 99精品视频中文字幕| 国产不卡视频一区二区三区| 极品少妇xxxx精品少妇偷拍| 日韩精品欧美精品| 午夜激情久久久| 亚洲国产一区二区a毛片| 亚洲综合久久av| 亚洲国产精品一区二区www| 一区二区三区在线不卡| 国产午夜亚洲精品理论片色戒 | 不卡视频一二三四| 丰满岳乱妇一区二区三区| 国产乱码精品一区二区三区忘忧草| 日韩国产在线观看一区| 亚洲国产成人tv| 丝袜亚洲另类丝袜在线| 日韩制服丝袜av| 麻豆国产一区二区| 狠狠色狠狠色综合系列| 久久99在线观看| 国产一区二区三区在线观看精品| 韩国中文字幕2020精品| 国产精品一区三区| 成人国产精品免费观看| 91美女视频网站| 欧美日韩午夜影院| 日韩美女天天操| 国产人成一区二区三区影院| 国产精品麻豆网站| 国产精品第五页| 亚洲成人av在线电影| 麻豆精品国产传媒mv男同 | 91在线小视频| 欧美午夜片在线观看| 日韩一区二区三区精品视频| 日韩欧美一区二区久久婷婷| 久久青草欧美一区二区三区| 国产精品国模大尺度视频| 一区二区高清在线| 五月婷婷综合网| 国产麻豆成人精品| 99久久er热在这里只有精品15| 欧美性猛交xxxx乱大交退制版| 日韩一区二区电影网| 久久久91精品国产一区二区精品| 国产精品久久久久久久久快鸭| 亚洲综合小说图片| 韩国v欧美v亚洲v日本v| 色哟哟国产精品免费观看| 欧美精品乱码久久久久久按摩 | 国产精品妹子av| 午夜成人免费视频| 国产91精品久久久久久久网曝门| 91日韩精品一区| 日韩一级精品视频在线观看| 国产精品欧美一级免费| 琪琪一区二区三区| 91亚洲精品久久久蜜桃| 欧美电影免费观看高清完整版在线| 中文字幕欧美日本乱码一线二线| 五月激情综合网| 色综合久久久久久久久| 欧美tickle裸体挠脚心vk| 一卡二卡欧美日韩| 成人黄色在线网站| 欧美成人激情免费网| 午夜精品一区二区三区三上悠亚| 国产成人福利片|