• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ IS_PATH_SEP函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中IS_PATH_SEP函数的典型用法代码示例。如果您正苦于以下问题:C++ IS_PATH_SEP函数的具体用法?C++ IS_PATH_SEP怎么用?C++ IS_PATH_SEP使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了IS_PATH_SEP函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: x_basename

const char *
x_basename (const char *s)
{
    const char *url_delim, *path_sep;

    url_delim = g_strrstr (s, VFS_PATH_URL_DELIMITER);
    path_sep = strrchr (s, PATH_SEP);

    if (path_sep == NULL)
        return s;

    if (url_delim == NULL
        || url_delim < path_sep - strlen (VFS_PATH_URL_DELIMITER)
        || url_delim - s + strlen (VFS_PATH_URL_DELIMITER) < strlen (s))
    {
        /* avoid trailing PATH_SEP, if present */
        if (!IS_PATH_SEP (s[strlen (s) - 1]))
            return (path_sep != NULL) ? path_sep + 1 : s;

        while (--path_sep > s && !IS_PATH_SEP (*path_sep))
            ;
        return (path_sep != s) ? path_sep + 1 : s;
    }

    while (--url_delim > s && !IS_PATH_SEP (*url_delim))
        ;
    while (--url_delim > s && !IS_PATH_SEP (*url_delim))
        ;

    return (url_delim == s) ? s : url_delim + 1;
}
开发者ID:JBurant,项目名称:mc,代码行数:31,代码来源:util.c


示例2: undelfs_get_path

static void
undelfs_get_path (const vfs_path_t * vpath, char **fsname, char **file)
{
    const char *p, *dirname;
    const vfs_path_element_t *path_element;

    path_element = vfs_path_get_by_index (vpath, -1);

    /* To look like filesystem, we have virtual directories
       undel://XXX, which have no subdirectories. XXX is replaced with
       hda5, sdb8 etc, which is assumed to live under /dev. 
       -- [email protected] */

    dirname = path_element->path;

    *fsname = NULL;

    if (strncmp (dirname, "undel://", 8) != 0)
        return;

    dirname += 8;

    /* Since we don't allow subdirectories, it's easy to get a filename,
     * just scan backwards for a slash */
    if (*dirname == 0)
        return;

    p = dirname + strlen (dirname);
#if 0
    /* Strip trailing ./
     */
    if (p - dirname > 2 && IS_PATH_SEP (p[-1]) && p[-2] == '.')
        *(p = p - 2) = 0;
#endif

    while (p > dirname)
    {
        if (IS_PATH_SEP (*p))
        {
            char *tmp;

            *file = g_strdup (p + 1);
            tmp = g_strndup (dirname, p - dirname);
            *fsname = g_strconcat ("/dev/", tmp, (char *) NULL);
            g_free (tmp);
            return;
        }
        p--;
    }
    *file = g_strdup ("");
    *fsname = g_strconcat ("/dev/", dirname, (char *) NULL);
}
开发者ID:Acidburn0zzz,项目名称:mc,代码行数:52,代码来源:undelfs.c


示例3: SLpath_is_absolute_path

int SLpath_is_absolute_path (SLFUTURE_CONST char *name)
{
   if (name == NULL)
     return -1;

#ifdef UNIX_PATHNAMES_OK
   return (*name == '/');
#else
   if (IS_PATH_SEP (*name))
     return 1;

# ifdef DRIVE_SPECIFIER
   /* Look for a drive specifier */
   while (*name)
     {
	if (*name == DRIVE_SPECIFIER)
	  return 1;

	name++;
     }
# endif

   return 0;
#endif
}
开发者ID:parke,项目名称:slang,代码行数:25,代码来源:slpath.c


示例4: strlen

/* If path looks like: A/B/C/D/whatever, it returns A/B/C/D as a malloced
 * string.
 */
char *SLpath_dirname (SLFUTURE_CONST char *file)
{
   SLCONST char *b;

   if (file == NULL) return NULL;
   b = file + strlen (file);

   while (b != file)
     {
	b--;
	if (IS_PATH_SEP(*b))
	  {
#ifdef VMS
	     b++;		       /* make sure final ] is included */
#else
	     if (b == file) b++;
#endif
	     break;
	  }

#ifdef DRIVE_SPECIFIER
	if (*b == DRIVE_SPECIFIER)
	  {
	     b++;
	     break;
	  }
#endif
     }

   if (b == file)
     return SLmake_string (THIS_DIR_STRING);

   return SLmake_nstring (file, (unsigned int) (b - file));
}
开发者ID:parke,项目名称:slang,代码行数:37,代码来源:slpath.c


示例5: SLmake_string

/* Returns a malloced string */
char *SLpath_pathname_sans_extname (SLFUTURE_CONST char *file)
{
   char *b;

   file = SLmake_string (file);
   if (file == NULL)
     return NULL;

   b = (char *) file + strlen (file);

   while (b != file)
     {
	b--;
	if (IS_PATH_SEP(*b))
	  break;

#ifdef DRIVE_SPECIFIER
	if (*b == DRIVE_SPECIFIER)
	  {
	     b++;
	     break;
	  }
#endif
	if (*b == '.')
	  {
	     *b = 0;
	     return (char *) file;
	  }
     }

   return (char *) file;
}
开发者ID:parke,项目名称:slang,代码行数:33,代码来源:slpath.c


示例6: findInclude

static int findInclude( const char *path, const char *filename, size_t len, char *fullfilename )
{
    char        *p;
    char        c;

    while( (c = *path) != '\0' ) {
        p = fullfilename;
        do {
            ++path;
            if( IS_PATH_LIST_SEP( c ) ) {
                break;
            }
            *p++ = c;
        } while( (c = *path) != '\0' );
        c = p[-1];
        if( !IS_PATH_SEP( c ) ) {
            *p++ = DIR_SEP;
        }
        memcpy( p, filename, len );
        p[len] = '\0';
        if( access( fullfilename, R_OK ) == 0 ) {
            return( 0 );
        }
    }
    return( -1 );
}
开发者ID:MikeyG,项目名称:open-watcom-v2,代码行数:26,代码来源:preproc.c


示例7: name_file_check

static int name_file_check(char *s)
{
    int i;

    if(IS_PATH_SEP(s[0]))
        return 1;

    if(strncasecmp(s, "file:", 5) == 0)
        return 1;

#ifdef __W32__
    /* [A-Za-z]: (for Windows) */
    if((('A' <= s[0] && s[0] <= 'Z') ||
            ('a' <= s[0] && s[0] <= 'z')) &&
            s[1] == ':')
        return 1;
#endif /* __W32__ */

    for(i = 0; s[i] && s[i] != ':' && s[i] != '/'; i++)
        ;
    if(s[i] == ':' && s[i + 1] == '/')
        return 0;

    return 1;
}
开发者ID:Koroeskohr,项目名称:timidity-utauloid,代码行数:25,代码来源:url_file.c


示例8: SearchPath

static lib_handle SearchPath( char *path_list, char *name ) {
//===========================================================

    char        *p;
    lib_handle  lp;
    char        buff[2 * _MAX_PATH];
    char        c;

    lp = NULL;
    while( (c = *path_list) != '\0' ) {
        p = buff;
        do {
            ++path_list;
            if( IS_PATH_LIST_SEP( c ) )
                break;
            *p++ = c;
        } while( (c = *path_list) != '\0' );
        c = p[-1];
        if( !IS_PATH_SEP( c ) ) {
            *p++ = DIR_SEP;
        }
        strcpy( p, name );
        lp = FindSrcFile( buff );
        if( lp != NULL ) {
            break;
        }
    }
    return( lp );
}
开发者ID:Azarien,项目名称:open-watcom-v2,代码行数:29,代码来源:libsupp.c


示例9: first_path_separator

/*
 *	first_path_separator
 *
 * Find the location of the first path separator (i.e. ':' on
 * Unix, ';' on Windows), return NULL if not found.
 */
char *
first_path_separator(const char *pathlist)
{
	const char *p;

	/* skip_drive is not needed */
	for (p = pathlist; *p; p++)
		if (IS_PATH_SEP(*p))
			return (char *) p;
	return NULL;
}
开发者ID:Aldizh,项目名称:buffer_manager,代码行数:17,代码来源:path.c


示例10: get_absolute_name

static vfs_path_t *
get_absolute_name (const vfs_path_t * vpath)
{
    if (vpath == NULL)
        return NULL;

    if (IS_PATH_SEP (*vfs_path_get_by_index (vpath, 0)->path))
        return vfs_path_clone (vpath);

    return vfs_path_append_vpath_new (vfs_get_raw_current_dir (), vpath, NULL);
}
开发者ID:BpArCuCTeMbI,项目名称:mc,代码行数:11,代码来源:filenot.c


示例11: tilde_expand

char *
tilde_expand (const char *directory)
{
    struct passwd *passwd;
    const char *p, *q;

    if (*directory != '~')
        return g_strdup (directory);

    p = directory + 1;

    /* d = "~" or d = "~/" */
    if (*p == '\0' || IS_PATH_SEP (*p))
    {
        passwd = getpwuid (geteuid ());
        q = IS_PATH_SEP (*p) ? p + 1 : "";
    }
    else
    {
        q = strchr (p, PATH_SEP);
        if (!q)
        {
            passwd = getpwnam (p);
        }
        else
        {
            char *name;

            name = g_strndup (p, q - p);
            passwd = getpwnam (name);
            q++;
            g_free (name);
        }
    }

    /* If we can't figure the user name, leave tilde unexpanded */
    if (!passwd)
        return g_strdup (directory);

    return g_strconcat (passwd->pw_dir, PATH_SEP_STR, q, (char *) NULL);
}
开发者ID:ActionLuzifer,项目名称:mc,代码行数:41,代码来源:utilunix.c


示例12: nodirectory_form

/* Return: 0: - not modified
 *         1: - modified
 */
int nodirectory_form(char *buffer)
{
	char *lastp = buffer + strlen(buffer);
	char *p = lastp;

	while(p > buffer && IS_PATH_SEP(*(p - 1)))
		p--;
	if(p == lastp)
		return 0;
	*p = '\0';
	return 1;
}
开发者ID:OS2World,项目名称:MM-SOUND-TiMidity-MCD,代码行数:15,代码来源:w32g_utl.c


示例13: mc_build_filenamev

char *
mc_build_filenamev (const char *first_element, va_list args)
{
    gboolean absolute;
    const char *element = first_element;
    GString *path;
    char *ret;

    if (element == NULL)
        return NULL;

    path = g_string_new ("");

    absolute = IS_PATH_SEP (*first_element);

    do
    {
        if (*element == '\0')
            element = va_arg (args, char *);
        else
        {
            char *tmp_element;
            size_t len;
            const char *start;

            tmp_element = g_strdup (element);

            element = va_arg (args, char *);

            canonicalize_pathname (tmp_element);
            len = strlen (tmp_element);
            start = IS_PATH_SEP (tmp_element[0]) ? tmp_element + 1 : tmp_element;

            g_string_append (path, start);
            if (!IS_PATH_SEP (tmp_element[len - 1]) && element != NULL)
                g_string_append_c (path, PATH_SEP);

            g_free (tmp_element);
        }
    }
开发者ID:ActionLuzifer,项目名称:mc,代码行数:40,代码来源:utilunix.c


示例14: directory_form

/* Return: 0: - not modified
 *         1: - modified
 */
int directory_form(char *buffer)
{
	int len;

	len = strlen(buffer);
	if(len == 0 || buffer[len - 1] == PATH_SEP)
		return 0;
	if(IS_PATH_SEP(buffer[len - 1]))
		len--;
	buffer[len++] = PATH_SEP;
	buffer[len] = '\0';
	return 1;
}
开发者ID:OS2World,项目名称:MM-SOUND-TiMidity-MCD,代码行数:16,代码来源:w32g_utl.c


示例15: pathcmp

int pathcmp(const char *p1, const char *p2, int ignore_case)
{
    int c1, c2;

#ifdef __W32__
    ignore_case = 1;	/* Always ignore the case */
#endif

    do {
	c1 = *p1++ & 0xff;
	c2 = *p2++ & 0xff;
	if(ignore_case)
	{
	    c1 = tolower(c1);
	    c2 = tolower(c2);
	}
	if(IS_PATH_SEP(c1)) c1 = *p1 ? 0x100 : 0;
	if(IS_PATH_SEP(c2)) c2 = *p2 ? 0x100 : 0;
    } while(c1 == c2 && c1 /* && c2 */);

    return c1 - c2;
}
开发者ID:Jberlinsky,项目名称:LittleBands,代码行数:22,代码来源:common.c


示例16: ConcatDirElem

static void ConcatDirElem( char *dir, const char *elem )
/******************************************************/
{
    size_t      len;

    len = strlen( dir );
    if( len > 0 ) {
        char c = dir[len - 1];
        if( !IS_PATH_SEP( c ) ) {
            dir[len++] = DIR_SEP;
        }
    }
    strcpy( dir + len, elem );
}
开发者ID:Azarien,项目名称:open-watcom-v2,代码行数:14,代码来源:mkinf.c


示例17: mkdir_cmd

void
mkdir_cmd (void)
{
    char *dir;
    const char *name = "";

    /* If 'on' then automatically fills name with current selected item name */
    if (auto_fill_mkdir_name && !DIR_IS_DOTDOT (selection (current_panel)->fname))
        name = selection (current_panel)->fname;

    dir =
        input_expand_dialog (_("Create a new Directory"),
                             _("Enter directory name:"), MC_HISTORY_FM_MKDIR, name,
                             INPUT_COMPLETE_FILENAMES);

    if (dir != NULL && *dir != '\0')
    {
        vfs_path_t *absdir;

        if (IS_PATH_SEP (dir[0]) || dir[0] == '~')
            absdir = vfs_path_from_str (dir);
        else
        {
            /* possible escaped '~' */
            /* allow create directory with name '~' */
            char *tmpdir = dir;

            if (dir[0] == '\\' && dir[1] == '~')
                tmpdir = dir + 1;

            absdir = vfs_path_append_new (current_panel->cwd_vpath, tmpdir, NULL);
        }

        save_cwds_stat ();
        if (my_mkdir (absdir, 0777) == 0)
        {
            update_panels (UP_OPTIMIZE, dir);
            repaint_screen ();
            select_item (current_panel);
        }
        else
        {
            message (D_ERROR, MSG_ERROR, "%s", unix_error_string (errno));
        }
        vfs_path_free (absdir);
    }
    g_free (dir);
}
开发者ID:BpArCuCTeMbI,项目名称:mc,代码行数:48,代码来源:cmd.c


示例18: nice_cd

static void
nice_cd (const char *text, const char *xtext, const char *help,
         const char *history_name, const char *prefix, int to_home, gboolean strip_password)
{
    char *machine;
    char *cd_path;

    if (!SELECTED_IS_PANEL)
        return;

    machine =
        input_dialog_help (text, xtext, help, history_name, INPUT_LAST_TEXT, strip_password,
                           INPUT_COMPLETE_FILENAMES | INPUT_COMPLETE_CD | INPUT_COMPLETE_HOSTNAMES |
                           INPUT_COMPLETE_USERNAMES);
    if (machine == NULL)
        return;

    to_home = 0;                /* FIXME: how to solve going to home nicely? /~/ is
                                   ugly as hell and leads to problems in vfs layer */

    if (strncmp (prefix, machine, strlen (prefix)) == 0)
        cd_path = g_strconcat (machine, to_home ? "/~/" : (char *) NULL, (char *) NULL);
    else
        cd_path = g_strconcat (prefix, machine, to_home ? "/~/" : (char *) NULL, (char *) NULL);

    g_free (machine);

    if (!IS_PATH_SEP (*cd_path))
    {
        char *tmp = cd_path;

        cd_path = g_strconcat (PATH_SEP_STR, tmp, (char *) NULL);
        g_free (tmp);
    }

    {
        vfs_path_t *cd_vpath;

        cd_vpath = vfs_path_from_str_flags (cd_path, VPF_NO_CANON);
        if (!do_panel_cd (MENU_PANEL, cd_vpath, cd_parse_command))
            message (D_ERROR, MSG_ERROR, _("Cannot chdir to \"%s\""), cd_path);
        vfs_path_free (cd_vpath);
    }
    g_free (cd_path);
}
开发者ID:BpArCuCTeMbI,项目名称:mc,代码行数:45,代码来源:cmd.c


示例19: PP_FindInclude

/* Include search order is intended to be compatible with C/C++ compilers
 * and is as follows:
 *
 * 1) For absolute pathnames, try only that pathname and nothing else
 *
 * 2) For includes in double quotes only, search current directory
 *
 * 3) For includes in double quotes only, search the directory
 *    of including file
 *
 * 4) Search include directories specified by IncludePath1 (usually command
 *    line -I argument(s)
 *
 * 5) Search include directories specified by IncludePath2 (usualy INCLUDE path)
 *
 * 6) Directory 'h' adjacent to current directory (../h)
 *
 * Note that some of these steps will be skipped if PPFLAG_IGNORE_CWD and/or
 * PPFLAG_IGNORE_INCLUDE is set.
 */
int PP_FindInclude( const char *filename, size_t len, char *fullfilename, int incl_type )
{
    int         rc = -1;
    char        drivebuf[_MAX_DRIVE];
    char        dirbuf[_MAX_DIR];

    memcpy( fullfilename, filename, len );
    fullfilename[len] = '\0';
    if( HAS_PATH( fullfilename ) ) {
        rc = access( fullfilename, R_OK );
    } else {
        if( rc == -1 && incl_type != PPINCLUDE_SYS && (PPFlags & PPFLAG_IGNORE_CWD) == 0 ) {
            rc = access( fullfilename, R_OK );
        }
        if( rc == -1 && incl_type == PPINCLUDE_USR && PP_File != NULL ) {
            size_t  len1;

            _splitpath( PP_File->filename, drivebuf, dirbuf, NULL, NULL );
            _makepath( fullfilename, drivebuf, dirbuf, NULL, NULL );
            len1 = strlen( fullfilename );
            if( len1 > 0 ) {
                char c = fullfilename[len1 - 1];
                if( !IS_PATH_SEP( c ) ) {
                    fullfilename[len1++] = DIR_SEP;
                }
            }
            memcpy( fullfilename + len1, filename, len );
            fullfilename[len1 + len] = '\0';
            rc = access( fullfilename, R_OK );
        }
        if( rc == -1 && IncludePath1 != NULL ) {
            rc = findInclude( IncludePath1, filename, len, fullfilename );
        }
        if( rc == -1 && IncludePath2 != NULL ) {
            rc = findInclude( IncludePath2, filename, len, fullfilename );
        }
        if( rc == -1 && incl_type == PPINCLUDE_USR && (PPFlags & PPFLAG_IGNORE_DEFDIRS) == 0 ) {
            memcpy( fullfilename, H_DIR, sizeof( H_DIR ) - 1 );
            memcpy( fullfilename + sizeof( H_DIR ) - 1, filename, len );
            fullfilename[sizeof( H_DIR ) - 1 + len] = '\0';
            rc = access( fullfilename, R_OK );
        }
    }
    return( rc );
}
开发者ID:MikeyG,项目名称:open-watcom-v2,代码行数:65,代码来源:preproc.c


示例20: RcTmpFileName

extern void RcTmpFileName( char *tmpfilename )
/********************************************/
/* uses the TMP env. var. if it is set and puts the result into tmpfilename */
/* which is assumed to be a buffer of at least _MAX_PATH characters */
{
    char    *nextchar;
    char    *tmpdir;

    tmpdir = RcGetEnv( "TMP" );
    nextchar = tmpfilename;
    if( tmpdir != NULL && *tmpdir != '\0' ) {
        GetPathElement( tmpdir, NULL, &nextchar );
        if( !IS_PATH_SEP( nextchar[-1] ) ) {
            *nextchar++ = DIR_SEP;
        }
    }
    tmpnam( nextchar );
}
开发者ID:jossk,项目名称:open-watcom-v2,代码行数:18,代码来源:rcio.c



注:本文中的IS_PATH_SEP函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ IS_PLAYER_GUID函数代码示例发布时间:2022-05-30
下一篇:
C++ IS_NULL函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap