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

📄 open_0.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 sys_chdir(const char * filename, unsigned char * buf, unsigned long length){	struct m_inode * inode;
	unsigned char	 temp_path[256];
	unsigned char  * temp_pChar;
	unsigned char  * temp_buf;
	int				 i,j;
	if (!buf || (length < 256) || !(inode = namei(filename)))
		return -1;	if (!S_ISDIR(inode->i_mode)) {		iput(inode);		return -1;	}	iput(current_pwd);	current_pwd = inode;
	/////////////////////////////////////////////
	for (i = 0; i <= current_pathlength; i++)
	{
		current_pwd_path[i] = current_path[i];
		temp_path[i]		= current_path[i];
	}
	
	current_pwd_pathlength	= current_pathlength;
	i						= current_pathlength;
	while (i)
	{
		j = temp_path[i];
		temp_path[i] = '\\';
		i = j;
	}

	temp_pChar	= temp_path;
	temp_buf	= buf;
	put_gs_byte(0x0d,temp_buf++);
	put_gs_byte(0x0a,temp_buf++);
	for (i = 0; i <= current_pathlength; 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 + -