static int cmd_sym_load_add(int clear, char **arg) { FILE *in; char * path; if (clear && prompt_abort(MODIFY_SYMS)) return 0; path = expand_tilde(*arg); if (!path) return -1; in = fopen(path, "rb"); free(path); if (!in) { printc_err("sym: %s: %s\n", *arg, last_error()); return -1; } if (clear) { stab_clear(); unmark_modified(MODIFY_SYMS); } else { mark_modified(MODIFY_SYMS); } if (binfile_syms(in) < 0) { fclose(in); return -1; } fclose(in); return 0; }
void reader_loop(int abort_flag) { do { want_exit = 0; for (;;) { char tmpbuf[MAX_READER_LINE] = { 0 }; char *buf = tmpbuf; if (input_module->read_command(tmpbuf, sizeof(tmpbuf))) break; //set repeat if (*buf) { memcpy(repeat_buf, tmpbuf, sizeof(tmpbuf)); } else memcpy(tmpbuf, repeat_buf, sizeof(tmpbuf)); do_command(buf, 1); if (want_exit) break; } } while (prompt_abort(abort_flag)); }
void reader_loop(void) { int old = in_reader_loop; in_reader_loop = 1; if (!opdb_get_boolean("quiet")) { printc("\n"); cmd_help(NULL); printc("\n"); } do { want_exit = 0; for (;;) { char *buf = readline("(mspdebug) "); char tmpbuf[MAX_READER_LINE]; if (!buf) { printc("\n"); break; } /* Copy into our local buffer and free */ strncpy(tmpbuf, buf, sizeof(tmpbuf)); tmpbuf[sizeof(tmpbuf) - 1] = 0; free(buf); buf = tmpbuf; if (*buf) { add_history(buf); repeat_buf[0] = 0; } else { memcpy(tmpbuf, repeat_buf, sizeof(tmpbuf)); } do_command(buf, 1); if (want_exit) break; } } while (prompt_abort(MODIFY_SYMS)); in_reader_loop = old; }