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

C++ IS_DIR_SEPARATOR函数代码示例

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

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



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

示例1: lprofApplyPathPrefix

COMPILER_RT_VISIBILITY void
lprofApplyPathPrefix(char *Dest, const char *PathStr, const char *Prefix,
                     size_t PrefixLen, int PrefixStrip) {

  const char *Ptr;
  int Level;
  const char *StrippedPathStr = PathStr;

  for (Level = 0, Ptr = PathStr + 1; Level < PrefixStrip; ++Ptr) {
    if (*Ptr == '\0')
      break;

    if (!IS_DIR_SEPARATOR(*Ptr))
      continue;

    StrippedPathStr = Ptr;
    ++Level;
  }

  memcpy(Dest, Prefix, PrefixLen);

  if (!IS_DIR_SEPARATOR(Prefix[PrefixLen - 1]))
    Dest[PrefixLen++] = DIR_SEPARATOR;

  memcpy(Dest + PrefixLen, StrippedPathStr, strlen(StrippedPathStr) + 1);
}
开发者ID:CTSRD-CHERI,项目名称:cheribsd,代码行数:26,代码来源:InstrProfilingUtil.c


示例2: apply_vpath

/* If T begins with any of the partial pathnames listed in d->vpathv,
   then advance T to point beyond that pathname.  */
static const char *
apply_vpath (struct deps *d, const char *t)
{
  if (d->vpathv)
    {
      unsigned int i;
      for (i = 0; i < d->nvpaths; i++)
	{
	  if (!strncmp (d->vpathv[i], t, d->vpathlv[i]))
	    {
	      const char *p = t + d->vpathlv[i];
	      if (!IS_DIR_SEPARATOR (*p))
		goto not_this_one;

	      /* Do not simplify $(vpath)/../whatever.  ??? Might not
		 be necessary. */
	      if (p[1] == '.' && p[2] == '.' && IS_DIR_SEPARATOR (p[3]))
		goto not_this_one;

	      /* found a match */
	      t = t + d->vpathlv[i] + 1;
	      break;
	    }
	not_this_one:;
	}
    }

  /* Remove leading ./ in any case.  */
  while (t[0] == '.' && IS_DIR_SEPARATOR (t[1]))
    t += 2;

  return t;
}
开发者ID:DJHartley,项目名称:iphone-dev,代码行数:35,代码来源:mkdeps.c


示例3: mkdir_p

int
mkdir_p (const char *path, int mode)
{
  int len;
  char *new_path;
  int ret = 0;

  new_path = (char *) malloc (strlen(path) + 1);
  strcpy (new_path, path);

  len = strlen (new_path);
  while (len > 0 && IS_DIR_SEPARATOR(new_path[len-1]))
    {
      new_path[len-1] = 0;
      len--;
    }

#if defined(_MSC_VER) || defined(__MINGW32__)
  while (!_mkdir (new_path))
#else
  while (!mkdir (new_path, mode))
#endif
    {
      char *slash;
      int last_error = errno;
      if (last_error == EEXIST)
        break;
      if (last_error != ENOENT)
        {
          ret = -1;
          break;
        }
      slash = new_path + strlen (new_path);
      while (slash > new_path && !IS_DIR_SEPARATOR(*slash))
        slash--;
      if (slash == new_path)
        {
          ret = -1;
          break;
        }
      len = slash - new_path;
      new_path[len] = 0;
      if (!mkdir_p (new_path, mode))
        {
          ret = -1;
          break;
        }
      new_path[len] = '/';
    }
    free (new_path);
    return ret;
}
开发者ID:GNsunghokim,项目名称:rtos,代码行数:52,代码来源:test_common.c


示例4: strip_path_and_suffix

static char *
strip_path_and_suffix (const char *full_name, const char *new_suffix)
{
  char *name;
  char *p;

  if (!full_name || !new_suffix)
    return NULL;

  /* Strip path name.  */
  p = (char *)full_name + strlen (full_name);
  while (p != full_name && !IS_DIR_SEPARATOR (p[-1]))
    --p;

  /* Now 'p' is a file name with suffix.  */
  name = (char *) malloc (strlen (p) + 1 + strlen (new_suffix));

  strcpy (name, p);

  p = name + strlen (name);
  while (p != name && *p != '.')
    --p;

  /* If did not reach at the beginning of name then '.' is found.
     Replace '.' with NULL.  */
  if (p != name)
    *p = '\0';

  strcat (name, new_suffix);
  return name;
}
开发者ID:IntegerCompany,项目名称:linaro-android-gcc,代码行数:31,代码来源:driverdriver.c


示例5: add_new_plugin

void
add_new_plugin (const char* plugin_name)
{
  struct plugin_name_args *plugin;
  void **slot;
  char *base_name;
  bool name_is_short;
  const char *pc;

  flag_plugin_added = true;

  /* Replace short names by their full path when relevant.  */
  name_is_short  = !IS_ABSOLUTE_PATH (plugin_name);
  for (pc = plugin_name; name_is_short && *pc; pc++)
    if (*pc == '.' || IS_DIR_SEPARATOR (*pc))
      name_is_short = false;

  if (name_is_short)
    {
      base_name = CONST_CAST (char*, plugin_name);
      /* FIXME: the ".so" suffix is currently builtin, since plugins
	 only work on ELF host systems like e.g. Linux or Solaris.
	 When plugins shall be available on non ELF systems such as
	 Windows or MacOS, this code has to be greatly improved.  */
      plugin_name = concat (default_plugin_dir_name (), "/",
			    plugin_name, ".so", NULL);
      if (access (plugin_name, R_OK))
	fatal_error
	  ("inacessible plugin file %s expanded from short plugin name %s: %m",
	   plugin_name, base_name);
    }
  else
开发者ID:AsherBond,项目名称:MondocosmOS-Dependencies,代码行数:32,代码来源:plugin.c


示例6: is_sysrooted_pathname

static bfd_boolean
is_sysrooted_pathname (const char *name, bfd_boolean notsame)
{
  char * realname = ld_canon_sysroot ? lrealpath (name) : NULL;
  int len;
  bfd_boolean result;

  if (! realname)
    return FALSE;

  len = strlen (realname);

  if (((! notsame && len == ld_canon_sysroot_len)
       || (len >= ld_canon_sysroot_len
	   && IS_DIR_SEPARATOR (realname[ld_canon_sysroot_len])
	   && (realname[ld_canon_sysroot_len] = '\0') == '\0'))
      && FILENAME_CMP (ld_canon_sysroot, realname) == 0)
    result = TRUE;
  else
    result = FALSE;

  if (realname)
    free (realname);

  return result;
}
开发者ID:Akheon23,项目名称:nvopencc,代码行数:26,代码来源:ldfile.c


示例7: child_path

const char *
child_path (const char *parent, const char *child)
{
  /* The child path must start with the parent path.  */
  size_t parent_len = strlen (parent);
  if (filename_ncmp (parent, child, parent_len) != 0)
    return NULL;

  /* The parent path must be a directory and the child must contain at
     least one component underneath the parent.  */
  const char *child_component;
  if (IS_DIR_SEPARATOR (parent[parent_len - 1]))
    {
      /* The parent path ends in a directory separator, so it is a
	 directory.  The first child component starts after the common
	 prefix.  */
      child_component = child + parent_len;
    }
  else
    {
      /* The parent path does not end in a directory separator.  The
	 first character in the child after the common prefix must be
	 a directory separator.

	 Note that CHILD must hold at least parent_len characters for
	 filename_ncmp to return zero.  If the character at parent_len
	 is nul due to CHILD containing the same path as PARENT, the
	 IS_DIR_SEPARATOR check will fail here.  */
      if (!IS_DIR_SEPARATOR (child[parent_len]))
	return NULL;

      /* The first child component starts after the separator after the
	 common prefix.  */
      child_component = child + parent_len + 1;
    }

  /* The child must contain at least one non-separator character after
     the parent.  */
  while (*child_component != '\0')
    {
      if (!IS_DIR_SEPARATOR (*child_component))
	return child_component;

      child_component++;
    }
  return NULL;
}
开发者ID:T-J-Teru,项目名称:binutils-gdb,代码行数:47,代码来源:pathstuff.c


示例8: IS_DIR_SEPARATOR

/* Define IS_DIR_SEPARATOR.  */
#ifndef DIR_SEPARATOR_2
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
#else /* DIR_SEPARATOR_2 */
# define IS_DIR_SEPARATOR(ch) \
	(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
#endif /* DIR_SEPARATOR_2 */
char *basename (const char *name) {
  const char *base;
  for (base = name; *name; name++) {
    if (IS_DIR_SEPARATOR (*name)) {
	    base = name + 1;
	  }
  }
  return (char *) base;
}
开发者ID:orez-,项目名称:imgserver,代码行数:16,代码来源:client.c


示例9: get_prog_name_len

static int
get_prog_name_len (const char *prog)
{
  int result = 0;
  const char *progend = prog + strlen(prog);
  const char *progname = progend;
  while (progname != prog && !IS_DIR_SEPARATOR (progname[-1]))
    --progname;
  return progend-progname;
}
开发者ID:IntegerCompany,项目名称:linaro-android-gcc,代码行数:10,代码来源:driverdriver.c


示例10: create_file_directory

static int
create_file_directory (char *filename)
{
#if !defined(TARGET_POSIX_IO) && !defined(_WIN32)
  (void) filename;
  return -1;
#else
  char *s;

  s = filename;

  if (HAS_DRIVE_SPEC(s))
    s += 2;
  if (IS_DIR_SEPARATOR(*s))
    ++s;
  for (; *s != '\0'; s++)
    if (IS_DIR_SEPARATOR(*s))
      {
        char sep = *s;
	*s  = '\0';

        /* Try to make directory if it doesn't already exist.  */
        if (access (filename, F_OK) == -1
#ifdef TARGET_POSIX_IO
            && mkdir (filename, 0755) == -1
#else
            && mkdir (filename) == -1
#endif
            /* The directory might have been made by another process.  */
	    && errno != EEXIST)
	  {
            fprintf (stderr, "profiling:%s:Cannot create directory\n",
		     filename);
            *s = sep;
	    return -1;
	  };

	*s = sep;
      };
  return 0;
#endif
}
开发者ID:rgmabs19357,项目名称:gcc,代码行数:42,代码来源:libgcov.c


示例11: contains_dir_separator

bool
contains_dir_separator (const char *path)
{
  for (; *path != '\0'; path++)
    {
      if (IS_DIR_SEPARATOR (*path))
	return true;
    }

  return false;
}
开发者ID:T-J-Teru,项目名称:binutils-gdb,代码行数:11,代码来源:pathstuff.c


示例12: split_dir_and_file

/****************************************************************************
 * split_dir_and_file:
 * Takes a string and fills one pre-allocated array with any path prior to
 * the file name, and fills another pre-allocated array with the file name
 * The path name will include a trailing directory separator
 * The path name will be the empty string if there was no path in the input
 */
void split_dir_and_file(const char *inString, char *dirName, char *fileName)
{
  int ii;

   /* Start at end of inString. */
  ii = strlen(inString) - 1;

  /* Work backwards until we hit a directory separator. */
  while ((ii>0) && !IS_DIR_SEPARATOR(inString[ii])) {
    ii--;
  }

  /* ii could be -1, if the input string was empty */
  if (ii < 0) ii = 0;

  if (IS_DIR_SEPARATOR(inString[ii])) {
    ii++;
  }

  strcpy(dirName, inString);
  dirName[ii] = '\0';

  strcpy(fileName, &inString[ii]);
}
开发者ID:glshort,项目名称:MapReady,代码行数:31,代码来源:fileUtil.c


示例13: filebasename

/**
 * returns a pointer on the basename part of name
 */
const char* filebasename(const char* name)
{
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
	/* Skip over the disk name in MSDOS pathnames. */
	if (isalpha(name[0]) && name[1] == ':') 
		name += 2;
#endif
	const char* base;
	for (base = name; *name; name++) {
		if (IS_DIR_SEPARATOR(*name)) {
			base = name + 1;
		}
    }
	return base;
}
开发者ID:onukore,项目名称:radium,代码行数:18,代码来源:enrobage.cpp


示例14: base_name

const char *
base_name (const char *name)
{
  const char *base;
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  /* Skip over the disk name in MSDOS pathnames. */
  if (isalpha ((unsigned char) name[0]) && name[1] == ':')
    name += 2;
#endif

  for (base = name; *name; name++)
    if (IS_DIR_SEPARATOR (*name))
      base = name + 1;
  return base;
}
开发者ID:GNsunghokim,项目名称:rtos,代码行数:15,代码来源:test_common.c


示例15: CreatePath

/*
============
CreatePath
============
*/
void CreatePath (char *path)
{
	char	*ofs, c;

	if (!path || !*path)
		return;

	ofs = path;
	if (HAS_DRIVE_SPEC(ofs))
		ofs = STRIP_DRIVE_SPEC(ofs);
	if (IS_DIR_SEPARATOR(*ofs))
		ofs++;

	for ( ; *ofs; ofs++)
	{
		c = *ofs;
		if (IS_DIR_SEPARATOR(c))
		{
			*ofs = 0;
			Q_mkdir (path);
			*ofs = c;
		}
	}
}
开发者ID:svn2github,项目名称:uhexen2,代码行数:29,代码来源:util_io.c


示例16: onclaim_file

/* Standard plugin API registerable hook.  */
static enum ld_plugin_status
onclaim_file (const struct ld_plugin_input_file *file, int *claimed)
{
  /* Let's see if we want to claim this file.  */
  claim_file_t *claimfile = claimfiles_list;
  size_t len = strlen (file->name);
  char *name = xstrdup (file->name);
  char *p = name + len;
  bfd_boolean islib;

  /* Only match the file name without the directory part.  */
  islib = *p == 'a' && *(p - 1) == '.';
  for (; p != name; p--)
    if (IS_DIR_SEPARATOR (*p))
      {
	p++;
	break;
      }

  while (claimfile)
    {
      /* Claim the file only if the file name and size match and don't
	 match the whole library.  */
      if (!strcmp (p, claimfile->file.name)
	  && claimfile->file.filesize == file->filesize
	  && (!islib || file->offset != 0))
	break;
      claimfile = claimfile->next;
    }

  free (name);

  /* If we decided to claim it, record that fact, and add any symbols
     that were defined for it by plugin options.  */
  *claimed = (claimfile != 0);
  if (claimfile)
    {
      claimfile->claimed = TRUE;
      claimfile->file = *file;
      if (claimfile->n_syms_used && !tv_add_symbols)
	return LDPS_ERR;
      else if (claimfile->n_syms_used)
	return (*tv_add_symbols) (claimfile->file.handle,
				claimfile->n_syms_used, claimfile->symbols);
    }

  return claim_file_ret;
}
开发者ID:MaxKellermann,项目名称:binutils-gdb,代码行数:49,代码来源:testplug2.c


示例17: __llvm_profile_recursive_mkdir

COMPILER_RT_VISIBILITY
void __llvm_profile_recursive_mkdir(char *path) {
  int i;

  for (i = 1; path[i] != '\0'; ++i) {
    char save = path[i];
    if (!IS_DIR_SEPARATOR(path[i]))
      continue;
    path[i] = '\0';
#ifdef _WIN32
    _mkdir(path);
#else
    mkdir(path, 0755); /* Some of these will fail, ignore it. */
#endif
    path[i] = save;
  }
}
开发者ID:Archer-sys,项目名称:compiler-rt,代码行数:17,代码来源:InstrProfilingUtil.c


示例18: gdb_abspath

gdb::unique_xmalloc_ptr<char>
gdb_abspath (const char *path)
{
  gdb_assert (path != NULL && path[0] != '\0');

  if (path[0] == '~')
    return gdb_tilde_expand_up (path);

  if (IS_ABSOLUTE_PATH (path))
    return gdb::unique_xmalloc_ptr<char> (xstrdup (path));

  /* Beware the // my son, the Emacs barfs, the botch that catch...  */
  return gdb::unique_xmalloc_ptr<char>
    (concat (current_directory,
	     IS_DIR_SEPARATOR (current_directory[strlen (current_directory) - 1])
	     ? "" : SLASH_STRING,
	     path, (char *) NULL));
}
开发者ID:T-J-Teru,项目名称:binutils-gdb,代码行数:18,代码来源:pathstuff.c


示例19: add_entry

static void
add_entry (struct entry **entp, const char *filename, int is_system)
{
  int len;
  struct entry *n;

  n = XNEW (struct entry);
  n->flags = is_system ? FLAG_SYSTEM : 0;
  n->next = NULL;

  len = strlen (filename);

  if (len > 4 && (FILENAME_CMP (filename + len - 4, ".zip") == 0
		  || FILENAME_CMP (filename + len - 4, ".jar") == 0))
    {
      n->flags |= FLAG_ZIP;
      /* If the user uses -classpath then he'll have to include
	 libgcj.jar in the value.  We check for this in a simplistic
	 way.  Symlinks will fool this test.  This is only used for
	 -MM and -MMD, so it probably isn't terribly important.  */
      if (! FILENAME_CMP (filename, LIBGCJ_ZIP_FILE))
	n->flags |= FLAG_SYSTEM;
    }

  /* Note that we add a trailing separator to `.zip' names as well.
     This is a little hack that lets the searching code in jcf-io.c
     work more easily.  Eww.  */
  if (! IS_DIR_SEPARATOR (filename[len - 1]))
    {
      char *f2 = (char *) alloca (len + 2);
      strcpy (f2, filename);
      f2[len] = DIR_SEPARATOR;
      f2[len + 1] = '\0';
      n->name = xstrdup (f2);
      ++len;
    }
  else
    n->name = xstrdup (filename);

  if (len > longest_path)
    longest_path = len;

  append_entry (entp, n);
}
开发者ID:AsherBond,项目名称:MondocosmOS-Dependencies,代码行数:44,代码来源:jcf-path.c


示例20: general_init

/* Initialization of the front end environment, before command line
   options are parsed.  Signal handlers, internationalization etc.
   ARGV0 is main's argv[0].  */
static void
general_init (const char *argv0)
{
    const char *p;

    p = argv0 + strlen (argv0);
    while (p != argv0 && !IS_DIR_SEPARATOR (p[-1]))
        --p;
    progname = p;

    xmalloc_set_program_name (progname);

    hex_init ();

    gcc_init_libintl ();

    line_table = XNEW (struct line_maps);
    linemap_init (line_table);
    line_table->reallocator = xrealloc;
}
开发者ID:Trewdbal,项目名称:cpctelera,代码行数:23,代码来源:sdcpp.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ IS_DMA_ALL_PERIPH函数代码示例发布时间:2022-05-30
下一篇:
C++ IS_DIGIT函数代码示例发布时间: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