Match standalone printf_filtered to gdb prototype.

This commit is contained in:
Michael Meissner 1995-10-01 17:54:45 +00:00
parent 709af562b8
commit d8d46596e6
2 changed files with 21 additions and 10 deletions

View file

@ -1,3 +1,7 @@
Sun Oct 1 13:52:59 1995 Michael Meissner <meissner@tiktok.cygnus.com>
* main.c (printf_filtered): Correct to match new prototype.
Sat Sep 30 20:47:05 1995 Michael Meissner <meissner@tiktok.cygnus.com> Sat Sep 30 20:47:05 1995 Michael Meissner <meissner@tiktok.cygnus.com>
* sim_callbacks.h (printf_filtered): Correct prototype. * sim_callbacks.h (printf_filtered): Correct prototype.

View file

@ -33,7 +33,7 @@ extern int optopt;
extern int opterr; extern int opterr;
void void
printf_filtered(char *msg, ...) printf_filtered(const char *msg, ...)
{ {
va_list ap; va_list ap;
va_start(ap, msg); va_start(ap, msg);
@ -68,30 +68,37 @@ zfree(void *chunk)
static void static void
usage(void) usage(void)
{ {
error ("Usage: psim [ -p -c -s -i -t ] <image> [ <image-args> ... ]\n"); error ("Usage: psim [ -a -p -c -C -s -i -t ] <image> [ <image-args> ... ]\n");
} }
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {
psim *system; psim *system;
char **argp;
const char *name_of_file; const char *name_of_file;
char *arg_; char *arg_;
unsigned_word stack_pointer; unsigned_word stack_pointer;
psim_status status; psim_status status;
int letter; int letter;
int i;
/* check for arguments - FIXME use getopt */ /* check for arguments - FIXME use getopt */
while ((letter = getopt (argc, argv, "cipst")) != EOF) while ((letter = getopt (argc, argv, "acCipst")) != EOF)
{ {
switch (argp[0][1]) { switch (letter) {
case 'a':
for (i = 0; i < nr_trace; i++)
trace[i] = 1;
break;
case 'p': case 'p':
trace[trace_cpu] = trace[trace_semantics] = 1; trace[trace_cpu] = trace[trace_semantics] = 1;
break; break;
case 'c': case 'c':
trace[trace_core] = 1; trace[trace_core] = 1;
break; break;
case 'C':
trace[trace_console_device] = 1;
break;
case 's': case 's':
trace[trace_create_stack] = 1; trace[trace_create_stack] = 1;
break; break;
@ -106,22 +113,22 @@ main(int argc, char **argv)
} }
} }
if (argp >= argv+argc) if (optind >= argc)
usage(); usage();
name_of_file = *argp; name_of_file = argv[optind];
/* create the simulator */ /* create the simulator */
system = psim_create(name_of_file, ((WITH_SMP > 0) ? WITH_SMP : 1)); system = psim_create(name_of_file, ((WITH_SMP > 0) ? WITH_SMP : 1));
/* fudge the environment so that _=prog-name */ /* fudge the environment so that _=prog-name */
arg_ = (char*)zalloc(strlen(*argp) + strlen("_=") + 1); arg_ = (char*)zalloc(strlen(argv[optind]) + strlen("_=") + 1);
strcpy(arg_, "_="); strcpy(arg_, "_=");
strcat(arg_, *argp); strcat(arg_, argv[optind]);
putenv(arg_); putenv(arg_);
/* initialize it */ /* initialize it */
psim_load(system); psim_load(system);
psim_stack(system, argp, environ); psim_stack(system, &argv[optind], environ);
psim_run(system); psim_run(system);