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

📄 msdos_sys_chdir.c

📁 阿基米德操作系统的源代码
💻 C
字号:

/////////////////////////////////////////////////
#include "general.h"
#include "s_isdirreg.h"

#include "hd_info_struct.h"
#include "dir_entry.h"
#include "msdos_dir_entry.h"
#include "d_inode.h"
#include "m_inode.h"
#include "buffer_head.h"
#include "fat_cache.h"
#include "file.h"
#include "hd_request_struct.h"
#include "super_block.h"

#include "common_head.h"
/////////////////////////////////////////////////
int msdos_sys_chdir(const char * filename, unsigned char * buf, unsigned long length){	struct m_inode * temp_inode;
	unsigned char	 temp_path[256];
	unsigned char  * temp_pChar;
	unsigned char  * temp_buf;
	int				 temp_i,temp_j;
	if (!buf || (length < 256) || !(temp_inode = msdos_namei(filename)))
		return -1;	if (!S_MSDOS_ISDIR(temp_inode->i_mode)) 
	{		msdos_iput(temp_inode);		return -1;	}	msdos_iput(current_pwd);	current_pwd = temp_inode;

	for (temp_i = 0; temp_i <= current_pathlength; temp_i++)
	{
		current_pwd_path[temp_i]	= current_path[temp_i];
		temp_path[temp_i]			= current_path[temp_i];
	}
	current_pwd_pathlength	= current_pathlength;
	temp_i					= current_pathlength;
	while (temp_i)
	{
		temp_j = temp_path[temp_i];
		temp_path[temp_i] = '\\';
		temp_i = temp_j;
	}

	temp_pChar	= temp_path;
	temp_buf	= buf;
	put_gs_byte(0x0d,temp_buf++);
	put_gs_byte(0x0a,temp_buf++);
	for (temp_i = 0; temp_i <= current_pathlength; temp_i++) 
		put_gs_byte(*temp_pChar++, temp_buf++);
	put_gs_byte('>', temp_buf++);
	put_gs_byte(0, temp_buf++);
	return (current_pathlength + 2);}

⌨️ 快捷键说明

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