当前位置: 首页>>代码示例>>C++>>正文


C++ IS_PATH_SEP函数代码示例

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


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


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