map_print_some_keys(): * Print keys from first to last */
| 1142 | * Print keys from first to last |
| 1143 | */ |
| 1144 | private void |
| 1145 | map_print_some_keys(EditLine *el, el_action_t *map, Int first, Int last) |
| 1146 | { |
| 1147 | el_bindings_t *bp, *ep; |
| 1148 | Char firstbuf[2], lastbuf[2]; |
| 1149 | char unparsbuf[EL_BUFSIZ], extrabuf[EL_BUFSIZ]; |
| 1150 | |
| 1151 | firstbuf[0] = first; |
| 1152 | firstbuf[1] = 0; |
| 1153 | lastbuf[0] = last; |
| 1154 | lastbuf[1] = 0; |
| 1155 | if (map[first] == ED_UNASSIGNED) { |
| 1156 | if (first == last) { |
| 1157 | (void) keymacro__decode_str(firstbuf, unparsbuf, |
| 1158 | sizeof(unparsbuf), STRQQ); |
| 1159 | (void) fprintf(el->el_outfile, |
| 1160 | "%-15s-> is undefined\n", unparsbuf); |
| 1161 | } |
| 1162 | return; |
| 1163 | } |
| 1164 | ep = &el->el_map.help[el->el_map.nfunc]; |
| 1165 | for (bp = el->el_map.help; bp < ep; bp++) { |
| 1166 | if (bp->func == map[first]) { |
| 1167 | if (first == last) { |
| 1168 | (void) keymacro__decode_str(firstbuf, unparsbuf, |
| 1169 | sizeof(unparsbuf), STRQQ); |
| 1170 | (void) fprintf(el->el_outfile, "%-15s-> " FSTR "\n", |
| 1171 | unparsbuf, bp->name); |
| 1172 | } else { |
| 1173 | (void) keymacro__decode_str(firstbuf, unparsbuf, |
| 1174 | sizeof(unparsbuf), STRQQ); |
| 1175 | (void) keymacro__decode_str(lastbuf, extrabuf, |
| 1176 | sizeof(extrabuf), STRQQ); |
| 1177 | (void) fprintf(el->el_outfile, |
| 1178 | "%-4s to %-7s-> " FSTR "\n", |
| 1179 | unparsbuf, extrabuf, bp->name); |
| 1180 | } |
| 1181 | return; |
| 1182 | } |
| 1183 | } |
| 1184 | #ifdef MAP_DEBUG |
| 1185 | if (map == el->el_map.key) { |
| 1186 | (void) keymacro__decode_str(firstbuf, unparsbuf, |
| 1187 | sizeof(unparsbuf), STRQQ); |
| 1188 | (void) fprintf(el->el_outfile, |
| 1189 | "BUG!!! %s isn't bound to anything.\n", unparsbuf); |
| 1190 | (void) fprintf(el->el_outfile, "el->el_map.key[%d] == %d\n", |
| 1191 | first, el->el_map.key[first]); |
| 1192 | } else { |
| 1193 | (void) keymacro__decode_str(firstbuf, unparsbuf, |
| 1194 | sizeof(unparsbuf), STRQQ); |
| 1195 | (void) fprintf(el->el_outfile, |
| 1196 | "BUG!!! %s isn't bound to anything.\n", unparsbuf); |
| 1197 | (void) fprintf(el->el_outfile, "el->el_map.alt[%d] == %d\n", |
| 1198 | first, el->el_map.alt[first]); |
| 1199 | } |
| 1200 | #endif |
| 1201 | EL_ABORT((el->el_errfile, "Error printing keys\n")); |
no test coverage detected