📄 keyshell.c
字号:
#include <stdio.h>#include <stdlib.h>#include <sys/types.h>#include <fcntl.h>#include <unistd.h>#include <errno.h>#include <pthread.h>#include <time.h>#include "../keyboard/get_key.h"char shell_s[]="\nkeyshell>$: ";/*main(){ char key; pthread_t th_key; int rev; rev=my_shell(); return rev;}*//*int kshell(int *argc, char *argv[]){ char cmd[255]; kbd_init(); while(1){ printf("keyshell>$: "); fflush(stdout); get_line(cmd); printf("\r\n"); if(strncmp("****",cmd,4)==0){ kbd_close(); break; } if(cmd[0] != 0){ system(cmd); } }} *//*int argc, char *argv[*/#define CMD_TPYE (0)#define PHONE_NUMBER (1)#define MAX_CMD_DEPTH (2)void * keyshell(){ char cmd[256]={0,}; kbd_init(); //键盘初始化 gprs_init(); //GPRS 初始化 printf("\n<gprs control shell>"); printf("\n [1] give a call"); printf("\n [2] respond a call"); printf("\n [3] hold a call"); printf("\n [4] send a msg"); printf("\n [**] help menu");// printf("\n[1]give a call [2]send a msg [**]exit shell"); // printf("\n[1]give a call [2]send a msg [**]exit shell"); while(1){ printf(shell_s); fflush(stdout); get_line(cmd); printf("\r\n"); //显示必要的输出 if(strncmp("1",cmd,1)==0){ printf("\nyou select to gvie a call, please input number:"); fflush(stdout); get_line(cmd); gprs_call(cmd, strlen(cmd)); printf("\ncalling......"); } else if(strncmp("2",cmd,1)==0){ gprs_ans(); printf("\nanswering......."); } else if(strncmp("3",cmd,1)==0){ gprs_hold(); printf("\nhold a call"); }else if (strncmp("4",cmd,1)==0){ printf("\nyou select to send a message, please input number:"); fflush(stdout); get_line(cmd); gprs_msg(cmd, strlen(cmd)); printf("\nsending......"); }else if (strncmp("**",cmd,2)==0){ printf("\n<gprs control shell>"); printf("\n [1] give a call"); printf("\n [2] respond a call"); printf("\n [3] hold a call"); printf("\n [4] send a msg"); printf("\n [**] help menu"); }else if(cmd[0] != 0){ system(cmd); } } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -