#include "sysdep.h"
#include "remote-sim.h"
+void usage();
+extern int optind;
+extern char *optarg;
+
int
main (ac, av)
int ac;
int trace = 0;
char *name = "";
- for (i = 1; i < ac; i++)
- {
- if (strcmp(av[i],"-v") == 0)
- verbose++;
-
- else if (strcmp(av[i],"-t") == 0)
- {
- trace = 1;
- }
- else if (strcmp(av[i],"-c") == 0)
- {
- sim_csize(atoi(av[i+1]));
- i++;
- }
- else if (strcmp(av[i],"-h") == 0)
+ while ((i = getopt (ac, av, "c:htv")) != EOF)
+ switch (i)
+ {
+ case 'c':
+ sim_csize (atoi (optarg));
+ break;
+ case 'h':
set_h8300h (1);
- else
- name = av[i];
- }
+ break;
+ case 't':
+ trace = 1;
+ break;
+ case 'v':
+ verbose = 1;
+ break;
+ default:
+ usage();
+ }
+ ac -= optind;
+ av += optind;
+
+ if (ac != 1)
+ usage();
+
+ name = *av;
if (verbose)
printf ("run %s\n", name);
vfprintf (stdout, msg, args);
va_end (args);
}
+
+void
+usage()
+{
+ fprintf (stderr, "usage: run [-tv] program\n");
+ exit (1);
+}
-/* run front end support for H8/500
+/* run front end support for SH
Copyright (C) 1987, 1992 Free Software Foundation, Inc.
-This file is part of H8300 SIM
+This file is part of SH SIM
GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include "sysdep.h"
#include "remote-sim.h"
+void usage();
+extern int optind;
+extern char *optarg;
+
int target_byte_order;
int
int trace = 0;
char *name = "";
- for (i = 1; i < ac; i++)
- {
- if (strcmp (av[i], "-v") == 0)
- {
- verbose = 1;
- }
- else if (strcmp (av[i], "-t") == 0)
- {
- trace = 1;
- }
- else if (strcmp (av[i], "-p") == 0)
- {
- sim_set_profile (atoi (av[i + 1]));
- i++;
- }
- else if (strcmp (av[i], "-s") == 0)
- {
- sim_set_profile_size (atoi (av[i + 1]));
- i++;
- }
- else if (strcmp (av[i], "-m") == 0)
- {
- sim_size (atoi (av[i + 1]));
- i++;
- }
- else
- {
- name = av[i];
- }
- }
+ while ((i = getopt (ac, av, "m:p:s:tv")) != EOF)
+ switch (i)
+ {
+ case 'm':
+ sim_size (atoi (optarg));
+ break;
+ case 'p':
+ sim_set_profile (atoi (optarg));
+ break;
+ case 's':
+ sim_set_profile_size (atoi (optarg));
+ break;
+ case 't':
+ trace = 1;
+ break;
+ case 'v':
+ verbose = 1;
+ break;
+ default:
+ usage();
+ }
+ ac -= optind;
+ av += optind;
+
+ if (ac != 1)
+ usage();
+
+ name = *av;
+
if (verbose)
{
printf ("run %s\n", name);
return 1;
}
+
+void
+usage()
+{
+ fprintf (stderr, "usage: run [-tv] program\n");
+ exit (1);
+}
+
\f
/* Callbacks used by the simulator proper. */
#include "bfd.h"
#include "sysdep.h"
-extern printf();
+void usage();
+extern int optind;
int
main (ac, av)
int verbose = 0;
int trace = 0;
char *name = "";
-
- for (i = 1; i < ac; i++)
- {
- if (strcmp (av[i], "-v") == 0)
- {
- verbose = 1;
- }
- else if (strcmp (av[i], "-t") == 0)
- {
- trace = 1;
- }
- else
- {
- name = av[i];
- }
- }
+
+ while ((i = getopt (ac, av, "tv")) != EOF)
+ switch (i)
+ {
+ case 't':
+ trace = 1;
+ break;
+ case 'v':
+ verbose = 1;
+ break;
+ default:
+ usage();
+ }
+ ac -= optind;
+ av += optind;
+
+ if (ac != 1)
+ usage();
+
+ name = *av;
+
if (verbose)
{
printf ("run %s\n", name);
return 1;
}
+
+void
+usage()
+{
+ fprintf (stderr, "usage: run [-tv] program\n");
+ exit (1);
+}