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>
* sim_callbacks.h (printf_filtered): Correct prototype.

View File

@ -33,7 +33,7 @@ extern int optopt;
extern int opterr;
void
printf_filtered(char *msg, ...)
printf_filtered(const char *msg, ...)
{
va_list ap;
va_start(ap, msg);
@ -68,30 +68,37 @@ zfree(void *chunk)
static 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
main(int argc, char **argv)
{
psim *system;
char **argp;
const char *name_of_file;
char *arg_;
unsigned_word stack_pointer;
psim_status status;
int letter;
int i;
/* 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':
trace[trace_cpu] = trace[trace_semantics] = 1;
break;
case 'c':
trace[trace_core] = 1;
break;
case 'C':
trace[trace_console_device] = 1;
break;
case 's':
trace[trace_create_stack] = 1;
break;
@ -106,22 +113,22 @@ main(int argc, char **argv)
}
}
if (argp >= argv+argc)
if (optind >= argc)
usage();
name_of_file = *argp;
name_of_file = argv[optind];
/* create the simulator */
system = psim_create(name_of_file, ((WITH_SMP > 0) ? WITH_SMP : 1));
/* fudge the environment so that _=prog-name */
arg_ = (char*)zalloc(strlen(*argp) + strlen("_=") + 1);
arg_ = (char*)zalloc(strlen(argv[optind]) + strlen("_=") + 1);
strcpy(arg_, "_=");
strcat(arg_, *argp);
strcat(arg_, argv[optind]);
putenv(arg_);
/* initialize it */
psim_load(system);
psim_stack(system, argp, environ);
psim_stack(system, &argv[optind], environ);
psim_run(system);