⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 name.c

📁 os arm os arm os arm os arm os arm os arm os arm os arm os arm os arm os arm os arm os arm os arm
💻 C
字号:
extern int current_clus;
unsigned int get_current_dir_cluster()
{
	return 0;
}

unsigned int get_root_dir_cluster()
{
	return 0;
}

unsigned int get_dir_cluster(char *path,int cluster)
{
	printk("%s\n",path);
	return 1;
}

/*
 *	从路径中取得目录名或文件名
 */
int name_filter(char *name,char **dir_pos)
{
	char *p;
	int name_size=0;
	p=name;
	while(**dir_pos!='\0'&&**dir_pos!='\\')
	{
		*p=**dir_pos;
		p++;
		(*dir_pos)++;
		name_size++;
	}
	*p='\0';
	(*dir_pos)++;
	
	//返回目录名或文件名的长度
	return name_size;
}



/*
 *	根据路径名找到目录或文件的簇号
 */
unsigned int find_cluster(char *path)
{	
	unsigned int cluster_find;
	char name[256];
	char *s;

	s=path;

	//若不是绝对路径,则取得当前路径的cluster
	if(s[0]!='\\')
	{
		cluster_find=current_clus;
	}
	else//path是绝对路径,从根目录开始寻找取得根路径的cluster
	{
		s++;
		cluster_find=get_root_dir_cluster();
	}

	/*
	 *	对路径中出现的目录名或文件名进行寻找
	 */
	while(*s!='\0')
	{
		//取得目录名或文件名
		name_filter(name,&s);
		//对该名称进行寻找
		if((cluster_find=get_dir_cluster(name,cluster_find))==0)
			return 0;
	}

	return 1;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -