--- mon/src/mon.cpp 2000/04/24 13:20:40 1.7 +++ mon/src/mon.cpp 2000/09/25 17:52:31 1.11 @@ -25,13 +25,21 @@ #include #include -#ifdef HAVE_READLINE_READLINE_H +#if defined(HAVE_READLINE_H) +extern "C" { +#include +} +#elif defined(HAVE_READLINE_READLINE_H) extern "C" { #include } #endif -#ifdef HAVE_READLINE_HISTORY_H +#if defined(HAVE_HISTORY_H) +extern "C" { +#include +} +#elif defined(HAVE_READLINE_HISTORY_H) extern "C" { #include } @@ -40,6 +48,10 @@ extern "C" { #include "mon.h" #include "mon_cmd.h" +#ifndef VERSION +#define VERSION "2" +#endif + // Buffer we're operating on bool mon_use_real_mem = false; @@ -1121,20 +1133,23 @@ void mon(int argc, char **argv) monout = stdout; monerr = stdout; - if (argc) { - // Access real memory if mon was started as "rmon" - char *prgname = argv[0]; - char *lastslash; - if ((lastslash = strrchr(prgname, '/')) != NULL) - prgname = lastslash + 1; - if (strcmp(prgname, "rmon") == 0) + // Make argc/argv point to the actual arguments + if (argc) + argc--; argv++; + + // Parse arguments + mon_macos_mode = false; + mon_use_real_mem = false; + while (argc > 0) { + if (strcmp(argv[0], "-m") == 0) + mon_macos_mode = true; + else if (strcmp(argv[0], "-r") == 0) mon_use_real_mem = true; - - // Make argc/argv point to the actual arguments - argc--; - argv++; - interactive = (argc == 0); + else + break; + argc--; argv++; } + interactive = (argc == 0); // Set up memory access functions if not supplied by the user if (mon_read_byte == NULL) { @@ -1158,7 +1173,7 @@ void mon(int argc, char **argv) // Print banner if (interactive) fprintf(monerr, "\n *** mon V" VERSION " by Christian Bauer and Marc Hellwig ***\n" - " *** Press 'h' for help ***\n\n"); + " *** Press 'h' for help ***\n\n"); } init_abort();