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

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

?? getcwd.c

?? C標準庫源代碼,能提高對C的理解,不錯的哦
?? C
字號:
/***
*getcwd.c - get current working directory
*
*       Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved.
*
*Purpose:
*
*       contains functions _getcwd, _getdcwd and _getcdrv for getting the
*       current working directory.  getcwd gets the c.w.d. for the default disk
*       drive, whereas _getdcwd allows one to get the c.w.d. for whatever disk
*       drive is specified. _getcdrv gets the current drive.
*
*******************************************************************************/

#ifndef _MAC

#include <cruntime.h>
#include <mtdll.h>
#include <msdos.h>
#include <errno.h>
#include <malloc.h>
#include <oscalls.h>
#include <stdlib.h>
#include <internal.h>
#include <direct.h>
#include <tchar.h>


/***
*_TSCHAR *_getcwd(pnbuf, maxlen) - get current working directory of default drive
*
*Purpose:
*       _getcwd gets the current working directory for the user,
*       placing it in the buffer pointed to by pnbuf.  It returns
*       the length of the string put in the buffer.  If the length
*       of the string exceeds the length of the buffer, maxlen,
*       then NULL is returned.  If pnbuf = NULL, maxlen is ignored.
*       An entry point "_getdcwd()" is defined with takes the above
*       parameters, plus a drive number.  "_getcwd()" is implemented
*       as a call to "_getcwd()" with the default drive (0).
*
*       If pnbuf = NULL, maxlen is ignored, and a buffer is automatically
*       allocated using malloc() -- a pointer to which is returned by
*       _getcwd().
*
*       side effects: no global data is used or affected
*
*Entry:
*       _TSCHAR *pnbuf = pointer to a buffer maintained by the user;
*       int maxlen = length of the buffer pointed to by pnbuf;
*
*Exit:
*       Returns pointer to the buffer containing the c.w.d. name
*       (same as pnbuf if non-NULL; otherwise, malloc is
*       used to allocate a buffer)
*
*Exceptions:
*
*******************************************************************************/

_TSCHAR * __cdecl _tgetcwd (
        _TSCHAR *pnbuf,
        int maxlen
        )
{
        _TSCHAR *retval;

        _mlock(_ENV_LOCK);

#ifdef WPRFLAG
        retval = _wgetdcwd_lk(0, pnbuf, maxlen);
#else  /* WPRFLAG */
        retval = _getdcwd_lk(0, pnbuf, maxlen);
#endif  /* WPRFLAG */

        _munlock(_ENV_LOCK);

        return retval;
}


/***
*_TSCHAR *_getdcwd(drive, pnbuf, maxlen) - get c.w.d. for given drive
*
*Purpose:
*       _getdcwd gets the current working directory for the user,
*       placing it in the buffer pointed to by pnbuf.  It returns
*       the length of the string put in the buffer.  If the length
*       of the string exceeds the length of the buffer, maxlen,
*       then NULL is returned.  If pnbuf = NULL, maxlen is ignored,
*       and a buffer is automatically allocated using malloc() --
*       a pointer to which is returned by _getdcwd().
*
*       side effects: no global data is used or affected
*
*Entry:
*       int drive   - number of the drive being inquired about
*                     0 = default, 1 = 'a:', 2 = 'b:', etc.
*       _TSCHAR *pnbuf - pointer to a buffer maintained by the user;
*       int maxlen  - length of the buffer pointed to by pnbuf;
*
*Exit:
*       Returns pointer to the buffer containing the c.w.d. name
*       (same as pnbuf if non-NULL; otherwise, malloc is
*       used to allocate a buffer)
*
*Exceptions:
*
*******************************************************************************/


#ifdef _MT

_TSCHAR * __cdecl _tgetdcwd (
        int drive,
        _TSCHAR *pnbuf,
        int maxlen
        )
{
        _TSCHAR *retval;

        _mlock(_ENV_LOCK);

#ifdef WPRFLAG
        retval = _wgetdcwd_lk(drive, pnbuf, maxlen);
#else  /* WPRFLAG */
        retval = _getdcwd_lk(drive, pnbuf, maxlen);
#endif  /* WPRFLAG */

        _munlock(_ENV_LOCK);

        return retval;
}

#ifdef WPRFLAG
wchar_t * __cdecl _wgetdcwd_lk (
#else  /* WPRFLAG */
char * __cdecl _getdcwd_lk (
#endif  /* WPRFLAG */
        int drive,
        _TSCHAR *pnbuf,
        int maxlen
        )
#else  /* _MT */

_TSCHAR * __cdecl _tgetdcwd (
        int drive,
        _TSCHAR *pnbuf,
        int maxlen
        )
#endif  /* _MT */

{
        _TSCHAR *p;
        _TSCHAR dirbuf[_MAX_PATH];
        _TSCHAR drvstr[4];
        int len;
        _TSCHAR *pname; /* only used as argument to GetFullPathName */

        /*
         * GetCurrentDirectory only works for the default drive in Win32
         */
        if ( drive != 0 ) {
            /*
             * Not the default drive - make sure it's valid.
             */
            if ( !_validdrive(drive) ) {
                _doserrno = ERROR_INVALID_DRIVE;
                errno = EACCES;
                return NULL;
            }

            /*
             * Get the current directory string on that drive and its length
             */
            drvstr[0] = _T('A') - 1 + drive;
            drvstr[1] = _T(':');
            drvstr[2] = _T('.');
            drvstr[3] = _T('\0');
            len = GetFullPathName( drvstr,
                                   sizeof(dirbuf) / sizeof(_TSCHAR),
                                   dirbuf,
                                   &pname );

        } else {

            /*
             * Get the current directory string and its length
             */
            len = GetCurrentDirectory( sizeof(dirbuf) / sizeof(_TSCHAR),
                                       (LPTSTR)dirbuf );
        }

        /* API call failed, or buffer not large enough */
        if ( len == 0 || ++len > sizeof(dirbuf)/sizeof(_TSCHAR) )
            return NULL;

        /*
         * Set up the buffer.
         */
        if ( (p = pnbuf) == NULL ) {
            /*
             * Allocate a buffer for the user.
             */
            if ( (p = (_TSCHAR *)malloc(__max(len, maxlen) * sizeof(_TSCHAR)))
                 == NULL )
            {
                errno = ENOMEM;
                return NULL;
            }
        }
        else if ( len > maxlen ) {
            /*
             * Won't fit in the user-supplied buffer!
             */
            errno = ERANGE; /* Won't fit in user buffer */
            return NULL;
        }

        /*
         * Place the current directory string into the user buffer
         */

        return _tcscpy(p, dirbuf);
}

#ifndef WPRFLAG

/***
*int _validdrive( unsigned drive ) -
*
*Purpose: returns non zero if drive is a valid drive number.
*
*Entry: drive = 0 => default drive, 1 => a:, 2 => b: ...
*
*Exit:  0 => drive does not exist.
*
*Exceptions:
*
*******************************************************************************/

int __cdecl _validdrive (
    unsigned drive
    )
{
        unsigned retcode;
        char drvstr[4];

        if ( drive == 0 )
            return 1;

        drvstr[0] = 'A' + drive - 1;
        drvstr[1] = ':';
        drvstr[2] = '\\';
        drvstr[3] = '\0';

        if ( ((retcode = GetDriveType( drvstr )) == DRIVE_UNKNOWN) ||
             (retcode == DRIVE_NO_ROOT_DIR) )
            return 0;

        return 1;
}

#endif  /* WPRFLAG */

#else  /* _MAC */

#include <cruntime.h>
#include <errno.h>
#include <malloc.h>
#include <stdlib.h>
#include <internal.h>
#include <direct.h>
#include <string.h>
#include <macos\osutils.h>
#include <macos\files.h>
#include <macos\errors.h>

/***
*char *_getcwd(pnbuf, maxlen) - get current working directory of default drive
*
*Purpose:
*       _getcwd gets the current working directory for the user,
*       placing it in the buffer pointed to by pnbuf.  It returns
*       the length of the string put in the buffer.  If the length
*       of the string exceeds the length of the buffer, maxlen,
*       then NULL is returned.  If pnbuf = NULL, maxlen is ignored.
*       An entry point "_getdcwd()" is defined with takes the above
*       parameters, plus a drive number.  "_getcwd()" is implemented
*       as a call to "_getcwd()" with the default drive (0).
*
*       If pnbuf = NULL, maxlen is ignored, and a buffer is automatically
*       allocated using malloc() -- a pointer to which is returned by
*       _getcwd().
*
*       side effects: no global data is used or affected
*
*Entry:
*       char *pnbuf = pointer to a buffer maintained by the user;
*       int maxlen = length of the buffer pointed to by pnbuf;
*
*Exit:
*       Returns pointer to the buffer containing the c.w.d. name
*       (same as pnbuf if non-NULL; otherwise, malloc is
*       used to allocate a buffer)
*
*Exceptions:
*******************************************************************************/

/*
** _getcwd() is just a call to _getdcwd() with the default drive
*/

char * __cdecl _getcwd (
        char *pnbuf,
        int maxlen
        )
{
        OSErr osErr;
        WDPBRec wdPB;
        Str255 st;
        int retval;
        HParamBlockRec parm;


        /* see if need to try to allocate buffer in heap */

        if (pnbuf == NULL) {
            maxlen = 256;
            if ((pnbuf = malloc(maxlen)) == NULL) {
                errno = ENOMEM;
                _macerrno = mFulErr;
                return NULL;
            }
        }

        /* see if the volume exist */
        memset(&parm, 0, sizeof(HParamBlockRec));
        osErr = PBHGetVolParmsSync(&parm);
        if (osErr)
        {
            _dosmaperr(osErr);
            *pnbuf = '\0';
            return NULL;
        }


        /* get current/default volumne and directory string.
         */

        memset(&wdPB, '\0', sizeof(WDPBRec));
        wdPB.ioNamePtr = st;
        osErr = PBHGetVolSync(&wdPB);
        if (osErr)
        {
            _dosmaperr(osErr);
            *pnbuf = '\0';
            return NULL;
        }

        retval = SzPathNameFromDirID(wdPB.ioWDDirID, pnbuf, maxlen);
        if (!retval)
        {
            *pnbuf = '\0';
            return NULL;
        }

        return pnbuf;

}

#endif  /* _MAC */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产成人精品一区二区三区四区| 夜夜精品视频一区二区| 欧美男男青年gay1069videost| 成人动漫在线一区| 成人激情动漫在线观看| 91片黄在线观看| 欧美在线综合视频| 91麻豆精品国产无毒不卡在线观看| 欧美日韩综合不卡| 制服.丝袜.亚洲.中文.综合| 欧美日韩成人高清| 欧美电影免费观看高清完整版在线观看 | 久久久99精品免费观看| 精品国产99国产精品| 久久综合久久99| 国产精品国产三级国产专播品爱网| 国产精品国产三级国产专播品爱网| 亚洲免费观看高清完整版在线| 亚洲与欧洲av电影| 九色综合国产一区二区三区| 欧美手机在线视频| 日韩三级视频在线看| 国产偷v国产偷v亚洲高清| 中文字幕一区二区三区不卡 | 成人听书哪个软件好| 97久久精品人人做人人爽| 欧美视频自拍偷拍| 国产亚洲人成网站| 亚洲色图制服诱惑| 美国一区二区三区在线播放| 国产成人av电影在线播放| 91成人看片片| 精品国产污网站| 依依成人精品视频| 伦理电影国产精品| 色菇凉天天综合网| 久久免费电影网| 亚洲国产日韩在线一区模特| 美女性感视频久久| 欧美在线不卡视频| 久久久久久久久久久电影| 亚洲一卡二卡三卡四卡五卡| 久久不见久久见免费视频1| 色妹子一区二区| www国产亚洲精品久久麻豆| 亚洲一区在线视频| 国产aⅴ综合色| 欧美一区二区三区四区在线观看| 国产精品丝袜久久久久久app| 亚洲国产精品久久一线不卡| 国产成人高清在线| 日韩一区二区不卡| 亚洲va国产天堂va久久en| 成人av网站在线观看免费| 日韩欧美成人激情| 性感美女久久精品| 欧美伊人久久久久久久久影院| 国产精品免费丝袜| 久久精品国产久精国产| 欧美日韩在线亚洲一区蜜芽| 中文字幕一区二区三区视频| 高清视频一区二区| 精品福利视频一区二区三区| 色综合天天做天天爱| 久久嫩草精品久久久精品一| 久久精品国产成人一区二区三区| 欧美美女一区二区三区| 亚洲一区二区三区国产| 色哟哟精品一区| 亚洲麻豆国产自偷在线| 99re亚洲国产精品| 尤物av一区二区| 91久久一区二区| 一区二区在线观看不卡| 日本高清不卡aⅴ免费网站| 亚洲精品伦理在线| 色猫猫国产区一区二在线视频| 亚洲精选免费视频| 在线免费亚洲电影| 五月激情综合网| 日韩视频一区二区三区在线播放| 午夜av区久久| 91精品欧美综合在线观看最新| 午夜精彩视频在线观看不卡| 欧美日韩视频专区在线播放| 日日嗨av一区二区三区四区| 日韩免费高清电影| 丁香亚洲综合激情啪啪综合| 亚洲国产精品v| 91国产成人在线| 日本伊人色综合网| 国产日韩精品久久久| 91蜜桃免费观看视频| 性久久久久久久久久久久| 精品毛片乱码1区2区3区| 国产一区二区在线电影| 18成人在线观看| 欧美日韩亚洲国产综合| 日本不卡中文字幕| 国产精品免费观看视频| 欧美视频你懂的| 久久精品国产网站| 中文字幕日韩av资源站| 欧美一区二区女人| www.欧美.com| 卡一卡二国产精品| 亚洲柠檬福利资源导航| 91精品在线一区二区| 成人激情午夜影院| 精品伊人久久久久7777人| 一区二区中文字幕在线| 日韩午夜精品视频| 色婷婷综合久久久| 国产一区二区三区免费| 午夜av区久久| 国产欧美日韩久久| 日韩精品一区二区三区视频| 99精品国产视频| 寂寞少妇一区二区三区| 亚洲制服丝袜av| 日韩一区欧美小说| 久久久蜜桃精品| 欧美一卡在线观看| 色8久久人人97超碰香蕉987| 国产大片一区二区| 蜜臀99久久精品久久久久久软件| 亚洲人成影院在线观看| 久久久不卡网国产精品二区| 91麻豆精品91久久久久同性| 97久久超碰国产精品电影| 狠狠v欧美v日韩v亚洲ⅴ| 日韩成人精品在线观看| 夜夜精品视频一区二区| 亚洲精品一二三四区| 久久精品欧美日韩精品| 精品国产乱码久久久久久蜜臀| 在线国产电影不卡| 色综合久久久久综合99| proumb性欧美在线观看| 国产精品主播直播| 国产在线观看免费一区| 久久99国产精品久久99| 天堂午夜影视日韩欧美一区二区| 依依成人精品视频| 亚洲毛片av在线| 亚洲已满18点击进入久久| 亚洲人被黑人高潮完整版| 中文字幕免费在线观看视频一区| 精品国产区一区| 亚洲精品一区二区三区在线观看| 在线不卡欧美精品一区二区三区| 欧亚洲嫩模精品一区三区| 在线一区二区三区四区五区| 色综合久久中文综合久久97| 一本久久精品一区二区| 在线观看免费亚洲| 欧美日本视频在线| 欧美www视频| 国产色产综合色产在线视频| 中文字幕免费在线观看视频一区| 中文字幕免费一区| 亚洲免费毛片网站| 天天综合天天综合色| 青青草伊人久久| 国产中文字幕精品| 成人精品免费视频| 日本精品免费观看高清观看| 欧美丰满美乳xxx高潮www| 91精品国产欧美一区二区成人| 欧美大肚乱孕交hd孕妇| 国产无人区一区二区三区| 国产精品欧美一区喷水| 亚洲精品网站在线观看| 日日夜夜精品视频免费| 国产伦精品一区二区三区视频青涩| 国产suv精品一区二区883| 色诱视频网站一区| 91精品福利在线一区二区三区| 欧美大度的电影原声| 中文字幕日韩一区二区| 天天色图综合网| 国产精品影音先锋| 欧美性xxxxxx少妇| 精品国内二区三区| 亚洲精品日产精品乱码不卡| 日韩精彩视频在线观看| eeuss鲁片一区二区三区在线观看| 在线观看成人免费视频| 久久久精品人体av艺术| 亚洲成人资源在线| 成人蜜臀av电影| 日韩欧美国产一区在线观看| 国产精品久久久久久久久图文区 | 69堂精品视频| 国产精品网站导航| 蜜桃视频一区二区| 色琪琪一区二区三区亚洲区| 国产偷v国产偷v亚洲高清| 三级亚洲高清视频| 一道本成人在线|