comparison uicc/dispatch.c @ 133:ede661d78730

fc-uicc-tool: command shell features match fc-simtool
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 20 Feb 2021 22:30:54 +0000
parents 8e70ee7c194f
children 58406ead2497
comparison
equal deleted inserted replaced
132:d991944aa5f3 133:ede661d78730
7 #include <string.h> 7 #include <string.h>
8 #include <strings.h> 8 #include <strings.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 10
11 extern int cmd_apdu(); 11 extern int cmd_apdu();
12 extern int cmd_cd();
12 extern int cmd_change_pin(); 13 extern int cmd_change_pin();
13 extern int cmd_dir(); 14 extern int cmd_dir();
14 extern int cmd_disable_pin(); 15 extern int cmd_disable_pin();
15 extern int cmd_enable_pin(); 16 extern int cmd_enable_pin();
16 extern int cmd_exec(); 17 extern int cmd_exec();
42 int allow_redir; 43 int allow_redir;
43 int (*func)(); 44 int (*func)();
44 } cmdtab[] = { 45 } cmdtab[] = {
45 {"apdu", 1, 1, 0, cmd_apdu}, 46 {"apdu", 1, 1, 0, cmd_apdu},
46 {"atr", 0, 0, 0, retrieve_atr}, 47 {"atr", 0, 0, 0, retrieve_atr},
48 {"cd", 1, 1, 0, cmd_cd},
47 {"change-pin", 3, 3, 0, cmd_change_pin}, 49 {"change-pin", 3, 3, 0, cmd_change_pin},
48 {"dir", 0, 0, 1, cmd_dir}, 50 {"dir", 0, 0, 1, cmd_dir},
49 {"disable-pin", 2, 2, 0, cmd_disable_pin}, 51 {"disable-pin", 2, 2, 0, cmd_disable_pin},
50 {"enable-pin", 2, 2, 0, cmd_enable_pin}, 52 {"enable-pin", 2, 2, 0, cmd_enable_pin},
51 {"exec", 1, 1, 0, cmd_exec}, 53 {"exec", 1, 1, 0, cmd_exec},
52 {"exit", 0, 0, 0, good_exit}, 54 {"exit", 0, 0, 0, good_exit},
53 {"iccid", 0, 0, 0, cmd_iccid}, 55 {"iccid", 0, 0, 1, cmd_iccid},
54 {"pin-attempt-cnt", 1, 1, 0, cmd_pin_attempt_cnt}, 56 {"pin-attempt-cnt", 1, 1, 0, cmd_pin_attempt_cnt},
55 {"puk-attempt-cnt", 1, 1, 0, cmd_puk_attempt_cnt}, 57 {"puk-attempt-cnt", 1, 1, 0, cmd_puk_attempt_cnt},
56 {"quit", 0, 0, 0, good_exit}, 58 {"quit", 0, 0, 0, good_exit},
57 {"readbin", 2, 2, 1, cmd_readbin}, 59 {"readbin", 2, 2, 1, cmd_readbin},
58 {"readef", 1, 1, 1, cmd_readef}, 60 {"readef", 1, 1, 1, cmd_readef},
114 ; 116 ;
115 if (!*cp || *cp == '#') 117 if (!*cp || *cp == '#')
116 return(0); 118 return(0);
117 if (is_script) 119 if (is_script)
118 printf("Script command: %s\n", cp); 120 printf("Script command: %s\n", cp);
121 if (*cp == '!')
122 return system(cp + 1);
119 argv[0] = cp; 123 argv[0] = cp;
120 while (*cp && !isspace(*cp)) 124 while (*cp && !isspace(*cp))
121 cp++; 125 cp++;
122 if (*cp) 126 if (*cp)
123 *cp++ = '\0'; 127 *cp++ = '\0';