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

📄 sur_basic.c

📁 图书管理系统  给予文件的 可以运行的  在MINGW上运行
💻 C
字号:
/* file_name:	sur_basic.c
 * author:	wangtiezhen miuliang @ Xidian University
 * description:	
 */
flag_type sur_get_command(void){
	
//	printf("all your command:\n");
//	int i = 0;
//	for(i = 0; i < command_num_max ; i++){
//		printf("command:%d, %s\n", i, item[command_user_type][i].output); 
//	}

	getline(comm, sizeof(comm));
	printf("you have entered %s\n", comm);
	
	int comm_num;
	char comm_char_temp[sizeof(comm)];
	
	
	
	
	if(sscanf(comm, "%d", &comm_num) == 1){
		if(comm_num < command_num_max){
			if(item[command_user_type][comm_num].func == NULL){
				printf("Function isn't created.\n");
				return session_ok;
			}else{
//				printf("find the func.\n");
				return (*item[command_user_type][comm_num].func)();
			}
		}else{
			printf("the command is too big.\n");
			return session_ok;
		}
	}else if(sscanf(comm, "%s", comm_char_temp) == 1){
		printf("char:%s\n", comm_char_temp);
/* Begin:
 * find the command by travel.
 */
		int i = 0;
		for(i = 0; i < command_num_max; i++){
//			putchar('a');
			if(!strcmp(comm_char_temp, item[command_user_type][i].output) || !strcmp(comm_char_temp, item[command_user_type][i].lite_command)){
				if(item[command_user_type][i].func == NULL){
					printf("Function isn't created.\n");
					return session_ok;
				}else{
//					printf("find the func.\n");
					return (*item[command_user_type][i].func)();
				}
			}
		}
/* End:
 * find the command by travel.
 */
 
/* Begin:
 * the tail action
 */
		if((!strcmp(comm_char_temp, "list_command")) || (!strcmp(comm_char_temp, "list"))){
			printf("all your command:\n");
			int i = 0;
			for(i = 0; i < command_num_max ; i++){
				printf("command: \t %d \t %s \t quick: %s\n", i, item[command_user_type][i].output, item[command_user_type][i].lite_command); 
			}
			return session_ok;
		}else{
			printf("The command isn't found.\n");
			return session_ok;
		}
/* End:
 * the tail action
 */
 
 
	}else{
		printf("error on get command.\n");
	}
}	








⌨️ 快捷键说明

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