📄 cd_func.c
字号:
//////////////////////////////////////////////////////////////////////////
#include "general.h"
#include "s_isdirreg.h"
#include "the_syscalls.h"
#include "shell_head.h"
//////////////////////////////////////////////////////////////////////////
int CD_Func(void)
{
int temp_index;
char * temp_pChar;
int temp_Ret;
int i;
if ((command_params == 0) || (command_params > 1))
{
the_screen_call18("\n\r CD bad parameters!");
return -1;
}
temp_index = command_index + 1;
while (command_buf[temp_index])
{
if ((command_buf[temp_index] == '/') ||
(command_buf[temp_index] == ':') ||
(command_buf[temp_index] == '|') ||
(command_buf[temp_index] == '*') ||
(command_buf[temp_index] == '?'))
{
the_screen_call18("\n\r CD bad parameters!");
return -1;
}
temp_index++;
}
if (temp_index - command_index - 1 + pathbuf_length > 240)
{
the_screen_call18("\n\r CD bad parameters!");
return -1;
}
temp_pChar = command_buf + command_index + 1;
temp_Ret = the_file_chdir(temp_pChar,path0_buf,256);
if (temp_Ret < 0)
{
the_screen_call18("\n\r CD bad parameters!");
return -1;
}
for (i = 0; i < temp_Ret + 3; i++)
path_buf[i] = path0_buf[i];
pathbuf_length = temp_Ret;
return 0;
}
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -