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

C++ recursive_delete函数代码示例

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

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



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

示例1: do_test_cstat_set_backup_list

static void do_test_cstat_set_backup_list(enum protocol protocol)
{
	struct cstat *cstat;
	cstat=setup_cstat(CNAME, protocol);
	ck_assert_str_eq(CLIENTCONFDIR "/" CNAME, cstat->conffile);

	cstat->permitted=1;

	fail_unless(recursive_delete(BASE)==0);
	build_storage_dirs((struct sdirs *)cstat->sdirs,
		sd123, ARR_LEN(sd123));
	fail_unless(!cstat_set_backup_list(cstat));
	fail_unless(cstat->bu!=NULL);

	fail_unless(recursive_delete(BASE)==0);
	build_storage_dirs((struct sdirs *)cstat->sdirs,
		sd13, ARR_LEN(sd13));
	fail_unless(!cstat_set_backup_list(cstat));
	fail_unless(cstat->bu!=NULL);

	fail_unless(recursive_delete(BASE)==0);
	build_storage_dirs((struct sdirs *)cstat->sdirs,
		sd12345, ARR_LEN(sd12345));
	fail_unless(!cstat_set_backup_list(cstat));
	fail_unless(cstat->bu!=NULL);

	cstat->permitted=0;
	fail_unless(!cstat_set_backup_list(cstat));
	fail_unless(cstat->bu==NULL);

	tear_down(&cstat);
}
开发者ID:rubenk,项目名称:burp,代码行数:32,代码来源:test_cstat.c


示例2: START_TEST

END_TEST

START_TEST(cleanup)
{
    // Not a test. Just wanted to cleanup before and after this suite.
    fail_unless(!recursive_delete(BASE));
    fail_unless(!recursive_delete(SDIRS));
    fail_unless(!recursive_delete(CONF_BASE));
}
开发者ID:ZungBang,项目名称:burp,代码行数:9,代码来源:test_json_output.c


示例3: run_find

static void run_find(const char *buf, FF_PKT *ff, struct conf **confs)
{
	struct strlist *l;
	const char *conffile=CONFBASE "/burp.conf";
	fail_unless(!recursive_delete(CONFBASE));
	build_file(conffile, buf);
	fail_unless(!conf_load_global_only(conffile, confs));
	for(l=get_strlist(confs[OPT_STARTDIR]); l; l=l->next) if(l->flag)
                fail_unless(!find_files_begin(NULL, ff, confs, l->path));
	fail_unless(!recursive_delete(CONFBASE));
}
开发者ID:vanElden,项目名称:burp,代码行数:11,代码来源:test_find.c


示例4: 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


示例5: fail_unless

static FF_PKT *setup(struct conf ***confs)
{
	FF_PKT *ff;
	fail_unless(!recursive_delete(BASE));

	// Create the root directory, so that we can figure out the absolute
	// path to it, then delete it so that the root directory can be
	// included when setting up the expected file system.
	fail_unless(!mkdir(BASE, 0777));
	fail_unless(realpath(BASE, fullpath)!=NULL);
	fail_unless(!recursive_delete(BASE));

	fail_unless((ff=find_files_init(send_file_callback))!=NULL);
	*confs=setup_conf();
	return ff;
}
开发者ID:vanElden,项目名称:burp,代码行数:16,代码来源:test_find.c


示例6: test_manifest_tell_seek

END_TEST

static void test_manifest_tell_seek(enum protocol protocol, int phase)
{
	struct slist *slist;
	struct manio *manio;
	struct sbuf *sb=NULL;
	man_off_t *offset=NULL;
	int entries=1000;
	prng_init(0);
	base64_init();
	hexmap_init();
	recursive_delete(path);

	slist=build_manifest(path, protocol, entries, phase);
	fail_unless(slist!=NULL);

	sb=slist->head;
	fail_unless((manio=do_manio_open(path, "rb", protocol, phase))!=NULL);
	read_manifest(&sb, manio, 0, entries/2, protocol, phase);
	fail_unless((offset=manio_tell(manio))!=NULL);
	fail_unless(sb!=NULL);
	fail_unless(!manio_close(&manio));

	fail_unless((manio=do_manio_open(path, "rb", protocol, phase))!=NULL);
	fail_unless(!manio_seek(manio, offset));
	read_manifest(&sb, manio, entries/2, entries, protocol, phase);
	fail_unless(sb==NULL);
	fail_unless(!manio_close(&manio));
	fail_unless(!manio);

	slist_free(&slist);
	man_off_t_free(&offset);
	tear_down();
}
开发者ID:ZungBang,项目名称:burp,代码行数:35,代码来源:test_manio.c


示例7: remove_files_from_dir

static int remove_files_from_dir(const char *path) {
  DIR *dir;
  struct dirent *entry;
  dir = opendir(path);
  if (dir) {
    int exit_code = 0;
    while ((entry = readdir(dir)) != NULL) {
      if(strcmp(entry->d_name, ".") == 0
         || strcmp(entry->d_name, "..") == 0) {
          continue;
      }
      char *newpath;
      int bytesPrinted = asprintf(&newpath, "%s/%s", path, entry->d_name);
      if (bytesPrinted == -1) {
        //asprintf failed, stop the process
        exit(EXIT_FAILURE);
      }
      if(newpath) {
        // Recur on anything in the directory.
        int new_exit = recursive_delete(newpath, 0);
        if(!exit_code) {
          exit_code = new_exit;
        }
      }
      free(newpath);
    }
    closedir(dir);
    return exit_code;
  }
  return -1;
}
开发者ID:rajkrrsingh,项目名称:storm,代码行数:31,代码来源:worker-launcher.c


示例8: deleteme_maybe_delete

int deleteme_maybe_delete(struct conf **cconfs, struct sdirs *sdirs)
{
	// If manual_delete is on, they will have to delete the files
	// manually, via a cron job or something.
	if(get_string(cconfs[OPT_MANUAL_DELETE])) return 0;
	return recursive_delete(sdirs->deleteme);
}
开发者ID:pkdevbox,项目名称:burp,代码行数:7,代码来源:deleteme.c


示例9: tear_down

static void tear_down(struct asfd **asfd)
{
    asfd_free(asfd);
    fail_unless(!fzp_close(&output));
    fail_unless(!recursive_delete(CLIENTCONFDIR));
    alloc_check();
}
开发者ID:ZungBang,项目名称:burp,代码行数:7,代码来源:test_json_output.c


示例10: tear_down

static void tear_down(struct asfd **asfd, struct sdirs **sdirs)
{
	asfd_free(asfd);
	asfd_mock_teardown(&reads, &writes);
	sdirs_free(sdirs);
	fail_unless(recursive_delete(BASE)==0);
	alloc_check();
}
开发者ID:EmisFR,项目名称:burp,代码行数:8,代码来源:test_list.c


示例11: setup

static void setup(
	struct sdirs **sdirs, struct fdirs **fdirs, struct conf ***confs)
{
	if(sdirs) *sdirs=setup_sdirs();
	if(fdirs) *fdirs=setup_fdirs(*sdirs);
	if(confs) *confs=setup_conf();
	fail_unless(!recursive_delete(BASE));
}
开发者ID:ZungBang,项目名称:burp,代码行数:8,代码来源:test_backup_phase4.c


示例12: setup

static void setup(struct async **as,
	struct sdirs **sdirs, struct conf ***confs)
{
	if(as) *as=setup_async();
	if(sdirs) *sdirs=setup_sdirs();
	if(confs) *confs=setup_conf();
	fail_unless(!recursive_delete(BASE));
}
开发者ID:grealish,项目名称:burp,代码行数:8,代码来源:test_backup_phase2.c


示例13: hexmap_init

static struct dpth *setup(void)
{
	struct dpth *dpth;
	hexmap_init();
	fail_unless(recursive_delete(lockpath, "", 1)==0);
	fail_unless((dpth=dpth_alloc())!=NULL);
	assert_components(dpth, 0, 0, 0, 0);
	return dpth;
}
开发者ID:adrianimboden,项目名称:burp,代码行数:9,代码来源:test_dpth.c


示例14: recursive_delete_w

static int recursive_delete_w(struct sdirs *sdirs, struct bu *bu)
{
	if(recursive_delete(sdirs->deleteme, NULL, 1))
	{
		logp("Error when trying to delete %s\n", bu->path);
		return -1;
	}
	return 0;
}
开发者ID:Sherlock221B,项目名称:burp,代码行数:9,代码来源:delete.c


示例15: tear_down

static void tear_down(FF_PKT **ff, struct conf ***confs)
{
	fail_unless(e==NULL);
	find_files_free(ff);
	confs_free(confs);
	strlists_free(&expected);
	fail_unless(recursive_delete(BASE)==0);
	alloc_check();
}
开发者ID:vanElden,项目名称:burp,代码行数:9,代码来源:test_find.c


示例16: deleteme_maybe_delete

int deleteme_maybe_delete(struct conf **cconfs, const char *basedir)
{
	char *deleteme;
	// If manual_delete is on, they will have to delete the files
	// manually, via a cron job or something.
	if(get_string(cconfs[OPT_MANUAL_DELETE])) return 0;
	if(!(deleteme=deleteme_get_path(basedir, cconfs))) return -1;
	return recursive_delete(deleteme, NULL, 1 /* delete all */);
}
开发者ID:Shloub,项目名称:burp,代码行数:9,代码来源:deleteme.c


示例17: tear_down

static void tear_down(
	struct sdirs **sdirs, struct fdirs **fdirs, struct conf ***confs)
{
	sdirs_free(sdirs);
	fdirs_free(fdirs);
	confs_free(confs);
	fail_unless(!recursive_delete(BASE));
	alloc_check();
}
开发者ID:ZungBang,项目名称:burp,代码行数:9,代码来源:test_backup_phase4.c


示例18: tear_down

static void tear_down(struct asfd **asfd, struct conf ***confs)
{
	asfd_free(asfd);
	confs_free(confs);
	asfd_mock_teardown(&reads, &writes);
//printf("%d %d\n", alloc_count, free_count);
	alloc_check();
	fail_unless(recursive_delete(BASE)==0);
}
开发者ID:ZungBang,项目名称:burp,代码行数:9,代码来源:test_restore.c


示例19: recursive_delete

static void recursive_delete(LinkList* list, GTreeNode* node)
{
    if( (list != NULL) && (node != NULL) )
    {
        GTreeNode* parent = node->parent;
        int index = -1;
        int i = 0;
        
        for(i=0; i<LinkList_Length(list); i++)
        {
            TLNode* trNode = (TLNode*)LinkList_Get(list, i);
             
            if( trNode->node == node )
            {
                LinkList_Delete(list, i);
                
                free(trNode);
                
                index = i;
                
                break;
            }
        }
          
        if( index >= 0 )
        {  
            if( parent != NULL )
            {
                 for(i=0; i<LinkList_Length(parent->child); i++)
                 {
                     TLNode* trNode = (TLNode*)LinkList_Get(parent->child, i);
                     
                     if( trNode->node == node )
                     {
                         LinkList_Delete(parent->child, i);
                         
                         free(trNode);
                         
                         break;
                     }
                 }               
            }
            
            while( LinkList_Length(node->child) > 0 )
            {
                TLNode* trNode = (TLNode*)LinkList_Get(node->child, 0);
                
                recursive_delete(list, trNode->node);
            }
            
            LinkList_Destroy(node->child);
        
            free(node);
        }
    }
}
开发者ID:start-program,项目名称:start-DataStruct,代码行数:56,代码来源:tree+implement+by+list.c


示例20: tear_down

static void tear_down(struct async **as,
	struct sdirs **sdirs, struct conf ***confs)
{
	async_free(as);
	sdirs_free(sdirs);
	confs_free(confs);
	fail_unless(!recursive_delete(BASE));
//printf("%d %d\n", alloc_count, free_count);
	alloc_check();
}
开发者ID:grealish,项目名称:burp,代码行数:10,代码来源:test_backup_phase2.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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