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

C++ prepend_s函数代码示例

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

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



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

示例1: do_lock_dirs

static int do_lock_dirs(struct sdirs *sdirs, struct conf *conf)
{
	int ret=-1;
	char *lockbase=NULL;
	char *lockfile=NULL;
	if(conf->client_lockdir)
	{
		if(!(sdirs->lockdir=strdup_w(conf->client_lockdir, __func__))
		  || !(lockbase=prepend_s(sdirs->lockdir, conf->cname)))
			goto end;
	}
	else
	{
		if(!(sdirs->lockdir=strdup_w(sdirs->client, __func__))
		  || !(lockbase=strdup_w(sdirs->client, __func__)))
			goto end;
	}
	if(!(lockfile=prepend_s(lockbase, "lockfile"))
	  || !(sdirs->lock=lock_alloc_and_init(lockfile)))
		goto end;
	ret=0;
end:
	free_w(&lockbase);
	free_w(&lockfile);
	return ret;
}
开发者ID:Sherlock221B,项目名称:burp,代码行数:26,代码来源:sdirs.c


示例2: get_string

static char *get_restorepath(struct conf **cconfs)
{
	char *tmp=NULL;
	char *restorepath=NULL;
	if((tmp=prepend_s(get_string(cconfs[OPT_DIRECTORY]),
		get_string(cconfs[OPT_CNAME]))))
			restorepath=prepend_s(tmp, "restore");
	free_w(&tmp);
	return restorepath;
}
开发者ID:vanElden,项目名称:burp,代码行数:10,代码来源:extra_comms.c


示例3: init_dpthl

int init_dpthl(struct dpthl *dpthl, struct asfd *asfd,
	struct sdirs *sdirs, struct conf *cconf)
{
	char *tmp=NULL;
	//logp("in init_dpthl\n");
	dpthl->looped=0;
	dpthl->prim=0;
	dpthl->seco=0;
	dpthl->tert=0;

	if((dpthl->prim=get_highest_entry(sdirs->currentdata))<0)
	{
		// Could not open directory. Set all zeros.
		dpthl->prim=0;
//		mk_dpthl(dpthl, cconf);
		return 0;
	}
	mk_dpthl_prim(dpthl);
	if(!(tmp=prepend_s(sdirs->currentdata, dpthl->path)))
	{
		log_and_send_oom(asfd, __func__);
		return -1;
	}
	if((dpthl->seco=get_highest_entry(tmp))<0)
	{
		// Could not open directory. Set zero.
		dpthl->seco=0;
//		mk_dpthl(dpthl, cconf);
		free(tmp);
		return 0;
	}
	free(tmp);
	mk_dpthl_seco(dpthl);
	if(!(tmp=prepend_s(sdirs->currentdata, dpthl->path)))
	{
		log_and_send_oom(asfd, __func__);
		return -1;
	}
	if((dpthl->tert=get_highest_entry(tmp))<0)
	{
		// Could not open directory. Set zero.
		dpthl->tert=0;
//		mk_dpthl(dpthl, cconf);
		free(tmp);
		return 0;
	}
	// At this point, we have the latest data file. Increment to get the
	// next free one.
	if(incr_dpthl(dpthl, cconf)) return -1;

	//logp("init_dpthl: %d/%d/%d\n", dpthl->prim, dpthl->seco, dpthl->tert);
	//logp("init_dpthl: %s\n", dpthl->path);
	return 0;
}
开发者ID:jkniiv,项目名称:burp,代码行数:54,代码来源:dpth.c


示例4: deleteme_move

int deleteme_move(struct sdirs *sdirs, const char *fullpath, const char *path,
	struct conf **cconfs)
{
	int ret=-1;
	char *tmp=NULL;
	char *dest=NULL;
	int attempts=0;
	struct stat statp;
	char suffix[16]="";
	char *timestamp=NULL;

	if(lstat(fullpath, &statp) && errno==ENOENT)
	{
		// The path to move aside does not exist.
		// Treat this as OK.
		ret=0;
		goto end;
	}

	if(!(tmp=prepend_s(sdirs->deleteme, path))
	  || mkpath(&tmp, sdirs->deleteme)
	  || !(dest=prepend("", tmp)))
		goto end;

	// Try to generate destination paths if the desired one is already
	// taken.
	while(1)
	{
		if(lstat(dest, &statp)) break;
		snprintf(suffix, sizeof(suffix), ".%d", ++attempts);
		free_w(&dest);
		if(!(dest=prepend(tmp, suffix)))
			goto end;
		if(attempts>=100) break; // Give up.
	}

	// Paranoia - really do not want the deleteme directory to be loaded
	// as if it were a normal storage directory, so remove the timestamp.
	if(!(timestamp=prepend_s(fullpath, "timestamp")))
		goto end;
	unlink(timestamp);

	// Possible race condition is of no consequence, as the destination
	// will need to be deleted at some point anyway.
	ret=do_rename(fullpath, dest);

end:
	free_w(&dest);
	free_w(&tmp);
	free_w(&timestamp);
	return ret;
}
开发者ID:pkdevbox,项目名称:burp,代码行数:52,代码来源:deleteme.c


示例5: compress_filename

int compress_filename(const char *d, const char *file, const char *zfile, struct config *cconf)
{
	char *fullfile=NULL;
	char *fullzfile=NULL;
	if(!(fullfile=prepend_s(d, file, strlen(file)))
	  || !(fullzfile=prepend_s(d, zfile, strlen(zfile)))
	  || compress_file(fullfile, fullzfile, cconf))
	{
		if(fullfile) free(fullfile);
		if(fullzfile) free(fullzfile);
		return -1;
	}
	return 0;
}
开发者ID:barroque,项目名称:burp,代码行数:14,代码来源:current_backups_server.c


示例6: finish_delta

static int finish_delta(struct sdirs *sdirs, struct sbuf *rb)
{
	int ret=0;
	char *deltmp=NULL;
	char *delpath=NULL;
	if(!(deltmp=prepend_s("deltas.forward", rb->burp1->datapth.buf))
	  || !(delpath=prepend_s(sdirs->working, deltmp))
	  || mkpath(&delpath, sdirs->working)
	  || do_rename(sdirs->deltmppath, delpath))
		ret=-1;
	if(delpath) free(delpath);
	if(deltmp) free(deltmp);
	return ret;
}
开发者ID:jkniiv,项目名称:burp,代码行数:14,代码来源:backup_phase2.c


示例7: add_hlnk

static void add_hlnk(int find, const char *path, const char *link)
{
	char *src;
	char *dst;
	fail_unless((src=prepend_s(fullpath, path))!=NULL);
	fail_unless((dst=prepend_s(fullpath, link))!=NULL);
	fail_unless(!do_link(dst, src, NULL, NULL, 0));
	if(find==FOUND)
	{
		fail_unless(!strlist_add(&expected, src, (long)FT_LNK_H));
		fail_unless(!strlist_add(&expected, dst, 0));
	}
	free_w(&src);
	free_w(&dst);
}
开发者ID:vanElden,项目名称:burp,代码行数:15,代码来源:test_find.c


示例8: finish_delta

static int finish_delta(struct sbuf *rb, const char *working, const char *deltmppath)
{
	int ret=0;
	char *deltmp=NULL;
	char *delpath=NULL;
	if(!(deltmp=prepend_s("deltas.forward",
		rb->datapth, strlen(rb->datapth)))
	  || !(delpath=prepend_s(working, deltmp, strlen(deltmp)))
	  || mkpath(&delpath, working)
	  || do_rename(deltmppath, delpath))
		ret=-1;
	if(delpath) free(delpath);
	if(deltmp) free(deltmp);
	return ret;
}
开发者ID:bassu,项目名称:burp,代码行数:15,代码来源:backup_phase2_server.c


示例9: compress_filename

int compress_filename(const char *d,
	const char *file, const char *zfile, int compression)
{
	char *fullfile=NULL;
	char *fullzfile=NULL;
	if(!(fullfile=prepend_s(d, file))
	  || !(fullzfile=prepend_s(d, zfile))
	  || compress_file(fullfile, fullzfile, compression))
	{
		free_w(&fullfile);
		free_w(&fullzfile);
		return -1;
	}
	return 0;
}
开发者ID:ZungBang,项目名称:burp,代码行数:15,代码来源:compress.c


示例10: browse_manifest_start

static int browse_manifest_start(struct asfd *srfd, struct cstat *cstat,
	struct bu *bu, const char *browse, struct conf **confs)
{
	int ret=-1;
	char *manifest=NULL;
	struct sbuf *sb=NULL;
	struct manio *manio=NULL;

	if(!(manifest=prepend_s(bu->path,
		cstat->protocol==PROTO_1?"manifest.gz":"manifest"))
	  || !(manio=manio_alloc())
	  || manio_init_read(manio, manifest)
	  || !(sb=sbuf_alloc_protocol(cstat->protocol)))
		goto end;
	manio_set_protocol(manio, cstat->protocol);
	if(get_int(confs[OPT_MONITOR_BROWSE_CACHE]))
		ret=cache_load(srfd, manio, sb, cstat, bu);
	else
		ret=do_browse_manifest(srfd, manio, sb, browse);
end:
	free_w(&manifest);
	manio_free(&manio);
	sbuf_free(&sb);
	return ret;
}
开发者ID:Shloub,项目名称:burp,代码行数:25,代码来源:browse.c


示例11: snprintf

static char *get_next_fpath(struct manio *manio)
{
	static char tmp[32];
	if(manio->protocol==PROTO_1) return get_next_fpath_protocol1(manio);
	snprintf(tmp, sizeof(tmp), "%08"PRIX64, manio->offset.fcount++);
	return prepend_s(manio->directory, tmp);
}
开发者ID:adrianimboden,项目名称:burp,代码行数:7,代码来源:manio.c


示例12:

static char *set_new_datapth(struct sbuf *sb, const char *datadirtmp, struct dpth *dpth, int *istreedata, struct config *cconf)
{
	char *rpath=NULL;
	if(cconf->directory_tree) *istreedata=treedata(sb);

	if(*istreedata)
	{
		// We want to place this file in a directory structure like
		// the directory structure on the original client.
		if(!(sb->datapth=prepend_s("t", sb->path, strlen(sb->path))))
		{
			log_and_send_oom(__FUNCTION__);
			return NULL;
		}
	}
	else
	{
		mk_dpth(dpth, cconf, sb->cmd);
		if(!(sb->datapth=strdup(dpth->path))) // file data path
		{
			log_and_send_oom(__FUNCTION__);
			return NULL;
		}
	}
	if(build_path(datadirtmp, sb->datapth, strlen(sb->datapth),
		&rpath, datadirtmp))
	{
		log_and_send("build path failed");
		return NULL;
	}
	return rpath;
}
开发者ID:bassu,项目名称:burp,代码行数:32,代码来源:backup_phase2_server.c


示例13: snprintf

static char *get_next_fpath(struct manio *manio)
{
	static char tmp[32];
	if(manio->protocol==PROTO_BURP1) return get_next_fpath_burp1(manio);
	snprintf(tmp, sizeof(tmp), "%08lX", manio->fcount++);
	return prepend_s(manio->directory, tmp);
}
开发者ID:jkniiv,项目名称:burp,代码行数:7,代码来源:manio.c


示例14:

static char *set_new_datapth(struct asfd *asfd,
	struct sdirs *sdirs, struct conf **cconfs,
	struct sbuf *sb, struct dpth *dpth, int *istreedata)
{
	char *tmp=NULL;
	char *rpath=NULL;
	if(get_int(cconfs[OPT_DIRECTORY_TREE]))
		*istreedata=treedata(sb, cconfs);

	if(*istreedata)
	{
		// We want to place this file in a directory structure like
		// the directory structure on the original client.
		if(!(tmp=prepend_s(TREE_DIR, sb->path.buf)))
		{
			log_and_send_oom(asfd, __func__);
			return NULL;
		}
	}
	else
	{
		if(!(tmp=strdup_w(dpth_protocol1_mk(dpth,
			get_int(cconfs[OPT_COMPRESSION]),
			sb->path.cmd), __func__))) return NULL;
	}
	iobuf_from_str(&sb->protocol1->datapth, CMD_DATAPTH, tmp);
	if(build_path(sdirs->datadirtmp,
		sb->protocol1->datapth.buf, &rpath, sdirs->datadirtmp))
	{
		log_and_send(asfd, "build path failed");
		return NULL;
	}
	return rpath;
}
开发者ID:adrianimboden,项目名称:burp,代码行数:34,代码来源:backup_phase2.c


示例15: incexc_matches

static int incexc_matches(const char *fullrealwork, const char *incexc)
{
	int ret=0;
	int got=0;
	struct fzp *fzp=NULL;
	char buf[4096]="";
	const char *inc=NULL;
	char *old_incexc_path=NULL;
	if(!(old_incexc_path=prepend_s(fullrealwork, "incexc")))
		return -1;
	if(!(fzp=fzp_open(old_incexc_path, "rb")))
	{
		// Assume that no incexc file could be found because the client
		// was on an old version. Assume resume is OK and return 1.
		ret=1;
		goto end;
	}
	inc=incexc;
	while((got=fzp_read(fzp, buf, sizeof(buf)))>0)
	{
		if(strlen(inc)<(size_t)got) break;
		if(strncmp(buf, inc, got)) break;
		inc+=got;
	}
	if(inc && strlen(inc)) ret=0;
	else ret=1;
end:
	fzp_close(&fzp);
	free_w(&old_incexc_path);
	return ret;
}
开发者ID:rubenk,项目名称:burp,代码行数:31,代码来源:rubble.c


示例16: finish_delta

static int finish_delta(struct sdirs *sdirs, struct sbuf *rb)
{
	int ret=0;
	char *deltmp=NULL;
	char *delpath=NULL;
	if(!(deltmp=prepend_s("deltas.forward", rb->protocol1->datapth.buf))
	  || !(delpath=prepend_s(sdirs->working, deltmp))
	  || mkpath(&delpath, sdirs->working)
	// Rename race condition is of no consequence here, as delpath will
	// just get recreated.
	  || do_rename(sdirs->deltmppath, delpath))
		ret=-1;
	if(delpath) free(delpath);
	if(deltmp) free(deltmp);
	return ret;
}
开发者ID:adrianimboden,项目名称:burp,代码行数:16,代码来源:backup_phase2.c


示例17: snprintf

static struct fzp *open_backup_log(struct bu *bu, const char *logfile)
{
	char *path=NULL;
	struct fzp *fzp=NULL;

	char logfilereal[32]="";
	if(!strcmp(logfile, "backup"))
		snprintf(logfilereal, sizeof(logfilereal), "log");
	else if(!strcmp(logfile, "restore"))
		snprintf(logfilereal, sizeof(logfilereal), "restorelog");
	else if(!strcmp(logfile, "verify"))
		snprintf(logfilereal, sizeof(logfilereal), "verifylog");
	else if(!strcmp(logfile, "backup_stats"))
		snprintf(logfilereal, sizeof(logfilereal), "backup_stats");
	else if(!strcmp(logfile, "restore_stats"))
		snprintf(logfilereal, sizeof(logfilereal), "restore_stats");
	else if(!strcmp(logfile, "verify_stats"))
		snprintf(logfilereal, sizeof(logfilereal), "verify_stats");

	if(!(path=prepend_s(bu->path, logfilereal)))
		goto end;
	if(!(fzp=fzp_gzopen(path, "rb")))
	{
		if(astrcat(&path, ".gz", __func__)
		  || !(fzp=fzp_gzopen(path, "rb")))
			goto end;
	}
end:
	free_w(&path);
	return fzp;

}
开发者ID:rubenk,项目名称:burp,代码行数:32,代码来源:json_output.c


示例18: check_for_rubble_burp2

int check_for_rubble_burp2(struct asfd *asfd, struct sdirs *sdirs,
	const char *incexc, int *resume, struct conf *cconf)
{
	// FIX THIS - currently just deletes the interrupted backup.
	ssize_t len=0;
	char *real=NULL;
	char lnk[32]="";
	if((len=readlink(sdirs->working, lnk, sizeof(lnk)-1))<0)
		return 0;
	else if(!len)
	{
		unlink(sdirs->working);
		return 0;
	}
	lnk[len]='\0';
	if(!(real=prepend_s(sdirs->client, lnk)))
	{
		log_and_send_oom(asfd, __func__);
		return -1;
	}
	if(recursive_delete(real, "", 1))
	{
		char msg[256]="";
		snprintf(msg, sizeof(msg),
			"Could not remove interrupted directory: %s", real);
		log_and_send(asfd, msg);
		return -1;
	}
	unlink(sdirs->working);
	return 0;
}
开发者ID:Sherlock221B,项目名称:burp,代码行数:31,代码来源:rubble.c


示例19: bu_init

int bu_init(struct bu *bu, char *fullpath, char *basename,
            char *timestampstr, uint16_t flags)
{
    if(!(bu->data=prepend_s(fullpath, "data"))
            || !(bu->delta=prepend_s(fullpath, "deltas.reverse")))
        goto error;
    bu->path=fullpath;
    bu->basename=basename;
    bu->timestamp=timestampstr;
    bu->flags=flags;
    bu->bno=strtoul(timestampstr, NULL, 10);
    return 0;
error:
    free_w(&bu->data);
    free_w(&bu->delta);
    return -1;
}
开发者ID:patvdv,项目名称:burp,代码行数:17,代码来源:bu.c


示例20: cstat_init

int cstat_init(struct cstat *cstat,
	const char *name, const char *clientconfdir)
{
	if((clientconfdir && !(cstat->conffile=prepend_s(clientconfdir, name)))
	  || !(cstat->name=strdup_w(name, __func__)))
		return -1;
	return 0;
}
开发者ID:rubenk,项目名称:burp,代码行数:8,代码来源:cstat.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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