mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-06-01 01:13:34 +08:00
Move shell items to separate file
This commit is contained in:
parent
d01564c473
commit
a9be4b0481
1
Makefile
1
Makefile
@ -73,6 +73,7 @@ LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-pci_cfgreg.c
|
||||
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-program.c
|
||||
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-rwlock.c
|
||||
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-shell.c
|
||||
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-shell-netcmds.c
|
||||
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-signal.c
|
||||
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-smp.c
|
||||
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-subr_param.c
|
||||
|
@ -630,6 +630,7 @@ rtems.addRTEMSSourceFiles(
|
||||
'rtems/rtems-bsd-program.c',
|
||||
'rtems/rtems-bsd-rwlock.c',
|
||||
'rtems/rtems-bsd-shell.c',
|
||||
'rtems/rtems-bsd-shell-netcmds.c',
|
||||
'rtems/rtems-bsd-signal.c',
|
||||
'rtems/rtems-bsd-smp.c',
|
||||
'rtems/rtems-bsd-subr_param.c',
|
||||
|
@ -164,10 +164,11 @@ usage(void)
|
||||
|
||||
#ifdef __rtems__
|
||||
#include <machine/rtems-bsd-program.h>
|
||||
#include <machine/rtems-bsd-commands.h>
|
||||
|
||||
static int main(int argc, char *argv[]);
|
||||
|
||||
static int rtems_shell_main_ifconfig(int argc, char *argv[])
|
||||
int rtems_bsd_command_ifconfig(int argc, char *argv[])
|
||||
{
|
||||
descr = NULL;
|
||||
descrlen = 64;
|
||||
@ -1220,16 +1221,3 @@ ifconfig_ctor(void)
|
||||
cmd_register(&basic_cmds[i]);
|
||||
#undef N
|
||||
}
|
||||
|
||||
#ifdef __rtems__
|
||||
#include <rtems/shell.h>
|
||||
|
||||
rtems_shell_cmd_t rtems_shell_IFCONFIG_Command = {
|
||||
"ifconfig", /* name */
|
||||
"ifconfig [args]", /* usage */
|
||||
"net", /* topic */
|
||||
rtems_shell_main_ifconfig, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
#endif
|
||||
|
@ -219,10 +219,11 @@ static void usage(void) __dead2;
|
||||
|
||||
#ifdef __rtems__
|
||||
#include <machine/rtems-bsd-program.h>
|
||||
#include <machine/rtems-bsd-commands.h>
|
||||
|
||||
static int main(int argc, char **argv);
|
||||
|
||||
static int rtems_shell_main_ping(int argc, char *argv[])
|
||||
int rtems_bsd_command_ping(int argc, char *argv[])
|
||||
{
|
||||
BBELL = '\a';
|
||||
BSPACE = '\b';
|
||||
@ -1769,16 +1770,3 @@ usage()
|
||||
" [-z tos] mcast-group");
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
|
||||
#ifdef __rtems__
|
||||
#include <rtems/shell.h>
|
||||
|
||||
rtems_shell_cmd_t rtems_shell_PING_Command = {
|
||||
"ping", /* name */
|
||||
"ping [args]", /* usage */
|
||||
"net", /* topic */
|
||||
rtems_shell_main_ping, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
#endif
|
||||
|
@ -130,10 +130,11 @@ usage(cp)
|
||||
|
||||
#ifdef __rtems__
|
||||
#include <machine/rtems-bsd-program.h>
|
||||
#include <machine/rtems-bsd-commands.h>
|
||||
|
||||
static int main(int argc, char **argv);
|
||||
|
||||
static int rtems_shell_main_route(int argc, char *argv[])
|
||||
int rtems_bsd_command_route(int argc, char *argv[])
|
||||
{
|
||||
return rtems_bsd_program_call_main("route", main, argc, argv);
|
||||
}
|
||||
@ -1694,16 +1695,3 @@ atalk_ntoa(struct at_addr at)
|
||||
(void) snprintf(buf, sizeof(buf), "%u.%u", ntohs(at.s_net), at.s_node);
|
||||
return(buf);
|
||||
}
|
||||
|
||||
#ifdef __rtems__
|
||||
#include <rtems/shell.h>
|
||||
|
||||
rtems_shell_cmd_t rtems_shell_ROUTE_Command = {
|
||||
"route", /* name */
|
||||
"route [args]", /* usage */
|
||||
"net", /* topic */
|
||||
rtems_shell_main_route, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
#endif
|
||||
|
@ -363,10 +363,11 @@ int live; /* true if we are examining a live system */
|
||||
|
||||
#ifdef __rtems__
|
||||
#include <machine/rtems-bsd-program.h>
|
||||
#include <machine/rtems-bsd-commands.h>
|
||||
|
||||
static int main(int argc, char *argv[]);
|
||||
|
||||
static int rtems_shell_main_netstat(int argc, char *argv[])
|
||||
int rtems_bsd_command_netstat(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -1198,16 +1199,3 @@ usage(void)
|
||||
" netstat -gs [-s] [-f address_family] [-M core] [-N system]");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#ifdef __rtems__
|
||||
#include <rtems/shell.h>
|
||||
|
||||
rtems_shell_cmd_t rtems_shell_NETSTAT_Command = {
|
||||
"netstat", /* name */
|
||||
"netstat [args]", /* usage */
|
||||
"net", /* topic */
|
||||
rtems_shell_main_netstat, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
#endif
|
||||
|
59
rtemsbsd/include/machine/rtems-bsd-commands.h
Normal file
59
rtemsbsd/include/machine/rtems-bsd-commands.h
Normal file
@ -0,0 +1,59 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @ingroup rtems_bsd_machine
|
||||
*
|
||||
* @brief TODO.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2013 embedded brains GmbH. All rights reserved.
|
||||
*
|
||||
* embedded brains GmbH
|
||||
* Dornierstr. 4
|
||||
* 82178 Puchheim
|
||||
* Germany
|
||||
* <rtems@embedded-brains.de>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _RTEMS_BSD_MACHINE_RTEMS_BSD_COMMANDS_H_
|
||||
#define _RTEMS_BSD_MACHINE_RTEMS_BSD_COMMANDS_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
int rtems_bsd_command_ifconfig(int argc, char **argv);
|
||||
|
||||
int rtems_bsd_command_netstat(int argc, char **argv);
|
||||
|
||||
int rtems_bsd_command_ping(int argc, char **argv);
|
||||
|
||||
int rtems_bsd_command_ping6(int argc, char **argv);
|
||||
|
||||
int rtems_bsd_command_route(int argc, char **argv);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _RTEMS_BSD_MACHINE_RTEMS_BSD_COMMANDS_H_ */
|
47
rtemsbsd/rtems/rtems-bsd-shell-netcmds.c
Normal file
47
rtemsbsd/rtems/rtems-bsd-shell-netcmds.c
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* COPYRIGHT (c) 1989-2012.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.com/license/LICENSE.
|
||||
*/
|
||||
|
||||
#include <rtems/netcmds-config.h>
|
||||
#include <machine/rtems-bsd-commands.h>
|
||||
|
||||
rtems_shell_cmd_t rtems_shell_IFCONFIG_Command = {
|
||||
"ifconfig", /* name */
|
||||
"ifconfig [args]", /* usage */
|
||||
"net", /* topic */
|
||||
rtems_bsd_command_ifconfig, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
rtems_shell_cmd_t rtems_shell_NETSTAT_Command = {
|
||||
"netstat", /* name */
|
||||
"netstat [args]", /* usage */
|
||||
"net", /* topic */
|
||||
rtems_bsd_command_netstat, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
rtems_shell_cmd_t rtems_shell_PING_Command = {
|
||||
"ping", /* name */
|
||||
"ping [args]", /* usage */
|
||||
"net", /* topic */
|
||||
rtems_bsd_command_ping, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
rtems_shell_cmd_t rtems_shell_ROUTE_Command = {
|
||||
"route", /* name */
|
||||
"route [args]", /* usage */
|
||||
"net", /* topic */
|
||||
rtems_bsd_command_route, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user