标签:continue clu name bsp 文件 har rcm cups move
#include <dirent.h>
void recovery_backend() { DIR * pdir ; struct dirent * pdirent; struct stat f_ftime; char full_path[PATH_MAX] = {0}; char buf[PATH_MAX] = {0}; char cmd[256] = {0}; pdir = opendir(cups_backend); if(pdir == NULL) return ; for(pdirent = readdir(pdir);pdirent != NULL;pdirent = readdir(pdir)) { if(strcmp(pdirent->d_name,".")==0||strcmp(pdirent->d_name,"..")==0) continue; memset(full_path,0,sizeof(full_path)); snprintf(full_path,sizeof(full_path),"%s%s",cups_backend,pdirent->d_name); if(stat(full_path,&f_ftime) != 0) if(S_ISDIR(f_ftime.st_mode)) continue; /*子目录跳过*/ if(f_ftime.st_mode & S_IFDIR) continue; memset(buf,0,sizeof(buf)); readlink(full_path,buf,sizeof(buf)); if(strcmp(full_hook_backend,buf) == 0) { remove(full_path); memset(cmd,0,sizeof(cmd)); snprintf(cmd,sizeof(cmd),"cp -P %s%s %s",bk_backend,pdirent->d_name,cups_backend); system(cmd); } } closedir(pdir); }
标签:continue clu name bsp 文件 har rcm cups move
原文地址:http://www.cnblogs.com/wangjian8888/p/7799277.html