--- mon/src/mon.cpp 1999/10/04 19:31:09 1.1 +++ mon/src/mon.cpp 1999/10/05 14:43:41 1.3 @@ -1,26 +1,40 @@ /* - * mon.cpp - Machine language monitor + * mon.cpp - mon main program * - * (C) 1997-1999 Christian Bauer + * mon (C) 1997-1999 Christian Bauer, Marc Hellwig + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "sysdeps.h" + +#ifdef HAVE_READLINE_READLINE_H +extern "C" { +#include +} +#endif +#ifdef HAVE_READLINE_HISTORY_H extern "C" { -extern char *readline(char *prompt); -extern void add_history(char *str); +#include } +#endif #include "mon.h" #include "mon_cmd.h" +#include "version.h" // Buffer we're operating on @@ -809,7 +823,7 @@ static void set_var(void) fprintf(monout, "No variables defined\n"); else for (Variable *v=first_var; v; v=v->next) - fprintf(monout, "%s = %08lx\n", v->name, v->value); + fprintf(monout, "%s = %08x\n", v->name, v->value); } else if (mon_token == T_NAME) { char var_name[256]; @@ -902,7 +916,7 @@ static void reallocate(void) } if (mon_token == T_END) { - fprintf(monerr, "Buffer size: %08lx bytes\n", mon_mem_size); + fprintf(monerr, "Buffer size: %08x bytes\n", mon_mem_size); return; } @@ -914,7 +928,7 @@ static void reallocate(void) } if ((mem = (uint8 *)realloc(mem, size)) != NULL) - fprintf(monerr, "Buffer size: %08lx bytes\n", mon_mem_size = size); + fprintf(monerr, "Buffer size: %08x bytes\n", mon_mem_size = size); else fprintf(monerr, "Unable to reallocate buffer\n"); } @@ -956,6 +970,9 @@ static void apply(int size) read_func = mon_read_word; write_func = mon_write_word; break; + default: + abort(); + break; } while (adr<=end_adr) { @@ -1115,8 +1132,8 @@ void mon(int argc, char **argv) // Print banner if (interactive) - fprintf(monerr, "\n *** mon V%d.%d by Christian Bauer ***\n" - " *** Press 'h' for help ***\n\n", MON_VERSION, MON_REVISION); + fprintf(monerr, "\n *** mon V%d.%d by Christian Bauer and Marc Hellwig ***\n" + " *** Press 'h' for help ***\n\n", VERSION_MAJOR, VERSION_MINOR); } init_abort(); @@ -1125,7 +1142,7 @@ void mon(int argc, char **argv) while (!done) { if (interactive) { char prompt[16]; - sprintf(prompt, "[%08lx]-> ", mon_dot_address); + sprintf(prompt, "[%08x]-> ", mon_dot_address); read_line(prompt); } else { if (argc == 0) {