Move program control to thread structure

This commit is contained in:
Sebastian Huber
2013-10-17 10:38:34 +02:00
parent c333babc98
commit d01564c473
14 changed files with 558 additions and 115 deletions

View File

@@ -114,25 +114,6 @@ static struct afswtch *af_getbyname(const char *name);
static struct afswtch *af_getbyfamily(int af);
static void af_other_status(int);
#ifdef __rtems__
static int main_ifconfig(int argc, char *argv[]);
static int rtems_shell_main_ifconfig(int argc, char *argv[])
{
rtems_shell_globals_t ifconfig_globals;
rtems_shell_globals = &ifconfig_globals;
memset (rtems_shell_globals, 0, sizeof (ifconfig_globals));
descr = NULL;
descrlen = 64;
newaddr = 1;
supmedia = 0;
printkeys = 0;
ifconfig_globals.exit_code = 1;
if (setjmp (ifconfig_globals.exit_jmp) == 0)
return main_ifconfig ( argc, argv);
return ifconfig_globals.exit_code;
}
#endif
#ifdef __rtems__
static struct ifconfig_option *opts = NULL;
@@ -182,12 +163,23 @@ usage(void)
}
#ifdef __rtems__
int
main_ifconfig(int argc, char *argv[])
#else
#include <machine/rtems-bsd-program.h>
static int main(int argc, char *argv[]);
static int rtems_shell_main_ifconfig(int argc, char *argv[])
{
descr = NULL;
descrlen = 64;
newaddr = 1;
supmedia = 0;
printkeys = 0;
return rtems_bsd_program_call_main("ifconfig", main, argc, argv);
}
#endif /* __rtems__ */
int
main(int argc, char *argv[])
#endif
{
int c, all, namesonly, downonly, uponly;
const struct afswtch *afp = NULL;

View File

@@ -218,44 +218,39 @@ static void tvsub(struct timeval *, struct timeval *);
static void usage(void) __dead2;
#ifdef __rtems__
static int main_ping(int argc, char *const *argv);
#include <machine/rtems-bsd-program.h>
static int main(int argc, char **argv);
static int rtems_shell_main_ping(int argc, char *argv[])
{
rtems_shell_globals_t ping_globals;
rtems_shell_globals = &ping_globals;
memset (rtems_shell_globals, 0, sizeof (ping_globals));
BBELL = '\a';
BSPACE = '\b';
DOT = '.';
icmp_type = ICMP_ECHO;
icmp_type_rsp = ICMP_ECHOREPLY;
phdr_len = 0;
sweepmin = 0;
sweepincr = 1;
interval = 1000;
waittime = MAXWAIT;
nrcvtimeout = 0;
tmin = 999999999.0;
tmax = 0.0;
tsum = 0.0;
tsumsq = 0.0;
ping_globals.exit_code = 1;
if (setjmp (ping_globals.exit_jmp) == 0)
return main_ping (argc, argv);
return ping_globals.exit_code;
BBELL = '\a';
BSPACE = '\b';
DOT = '.';
icmp_type = ICMP_ECHO;
icmp_type_rsp = ICMP_ECHOREPLY;
phdr_len = 0;
sweepmin = 0;
sweepincr = 1;
interval = 1000;
waittime = MAXWAIT;
nrcvtimeout = 0;
tmin = 999999999.0;
tmax = 0.0;
tsum = 0.0;
tsumsq = 0.0;
return rtems_bsd_program_call_main("ping", main, argc, argv);
}
#endif
#endif /* __rtems__ */
int
#ifdef __rtems__
main_ping(argc, argv)
#else
main(argc, argv)
#endif
int argc;
#ifndef __rtems__
char *const *argv;
#else /* __rtems__ */
char **argv;
#endif /* __rtems__ */
{
struct sockaddr_in from, sock_in;
struct in_addr ifaddr;

View File

@@ -116,24 +116,6 @@ extern char *iso_ntoa();
void usage(const char *) __dead2;
#ifdef __rtems__
static int main_route(int argc, char **argv);
static int rtems_shell_main_route(int argc, char *argv[])
{
rtems_shell_globals_t route_globals;
rtems_shell_globals = &route_globals;
memset (rtems_shell_globals, 0, sizeof (route_globals));
route_globals.exit_code = 1;
if (setjmp (route_globals.exit_jmp) == 0)
return main_route ( argc, argv);
return route_globals.exit_code;
}
#endif
void
usage(cp)
const char *cp;
@@ -147,11 +129,17 @@ usage(cp)
}
#ifdef __rtems__
#include <machine/rtems-bsd-program.h>
static int main(int argc, char **argv);
static int rtems_shell_main_route(int argc, char *argv[])
{
return rtems_bsd_program_call_main("route", main, argc, argv);
}
#endif /* __rtems__ */
int
main_route(argc, argv)
#else
main(argc, argv)
#endif
int argc;
char **argv;
{