keymacro_add(): * Adds key to the el->el_keymacro.map and associates the value in * val with it. If key is already is in el->el_keymacro.map, the new * code is applied to the existing key. Ntype specifies if code is a * command, an out str or a unix command. */
| 188 | * command, an out str or a unix command. |
| 189 | */ |
| 190 | protected void |
| 191 | keymacro_add(EditLine *el, const Char *key, keymacro_value_t *val, int ntype) |
| 192 | { |
| 193 | |
| 194 | if (key[0] == '\0') { |
| 195 | (void) fprintf(el->el_errfile, |
| 196 | "keymacro_add: Null extended-key not allowed.\n"); |
| 197 | return; |
| 198 | } |
| 199 | if (ntype == XK_CMD && val->cmd == ED_SEQUENCE_LEAD_IN) { |
| 200 | (void) fprintf(el->el_errfile, |
| 201 | "keymacro_add: sequence-lead-in command not allowed\n"); |
| 202 | return; |
| 203 | } |
| 204 | if (el->el_keymacro.map == NULL) |
| 205 | /* tree is initially empty. Set up new node to match key[0] */ |
| 206 | el->el_keymacro.map = node__get(key[0]); |
| 207 | /* it is properly initialized */ |
| 208 | |
| 209 | /* Now recurse through el->el_keymacro.map */ |
| 210 | (void) node__try(el, el->el_keymacro.map, key, val, ntype); |
| 211 | return; |
| 212 | } |
| 213 | |
| 214 | |
| 215 | /* keymacro_clear(): |
no test coverage detected