资源简介
os作业分享,可以在mac环境编译运行,虚拟机没调试过
代码片段和文件信息
#include
#include
#include
#include
#include
#include
#include
#define LEN sizeof(struct commandHistory)
#define LEN1 sizeof(struct savePath)
struct commandHistory
{
int iOrder;
char *strDisplay_name;
char *strDirectory;
struct commandHistory *next;
};
struct savePath
{
char *path_name;
struct savePath *next;
};
/* Function prototypes */
char * extractRoute_cd(char * const char * int);
char * extractRoute_path(char * const char * int);
struct commandHistory * create_commandHistroy(int char * char *);
void display_History(struct commandHistory *);
int clear_History(struct commandHistory*);
struct commandHistory * write_History(int char * char * struct commandHistory *);
void display_singleHistory(int int struct commandHistory *);
struct savePath * create_path_head(char *);
void write_Path(int char * struct savePath *);
struct savePath * delete_path(char * struct savePath *);
void display_path(struct savePath *);
int execu_tion(char *);
int main(int argc const char * argv[]) {
char *strCommand_name[6] = { “exit““cd ““pwd““path““history“}; //add a “ “ to each command so that the program can know if the format is wrong
char *strUser_command1; //for saving user‘s input
char strHistory_offset1[10] = “history -c“; //for “strcmp“ to find the offset
char strUser_command[100];
char strNew_directory[100] = {0}; //for saving user‘s file route
char strOffset_empty[8] = {“ “}; //“pwd“ command does not have offset
int iDigit=0; //to record the command‘s number of character
int irecordNumber = 0; //to record which record “history -[num]“ wants to look for
int iNumber = 0; // which command was executed? 0 means “exit “;1 means “cd “....
int iTotal_execution = 0; //to record how many commands were executed.
struct commandHistory * head = NULL; //use a chain to record command history
struct savePath * head_path = NULL;
char *strCommand_extract_cd = NULL;
char *strCommand_extract_history = NULL;
char *strCommand_extract_path = NULL;
char *token=NULL;
int iNumber_path = 0;
char buf[80];
while (1)
{
char str1[100]=“+ “;
char str2[100]=“- “;
char *pathDirectory = NULL;
printf(“\n$“);
strUser_command1 = (char *)malloc(100 *sizeof(char));
fgets(strUser_command1100stdin);
strcpy(strUser_command strUser_command1);
iDigit = ((int)strlen(strUser_command))-1;
//printf(“\n%d---digit“iDigit);
strUser_command[iDigit]=‘\0‘;
free(strUser_command1);
//if (head_path!=NULL)
//{
if(strUser_command[0]==‘/‘||(strUser_command[0]==‘.‘&&strUser_command[1]==‘/‘)) //if the input is a
{
int status;
status = execu_tion(strUser_command);
- 上一篇:Qt实现动态曲线图+文本数据的实时显示
- 下一篇:锅炉课程设计计算用表.xlsm
相关资源
- st7565 驱动 + LCD多层菜单 V1.2.1
- CDMA2000网络优化实习手册
- tm4c123gh6pm LCD12864描点绘图
- 疝气病病马horseColicData.zip
- Proteus中单片机89C51在LCD12864显示
- CAD2014破解文件
- stm32f103zet6开发板LCD显示屏源码
- 基于51单片机和LCD12864显示的多功能万
- vm安装苹果macosMojave系统10.14_cdr(1)
- Xshell要继续使用此程序您必须应用最
- 《合成孔径雷达成像算法与实现》一
- netcdf的入门教程
-
VIA Telecom CBP5.5/5.6 CDMA ba
seband Proces - 2018-2019年CSCD.pdf该文档为中国科学引文
- 4×4矩阵键盘键值LCD1602显示汇编语言
- Wechat微信小程序校园综合服务ShellBo
- 51单片机获取DS18B20序列号LCD显示
- 斯坦福兔.7z点云扫描文件 pcd格式
- STC15+AHT10温湿度传感器+LCD12864.rar
- 双向DCDC电源设计报告
- 黑苹果无法登录appstore反复输入密码
- Mac10.14.cdr,亲测可用
- 2018年Linux系统安全检查、加固shell脚本
- RPCdemo
- lcd12864的文字取模软件
- 基于单片机的温湿度1602显示
- 基于LCD12864的verilog代码
- SIM800C+GPS+ILI9325LCD显示连接服务器
- STC89C52RC 智能家居设计(GSM+人体红外
- 《lcd1602仿真》
评论
共有 条评论