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

C++ path_cat函数代码示例

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

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



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

示例1: print_rename

static int print_rename(const char *from, const char *to, void *user)
{
	struct recv_args *r = user;
	char *full_from = path_cat(r->full_subvol_path, from);
	char *full_to = path_cat(r->full_subvol_path, to);

	printf("rename\t%s\t%s\n", from, to);

	free(full_from);
	free(full_to);
	return 0;
}
开发者ID:AK47POMA,项目名称:btrfs-progs,代码行数:12,代码来源:send-test.c


示例2: process_utimes

static int process_utimes(const char *path, struct timespec *at,
			  struct timespec *mt, struct timespec *ct,
			  void *user)
{
	int ret = 0;
	struct btrfs_receive *r = user;
	char *full_path = path_cat(r->full_subvol_path, path);
	struct timespec tv[2];

	if (g_verbose >= 2)
		fprintf(stderr, "utimes %s\n", path);

	tv[0] = *at;
	tv[1] = *mt;
	ret = utimensat(AT_FDCWD, full_path, tv, AT_SYMLINK_NOFOLLOW);
	if (ret < 0) {
		ret = -errno;
		fprintf(stderr, "ERROR: utimes %s failed. %s\n",
				path, strerror(-ret));
		goto out;
	}

out:
	free(full_path);
	return ret;
}
开发者ID:chrestomanci,项目名称:btrfs-progs,代码行数:26,代码来源:cmds-receive.c


示例3: try_path

// Check whether the directory specified by catting the given base and path
// exists
// @return The resulting directory path, which should not be deleted and is
// valid indefinitely. NULL is directory cannot be found.
static const char* try_path(const char* base, const char* path,
  bool* out_found_notdir)
{
  char composite[FILENAME_MAX];
  char file[FILENAME_MAX];

  path_cat(base, path, composite);

  if(pony_realpath(composite, file) != file)
    return NULL;

  struct stat s;
  int err = stat(file, &s);

  if(err == -1)
    return NULL;

  if(!S_ISDIR(s.st_mode))
  {
    if(out_found_notdir != NULL)
      *out_found_notdir = true;

    return NULL;
  }

  return stringtab(file);
}
开发者ID:dipinhora,项目名称:ponyc,代码行数:31,代码来源:package.c


示例4: process_write

static int process_write(const char *path, const void *data, u64 offset,
			 u64 len, void *user)
{
	int ret = 0;
	struct btrfs_receive *r = user;
	char *full_path = path_cat(r->full_subvol_path, path);
	u64 pos = 0;
	int w;

	ret = open_inode_for_write(r, full_path);
	if (ret < 0)
		goto out;

	while (pos < len) {
		w = pwrite(r->write_fd, (char*)data + pos, len - pos,
				offset + pos);
		if (w < 0) {
			ret = -errno;
			fprintf(stderr, "ERROR: writing to %s failed. %s\n",
					path, strerror(-ret));
			goto out;
		}
		pos += w;
	}

out:
	free(full_path);
	return ret;
}
开发者ID:chrestomanci,项目名称:btrfs-progs,代码行数:29,代码来源:cmds-receive.c


示例5: process_set_xattr

static int process_set_xattr(const char *path, const char *name,
			     const void *data, int len, void *user)
{
	int ret = 0;
	struct btrfs_receive *r = user;
	char *full_path = path_cat(r->full_subvol_path, path);

	if (g_verbose >= 2) {
		fprintf(stderr, "set_xattr %s - name=%s data_len=%d "
				"data=%.*s\n", path, name, len,
				len, (char*)data);
	}

	ret = lsetxattr(full_path, name, data, len, 0);
	if (ret < 0) {
		ret = -errno;
		fprintf(stderr, "ERROR: lsetxattr %s %s=%.*s failed. %s\n",
				path, name, len, (char*)data, strerror(-ret));
		goto out;
	}

out:
	free(full_path);
	return ret;
}
开发者ID:chrestomanci,项目名称:btrfs-progs,代码行数:25,代码来源:cmds-receive.c


示例6: print_truncate

static int print_truncate(const char *path, u64 size, void *user)
{
	struct recv_args *r = user;
	char *full_path = path_cat(r->full_subvol_path, path);

	printf("truncate\t%llu\t%s\n", (unsigned long long)size, full_path);

	free(full_path);
	return 0;
}
开发者ID:AK47POMA,项目名称:btrfs-progs,代码行数:10,代码来源:send-test.c


示例7: print_link

static int print_link(const char *path, const char *lnk, void *user)
{
	struct recv_args *r = user;
	char *full_path = path_cat(r->full_subvol_path, path);

	printf("link\t%s\t%s\n", lnk, full_path);

	free(full_path);
	return 0;
}
开发者ID:AK47POMA,项目名称:btrfs-progs,代码行数:10,代码来源:send-test.c


示例8: print_chmod

static int print_chmod(const char *path, u64 mode, void *user)
{
	struct recv_args *r = user;
	char *full_path = path_cat(r->full_subvol_path, path);

	printf("chmod\t%llo\t%s\n", (unsigned long long)mode, full_path);

	free(full_path);
	return 0;
}
开发者ID:AK47POMA,项目名称:btrfs-progs,代码行数:10,代码来源:send-test.c


示例9: path_parse

/**
 * Gets absolute path by relative path
 *  @param relative Relative or absolute path
 *  @return Absolute path (Can be passed to free())
 */
static char *getabsolutepath(const char *relative) {
  path_t *path = path_parse(relative);
  if (!path->root) {
    path_t *newpath = path_cat(workdir.path,path);
    path_destroy(path);
    path = newpath;
  }
  path_reject_dots(path);
  return path_output(path,NULL);
}
开发者ID:jgraef,项目名称:meinOS,代码行数:15,代码来源:files.c


示例10: print_remove_xattr

static int print_remove_xattr(const char *path, const char *name, void *user)
{
	struct recv_args *r = user;
	char *full_path = path_cat(r->full_subvol_path, path);

	printf("remove_xattr\t%s\t%s\n", full_path, name);

	free(full_path);
	return 0;
}
开发者ID:AK47POMA,项目名称:btrfs-progs,代码行数:10,代码来源:send-test.c


示例11: print_rmdir

static int print_rmdir(const char *path, void *user)
{
	struct recv_args *r = user;
	char *full_path = path_cat(r->full_subvol_path, path);

	printf("rmdir\t%s\n", full_path);

	free(full_path);
	return 0;
}
开发者ID:AK47POMA,项目名称:btrfs-progs,代码行数:10,代码来源:send-test.c


示例12: print_update_extent

static int print_update_extent(const char *path, u64 offset, u64 len,
			       void *user)
{
	struct recv_args *r = user;
	char *full_path = path_cat(r->full_subvol_path, path);

	printf("update_extent\t%s\t%llu\t%llu\n", full_path, offset, len);

	free(full_path);
	return 0;
}
开发者ID:AK47POMA,项目名称:btrfs-progs,代码行数:11,代码来源:send-test.c


示例13: print_chown

static int print_chown(const char *path, u64 uid, u64 gid, void *user)
{
	struct recv_args *r = user;
	char *full_path = path_cat(r->full_subvol_path, path);

	printf("chown\t%llu\t%llu\t%s\n", (unsigned long long)uid,
	       (unsigned long long)gid, full_path);

	free(full_path);
	return 0;
}
开发者ID:AK47POMA,项目名称:btrfs-progs,代码行数:11,代码来源:send-test.c


示例14: try_path

// Check whether the directory specified by catting the given base and path
// exists
// @return The resulting directory path, which should not be deleted and is
// valid indefinitely. NULL is directory cannot be found.
static const char* try_path(const char* base, const char* path)
{
  char composite[FILENAME_MAX];
  char file[FILENAME_MAX];

  path_cat(base, path, composite);

  if(pony_realpath(composite, file) != file)
    return NULL;

  return stringtab(file);
}
开发者ID:lzpfmh,项目名称:ponyc,代码行数:16,代码来源:package.c


示例15: process_link

static int process_link(const char *path, const char *lnk, void *user)
{
	int ret;
	struct btrfs_receive *r = user;
	char *full_path = path_cat(r->full_subvol_path, path);
	char *full_link_path = path_cat(r->full_subvol_path, lnk);

	if (g_verbose >= 2)
		fprintf(stderr, "link %s -> %s\n", path, lnk);

	ret = link(full_link_path, full_path);
	if (ret < 0) {
		ret = -errno;
		fprintf(stderr, "ERROR: link %s -> %s failed. %s\n", path,
				lnk, strerror(-ret));
	}

	free(full_path);
	free(full_link_path);
	return ret;
}
开发者ID:chrestomanci,项目名称:btrfs-progs,代码行数:21,代码来源:cmds-receive.c


示例16: print_set_xattr

static int print_set_xattr(const char *path, const char *name,
			   const void *data, int len, void *user)
{
	struct recv_args *r = user;
	char *full_path = path_cat(r->full_subvol_path, path);

	printf("set_xattr\t%s\t%s\t%d\n", full_path,
	       name, len);

	free(full_path);
	return 0;
}
开发者ID:AK47POMA,项目名称:btrfs-progs,代码行数:12,代码来源:send-test.c


示例17: print_write

static int print_write(const char *path, const void *data, u64 offset,
		       u64 len, void *user)
{
	struct recv_args *r = user;
	char *full_path = path_cat(r->full_subvol_path, path);

	printf("write\t%llu\t%llu\t%s\n", (unsigned long long)offset,
	       (unsigned long long)len, full_path);

	free(full_path);
	return 0;
}
开发者ID:AK47POMA,项目名称:btrfs-progs,代码行数:12,代码来源:send-test.c


示例18: process_rename

static int process_rename(const char *from, const char *to, void *user)
{
	int ret;
	struct btrfs_receive *r = user;
	char *full_from = path_cat(r->full_subvol_path, from);
	char *full_to = path_cat(r->full_subvol_path, to);

	if (g_verbose >= 2)
		fprintf(stderr, "rename %s -> %s\n", from, to);

	ret = rename(full_from, full_to);
	if (ret < 0) {
		ret = -errno;
		fprintf(stderr, "ERROR: rename %s -> %s failed. %s\n", from,
				to, strerror(-ret));
	}

	free(full_from);
	free(full_to);
	return ret;
}
开发者ID:chrestomanci,项目名称:btrfs-progs,代码行数:21,代码来源:cmds-receive.c


示例19: print_utimes

static int print_utimes(const char *path, struct timespec *at,
			struct timespec *mt, struct timespec *ct,
			void *user)
{
	struct recv_args *r = user;
	char *full_path = path_cat(r->full_subvol_path, path);

	printf("utimes\t%s\n", full_path);

	free(full_path);
	return 0;
}
开发者ID:AK47POMA,项目名称:btrfs-progs,代码行数:12,代码来源:send-test.c


示例20: print_clone

static int print_clone(const char *path, u64 offset, u64 len,
		       const u8 *clone_uuid, u64 clone_ctransid,
		       const char *clone_path, u64 clone_offset,
		       void *user)
{
	struct recv_args *r = user;
	char *full_path = path_cat(r->full_subvol_path, path);

	printf("clone\t%s\t%s\n", full_path, clone_path);

	free(full_path);
	return 0;
}
开发者ID:AK47POMA,项目名称:btrfs-progs,代码行数:13,代码来源:send-test.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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