mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-10-06 10:59:48 +08:00
2007-12-17 Chris Johns <chrisj@rtems.org>
* libnetworking/rtems/tftp.h: Provide a decl to the TFTP file system opts table. * libnetworking/rtems/ftpfs.h: Provide a decl to the FTP file system opts table. * libmisc/Makefile.am: Add the mount command and supporting files. * libmisc/preinstall.am: Rebuilt. * libmisc/shell/cat_file.c, libmisc/shell/cmds.c, libmisc/shell/main_alias.c, libmisc/shell/main_cat.c, libmisc/shell/main_cd.c, libmisc/shell/main_chdir.c, libmisc/shell/main_chmod.c, libmisc/shell/main_chroot.c, libmisc/shell/main_cpuuse.c, libmisc/shell/main_date.c, libmisc/shell/main_dir.c, libmisc/shell/main_exit.c, libmisc/shell/main_help.c, libmisc/shell/main_id.c, libmisc/shell/main_logoff.c, libmisc/shell/main_ls.c, libmisc/shell/main_mallocdump.c, libmisc/shell/main_mdump.c, libmisc/shell/main_medit.c, libmisc/shell/main_mfill.c, libmisc/shell/main_mkdir.c, libmisc/shell/main_mmove.c, libmisc/shell/main_mwdump.c, libmisc/shell/main_pwd.c, libmisc/shell/main_rm.c, libmisc/shell/main_rmdir.c, libmisc/shell/main_stackuse.c, libmisc/shell/main_tty.c, libmisc/shell/main_umask.c, libmisc/shell/main_whoami.c, libmisc/shell/shell.c, libmisc/shell/shell_cmdset.c, libmisc/shell/shell_makeargs.c, libmisc/shell/str2int.c, libmisc/shell/write_file.c: Move all shell_* types, variables and functions to rtems_shell_* to avoid namespace clashes with applications. The is an RTEMS shell after all. * libmisc/shell/shell.h, libmisc/shell/internal.h, libmisc/shell/shellconfig.h: Move all shell_* types, variables and functions to rtems_shell_* to avoid namespace clashes with applications. Add the mount command supporting types. * libmisc/shell/main_mount.c, libmisc/shell/main_mount_ftp.c, libmisc/shell/main_mount_msdos.c, libmisc/shell/main_mount_nfs.c, libmisc/shell/main_mount_tftp.c: New.
This commit is contained in:
@@ -1,3 +1,39 @@
|
||||
2007-12-17 Chris Johns <chrisj@rtems.org>
|
||||
|
||||
* libnetworking/rtems/tftp.h: Provide a decl to the TFTP file
|
||||
system opts table.
|
||||
* libnetworking/rtems/ftpfs.h: Provide a decl to the FTP file
|
||||
system opts table.
|
||||
* libmisc/Makefile.am: Add the mount command and supporting files.
|
||||
* libmisc/preinstall.am: Rebuilt.
|
||||
* libmisc/shell/cat_file.c, libmisc/shell/cmds.c,
|
||||
libmisc/shell/main_alias.c, libmisc/shell/main_cat.c,
|
||||
libmisc/shell/main_cd.c, libmisc/shell/main_chdir.c,
|
||||
libmisc/shell/main_chmod.c, libmisc/shell/main_chroot.c,
|
||||
libmisc/shell/main_cpuuse.c, libmisc/shell/main_date.c,
|
||||
libmisc/shell/main_dir.c, libmisc/shell/main_exit.c,
|
||||
libmisc/shell/main_help.c, libmisc/shell/main_id.c,
|
||||
libmisc/shell/main_logoff.c, libmisc/shell/main_ls.c,
|
||||
libmisc/shell/main_mallocdump.c, libmisc/shell/main_mdump.c,
|
||||
libmisc/shell/main_medit.c, libmisc/shell/main_mfill.c,
|
||||
libmisc/shell/main_mkdir.c, libmisc/shell/main_mmove.c,
|
||||
libmisc/shell/main_mwdump.c, libmisc/shell/main_pwd.c,
|
||||
libmisc/shell/main_rm.c, libmisc/shell/main_rmdir.c,
|
||||
libmisc/shell/main_stackuse.c, libmisc/shell/main_tty.c,
|
||||
libmisc/shell/main_umask.c, libmisc/shell/main_whoami.c,
|
||||
libmisc/shell/shell.c, libmisc/shell/shell_cmdset.c,
|
||||
libmisc/shell/shell_makeargs.c, libmisc/shell/str2int.c,
|
||||
libmisc/shell/write_file.c: Move all shell_* types, variables and
|
||||
functions to rtems_shell_* to avoid namespace clashes with
|
||||
applications. The is an RTEMS shell after all.
|
||||
* libmisc/shell/shell.h, libmisc/shell/internal.h,
|
||||
libmisc/shell/shellconfig.h: Move all shell_* types, variables and
|
||||
functions to rtems_shell_* to avoid namespace clashes with
|
||||
applications. Add the mount command supporting types.
|
||||
* libmisc/shell/main_mount.c, libmisc/shell/main_mount_ftp.c,
|
||||
libmisc/shell/main_mount_msdos.c, libmisc/shell/main_mount_nfs.c,
|
||||
libmisc/shell/main_mount_tftp.c: New.
|
||||
|
||||
2007-12-16 Ralf Corsépius <ralf.corsepius@rtems.org>
|
||||
|
||||
* configure.ac: Revert Joel's 2007-06-13 NDEBUG patch.
|
||||
|
||||
@@ -64,6 +64,10 @@ libmw_fb_a_SOURCES = mw-fb/mw_fb.c mw-fb/mw_uid.c mw-fb/mw_fb.h \
|
||||
|
||||
if LIBSHELL
|
||||
noinst_LIBRARIES += libshell.a
|
||||
if LIBNETWORKING
|
||||
shell_mount_fs = shell/main_mount_ftp.c shell/main_mount_nfs.c \
|
||||
shell/main_mount_tftp.c
|
||||
endif
|
||||
libshell_a_SOURCES = shell/cat_file.c shell/cmds.c shell/internal.h \
|
||||
shell/main_alias.c shell/main_cat.c shell/main_cd.c \
|
||||
shell/main_chdir.c shell/main_chmod.c shell/main_chroot.c \
|
||||
@@ -71,10 +75,11 @@ libshell_a_SOURCES = shell/cat_file.c shell/cmds.c shell/internal.h \
|
||||
shell/main_exit.c shell/main_help.c shell/main_id.c \
|
||||
shell/main_logoff.c shell/main_ls.c shell/main_mallocdump.c \
|
||||
shell/main_mdump.c shell/main_medit.c shell/main_mfill.c \
|
||||
shell/main_mkdir.c shell/main_mmove.c shell/main_mwdump.c \
|
||||
shell/main_pwd.c shell/main_rm.c shell/main_rmdir.c shell/main_stackuse.c \
|
||||
shell/main_tty.c shell/main_umask.c shell/main_whoami.c \
|
||||
shell/shell.c shell/shell_cmdset.c shell/shellconfig.c \
|
||||
shell/main_mkdir.c shell/main_mount.c $(shell_mount_fs) \
|
||||
shell/main_mount_msdos.c shell/main_mmove.c shell/main_mwdump.c \
|
||||
shell/main_pwd.c shell/main_rm.c shell/main_rmdir.c \
|
||||
shell/main_stackuse.c shell/main_tty.c shell/main_umask.c \
|
||||
shell/main_whoami.c shell/shell.c shell/shell_cmdset.c shell/shellconfig.c \
|
||||
shell/shellconfig.h shell/shell.h shell/shell_makeargs.c \
|
||||
shell/str2int.c shell/write_file.c
|
||||
endif
|
||||
|
||||
@@ -5,3 +5,5 @@ $(srcdir)/preinstall.am: Makefile.am
|
||||
$(AMPOLISH3) $(srcdir)/Makefile.am > $(srcdir)/preinstall.am
|
||||
endif
|
||||
|
||||
if LIBSHELL
|
||||
endif
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
void cat_file(FILE * out,char * name) {
|
||||
void rtems_shell_cat_file(FILE * out,char * name) {
|
||||
FILE * fd;
|
||||
int c;
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
* with this you can call at all the rtems monitor commands.
|
||||
* Not all work fine but you can show the rtems status and more.
|
||||
*-----------------------------------------------------------*/
|
||||
int main_monitor(int argc,char * argv[]) {
|
||||
int rtems_shell_main_monitor(int argc,char * argv[]) {
|
||||
rtems_monitor_command_entry_t *command;
|
||||
|
||||
if ((command=rtems_monitor_command_lookup(rtems_monitor_commands,argc,argv)))
|
||||
@@ -37,15 +37,15 @@ int main_monitor(int argc,char * argv[]) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void shell_register_monitor_commands(void)
|
||||
void rtems_shell_register_monitor_commands(void)
|
||||
{
|
||||
rtems_monitor_command_entry_t *command;
|
||||
/* monitor topic */
|
||||
command = rtems_monitor_commands;
|
||||
while (command) {
|
||||
if (strcmp("exit",command->command)) /* Exclude EXIT (alias quit)*/
|
||||
shell_add_cmd(command->command,"monitor",
|
||||
command->usage ,main_monitor);
|
||||
rtems_shell_add_cmd(command->command,"monitor",
|
||||
command->usage,rtems_shell_main_monitor);
|
||||
command = command->next;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,22 +15,27 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
struct shell_topic_tt;
|
||||
typedef struct shell_topic_tt shell_topic_t;
|
||||
struct rtems_shell_topic_tt;
|
||||
typedef struct rtems_shell_topic_tt rtems_shell_topic_t;
|
||||
|
||||
struct shell_topic_tt {
|
||||
char *topic;
|
||||
shell_topic_t *next;
|
||||
struct rtems_shell_topic_tt {
|
||||
char *topic;
|
||||
rtems_shell_topic_t *next;
|
||||
};
|
||||
|
||||
|
||||
extern shell_cmd_t * shell_first_cmd;
|
||||
extern shell_topic_t * shell_first_topic;
|
||||
extern rtems_shell_cmd_t * rtems_shell_first_cmd;
|
||||
extern rtems_shell_topic_t * rtems_shell_first_topic;
|
||||
|
||||
shell_topic_t * shell_lookup_topic(char * topic);
|
||||
rtems_shell_topic_t * rtems_shell_lookup_topic(char * topic);
|
||||
|
||||
|
||||
void shell_register_monitor_commands(void);
|
||||
void shell_initialize_command_set(void);
|
||||
void rtems_shell_register_monitor_commands(void);
|
||||
void rtems_shell_initialize_command_set(void);
|
||||
|
||||
int rtems_shell_libc_mounter (const char* driver,
|
||||
const char* path,
|
||||
rtems_shell_filesystems_t* fs,
|
||||
rtems_filesystem_options_t options);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -22,24 +22,24 @@
|
||||
#include <rtems/shell.h>
|
||||
#include "internal.h"
|
||||
|
||||
int main_alias(int argc, char **argv)
|
||||
int rtems_shell_rtems_main_alias(int argc, char **argv)
|
||||
{
|
||||
if (argc<3) {
|
||||
fprintf(stdout,"too few arguments\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!shell_alias_cmd(argv[1],argv[2])) {
|
||||
if (!rtems_shell_alias_cmd(argv[1],argv[2])) {
|
||||
fprintf(stdout,"unable to make an alias(%s,%s)\n",argv[1],argv[2]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
shell_cmd_t Shell_ALIAS_Command = {
|
||||
rtems_shell_cmd_t rtems_Shell_ALIAS_Command = {
|
||||
"alias", /* name */
|
||||
"alias old new", /* usage */
|
||||
"misc", /* topic */
|
||||
main_alias, /* command */
|
||||
rtems_shell_rtems_main_alias, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
@@ -35,21 +35,21 @@
|
||||
#include <rtems/shell.h>
|
||||
#include "internal.h"
|
||||
|
||||
int main_cat(int argc, char *argv[])
|
||||
int rtems_shell_main_cat(int argc, char *argv[])
|
||||
{
|
||||
int n;
|
||||
n=1;
|
||||
|
||||
while (n<argc)
|
||||
cat_file(stdout,argv[n++]);
|
||||
rtems_shell_cat_file(stdout,argv[n++]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
shell_cmd_t Shell_CAT_Command = {
|
||||
rtems_shell_cmd_t rtems_Shell_CAT_Command = {
|
||||
"cat", /* name */
|
||||
"cat n1 [n2 [n3...]] # show the ascii contents", /* usage */
|
||||
"files", /* topic */
|
||||
main_cat , /* command */
|
||||
rtems_shell_main_cat , /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include <rtems/shell.h>
|
||||
#include "internal.h"
|
||||
|
||||
shell_alias_t Shell_CD_Alias = {
|
||||
rtems_shell_alias_t rtems_Shell_CD_Alias = {
|
||||
"chdir", /* command */
|
||||
"cd" /* alias */
|
||||
};
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <rtems/shell.h>
|
||||
#include "internal.h"
|
||||
|
||||
int main_chdir (int argc, char *argv[]) {
|
||||
int rtems_shell_main_chdir (int argc, char *argv[]) {
|
||||
char *dir;
|
||||
|
||||
dir = "/";
|
||||
@@ -40,11 +40,11 @@ int main_chdir (int argc, char *argv[]) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
shell_cmd_t Shell_CHDIR_Command = {
|
||||
rtems_shell_cmd_t rtems_Shell_CHDIR_Command = {
|
||||
"chdir", /* name */
|
||||
"chdir [dir] # change the current directory", /* usage */
|
||||
"files", /* topic */
|
||||
main_chdir, /* command */
|
||||
rtems_shell_main_chdir, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
@@ -28,13 +28,13 @@
|
||||
#include <rtems/shell.h>
|
||||
#include "internal.h"
|
||||
|
||||
int main_chmod(int argc,char *argv[])
|
||||
int rtems_shell_main_chmod(int argc,char *argv[])
|
||||
{
|
||||
int n;
|
||||
mode_t mode;
|
||||
|
||||
if (argc > 2){
|
||||
mode = str2int(argv[1])&0777;
|
||||
mode = rtems_shell_str2int(argv[1])&0777;
|
||||
n = 2;
|
||||
while (n<argc)
|
||||
chmod(argv[n++], mode);
|
||||
@@ -42,11 +42,11 @@ int main_chmod(int argc,char *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
shell_cmd_t Shell_CHMOD_Command = {
|
||||
rtems_shell_cmd_t rtems_Shell_CHMOD_Command = {
|
||||
"chmod", /* name */
|
||||
"chmod 0777 n1 n2... # change filemode", /* usage */
|
||||
"files", /* topic */
|
||||
main_chmod, /* command */
|
||||
rtems_shell_main_chmod, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <rtems/shell.h>
|
||||
#include "internal.h"
|
||||
|
||||
int main_chroot(int argc,char * argv[]) {
|
||||
int rtems_shell_main_chroot(int argc,char * argv[]) {
|
||||
char *new_root="/";
|
||||
|
||||
if (argc==2)
|
||||
@@ -39,11 +39,11 @@ int main_chroot(int argc,char * argv[]) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
shell_cmd_t Shell_CHROOT_Command = {
|
||||
rtems_shell_cmd_t rtems_Shell_CHROOT_Command = {
|
||||
"chroot", /* name */
|
||||
"chroot [dir] # change the root directory", /* usage */
|
||||
"files", /* topic */
|
||||
main_chroot, /* command */
|
||||
rtems_shell_main_chroot, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include <rtems/shell.h>
|
||||
#include "internal.h"
|
||||
|
||||
int main_cpuuse(int argc,char *argv[])
|
||||
int rtems_shell_main_cpuuse(int argc,char *argv[])
|
||||
{
|
||||
if ( argc >= 1 && !strcmp( argv[1], "-r" ) ) {
|
||||
printf( "Resetting CPU Usage information\n" );
|
||||
@@ -32,11 +32,11 @@ int main_cpuuse(int argc,char *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
shell_cmd_t Shell_CPUUSE_Command = {
|
||||
rtems_shell_cmd_t rtems_Shell_CPUUSE_Command = {
|
||||
"cpuuse", /* name */
|
||||
"[-r] print or reset per thread cpu usage", /* usage */
|
||||
"rtems", /* topic */
|
||||
main_cpuuse, /* command */
|
||||
rtems_shell_main_cpuuse, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <rtems/shell.h>
|
||||
#include "internal.h"
|
||||
|
||||
int main_date(int argc,char *argv[])
|
||||
int rtems_shell_main_date(int argc,char *argv[])
|
||||
{
|
||||
time_t t;
|
||||
|
||||
@@ -34,11 +34,11 @@ int main_date(int argc,char *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
shell_cmd_t Shell_DATE_Command = {
|
||||
rtems_shell_cmd_t rtems_Shell_DATE_Command = {
|
||||
"date", /* name */
|
||||
"date", /* usage */
|
||||
"misc", /* topic */
|
||||
main_date, /* command */
|
||||
rtems_shell_main_date, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include <rtems/shell.h>
|
||||
#include "internal.h"
|
||||
|
||||
shell_alias_t Shell_DIR_Alias = {
|
||||
rtems_shell_alias_t rtems_Shell_DIR_Alias = {
|
||||
"ls", /* command */
|
||||
"dir" /* alias */
|
||||
};
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include <rtems/shell.h>
|
||||
#include "internal.h"
|
||||
|
||||
shell_alias_t Shell_EXIT_Alias = {
|
||||
rtems_shell_alias_t rtems_Shell_EXIT_Alias = {
|
||||
"logoff", /* command */
|
||||
"exit" /* alias */
|
||||
};
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/*
|
||||
* show the help for one command.
|
||||
*/
|
||||
int shell_help_cmd(shell_cmd_t * shell_cmd) {
|
||||
int rtems_shell_help_cmd(rtems_shell_cmd_t * shell_cmd) {
|
||||
char * pc;
|
||||
int col,line;
|
||||
|
||||
@@ -73,19 +73,19 @@ int shell_help_cmd(shell_cmd_t * shell_cmd) {
|
||||
* Can you see the header of routine? Known?
|
||||
* The same with all the commands....
|
||||
*/
|
||||
int shell_help(
|
||||
int rtems_shell_help(
|
||||
int argc,
|
||||
char * argv[]
|
||||
)
|
||||
{
|
||||
int col,line,arg;
|
||||
shell_topic_t *topic;
|
||||
shell_cmd_t * shell_cmd = shell_first_cmd;
|
||||
rtems_shell_topic_t *topic;
|
||||
rtems_shell_cmd_t * shell_cmd = rtems_shell_first_cmd;
|
||||
|
||||
if (argc<2) {
|
||||
printf("help: ('r' repeat last cmd - 'e' edit last cmd)\n"
|
||||
" TOPIC? The topics are\n");
|
||||
topic = shell_first_topic;
|
||||
topic = rtems_shell_first_topic;
|
||||
col = 0;
|
||||
while (topic) {
|
||||
if (!col){
|
||||
@@ -110,14 +110,14 @@ int shell_help(
|
||||
printf("\n");
|
||||
line = 0;
|
||||
}
|
||||
topic = shell_lookup_topic(argv[arg]);
|
||||
topic = rtems_shell_lookup_topic(argv[arg]);
|
||||
if (!topic){
|
||||
if ((shell_cmd = shell_lookup_cmd(argv[arg])) == NULL) {
|
||||
if ((shell_cmd = rtems_shell_lookup_cmd(argv[arg])) == NULL) {
|
||||
printf("help: topic or cmd '%s' not found. Try <help> alone for a list\n",
|
||||
argv[arg]);
|
||||
line++;
|
||||
} else {
|
||||
line+= shell_help_cmd(shell_cmd);
|
||||
line+= rtems_shell_help_cmd(shell_cmd);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -125,7 +125,7 @@ int shell_help(
|
||||
line++;
|
||||
while (shell_cmd) {
|
||||
if (!strcmp(topic->topic,shell_cmd->topic))
|
||||
line+= shell_help_cmd(shell_cmd);
|
||||
line+= rtems_shell_help_cmd(shell_cmd);
|
||||
if (line>16) {
|
||||
printf("Press any key to continue...");
|
||||
getchar();
|
||||
@@ -139,11 +139,11 @@ int shell_help(
|
||||
return 0;
|
||||
}
|
||||
|
||||
shell_cmd_t Shell_HELP_Command = {
|
||||
rtems_shell_cmd_t rtems_Shell_HELP_Command = {
|
||||
"help", /* name */
|
||||
"help [topic] # list of usage of commands", /* usage */
|
||||
"help", /* topic */
|
||||
shell_help, /* command */
|
||||
rtems_shell_help, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <rtems/shell.h>
|
||||
#include "internal.h"
|
||||
|
||||
int main_id(int argc,char *argv[])
|
||||
int rtems_shell_main_id(int argc,char *argv[])
|
||||
{
|
||||
struct passwd *pwd;
|
||||
struct group *grp;
|
||||
@@ -54,11 +54,11 @@ int main_id(int argc,char *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
shell_cmd_t Shell_ID_Command = {
|
||||
rtems_shell_cmd_t rtems_Shell_ID_Command = {
|
||||
"id", /* name */
|
||||
"show uid, gid, euid, and egid", /* usage */
|
||||
"misc", /* topic */
|
||||
main_id , /* command */
|
||||
rtems_shell_main_id, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
@@ -23,20 +23,20 @@
|
||||
#include "internal.h"
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
int main_logoff(int argc,char *argv[])
|
||||
int rtems_shell_main_logoff(int argc,char *argv[])
|
||||
{
|
||||
printf("logoff from the system...");
|
||||
|
||||
current_shell_env->exit_shell=TRUE;
|
||||
rtems_current_shell_env->exit_shell=TRUE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
shell_cmd_t Shell_LOGOFF_Command = {
|
||||
rtems_shell_cmd_t rtems_Shell_LOGOFF_Command = {
|
||||
"logoff", /* name */
|
||||
"logoff from the system", /* usage */
|
||||
"misc", /* topic */
|
||||
main_logoff, /* command */
|
||||
rtems_shell_main_logoff, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <rtems/shell.h>
|
||||
#include "internal.h"
|
||||
|
||||
int main_ls(int argc, char *argv[])
|
||||
int rtems_shell_main_ls(int argc, char *argv[])
|
||||
{
|
||||
char *fname;
|
||||
DIR *dirp;
|
||||
@@ -98,11 +98,11 @@ int main_ls(int argc, char *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
shell_cmd_t Shell_LS_Command = {
|
||||
rtems_shell_cmd_t rtems_Shell_LS_Command = {
|
||||
"ls", /* name */
|
||||
"ls [dir] # list files in the directory", /* usage */
|
||||
"files", /* topic */
|
||||
main_ls , /* command */
|
||||
rtems_shell_main_ls, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
@@ -21,19 +21,21 @@
|
||||
#include "internal.h"
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
int main_malloc_dump(int argc,char * argv[]) {
|
||||
int rtems_shell_main_malloc_dump(int argc,char * argv[]) {
|
||||
#ifdef MALLOC_STATS /* /rtems/s/src/lib/libc/malloc.c */
|
||||
void malloc_dump(void);
|
||||
malloc_dump();
|
||||
#else
|
||||
fprintf(stdout, "No malloc dump built into RTEMS\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
shell_cmd_t Shell_MALLOC_DUMP_Command = {
|
||||
rtems_shell_cmd_t rtems_Shell_MALLOC_DUMP_Command = {
|
||||
"malloc", /* name */
|
||||
"mem show memory malloc'ed", /* usage */
|
||||
"mem", /* topic */
|
||||
main_malloc_dump, /* command */
|
||||
rtems_shell_main_malloc_dump, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
@@ -28,16 +28,16 @@
|
||||
* RAM MEMORY COMMANDS
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
int main_mdump(int argc,char * argv[]) {
|
||||
int rtems_shell_main_mdump(int argc,char * argv[]) {
|
||||
unsigned char n,m,max=0;
|
||||
uintptr_t addr;
|
||||
unsigned char *pb;
|
||||
|
||||
addr = current_shell_env->mdump_addr;
|
||||
addr = rtems_current_shell_env->mdump_addr;
|
||||
if (argc>1)
|
||||
addr = str2int(argv[1]);
|
||||
addr = rtems_shell_str2int(argv[1]);
|
||||
if (argc>2)
|
||||
max = str2int(argv[2]);
|
||||
max = rtems_shell_str2int(argv[2]);
|
||||
|
||||
max /= 16;
|
||||
|
||||
@@ -45,7 +45,7 @@ int main_mdump(int argc,char * argv[]) {
|
||||
max = 20;
|
||||
|
||||
for (m=0;m<max;m++) {
|
||||
fprintf(stdout,"0x%08X ",addr);
|
||||
fprintf(stdout,"0x%08lX ",addr);
|
||||
pb = (unsigned char*) addr;
|
||||
for (n=0;n<16;n++)
|
||||
fprintf(stdout,"%02X%c",pb[n],n==7?'-':' ');
|
||||
@@ -55,140 +55,16 @@ int main_mdump(int argc,char * argv[]) {
|
||||
fprintf(stdout,"\n");
|
||||
addr += 16;
|
||||
}
|
||||
current_shell_env->mdump_addr = addr;
|
||||
rtems_current_shell_env->mdump_addr = addr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
shell_cmd_t Shell_MDUMP_Command = {
|
||||
rtems_shell_cmd_t rtems_Shell_MDUMP_Command = {
|
||||
"mdump", /* name */
|
||||
"mdump [addr [size]]", /* usage */
|
||||
"mem", /* topic */
|
||||
main_mdump, /* command */
|
||||
rtems_shell_main_mdump, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
int main_mwdump(int argc,char * argv[]) {
|
||||
unsigned char n,m,max=0;
|
||||
int addr=current_shell_env->mdump_addr;
|
||||
unsigned short * pw;
|
||||
|
||||
if (argc>1)
|
||||
addr = str2int(argv[1]);
|
||||
if (argc>2)
|
||||
max = str2int(argv[2]);
|
||||
|
||||
max /= 16;
|
||||
|
||||
if (!max)
|
||||
max = 20;
|
||||
|
||||
for (m=0;m<max;m++) {
|
||||
fprintf(stdout,"0x%08X ",addr);
|
||||
pw = (unsigned short*) addr;
|
||||
for (n=0;n<8;n++)
|
||||
fprintf(stdout,"%02X %02X%c",pw[n]/0x100,pw[n]%0x100,n==3?'-':' ');
|
||||
for (n=0;n<8;n++) {
|
||||
fprintf(stdout,"%c",isprint(pw[n]/0x100)?pw[n]/0x100:'.');
|
||||
fprintf(stdout,"%c",isprint(pw[n]%0x100)?pw[n]%0x100:'.');
|
||||
}
|
||||
fprintf(stdout,"\n");
|
||||
addr += 16;
|
||||
}
|
||||
current_shell_env->mdump_addr = addr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
shell_cmd_t Shell_WDUMP_Command = {
|
||||
"wdump", /* name */
|
||||
"wdump [addr [size]]", /* usage */
|
||||
"mem", /* topic */
|
||||
main_mwdump, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
int main_medit(int argc,char * argv[]) {
|
||||
unsigned char * pb;
|
||||
int n,i;
|
||||
|
||||
if (argc<3) {
|
||||
fprintf(stdout,"too few arguments\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
pb = (unsigned char*)str2int(argv[1]);
|
||||
i = 2;
|
||||
n = 0;
|
||||
while (i<=argc) {
|
||||
pb[n++] = str2int(argv[i++])%0x100;
|
||||
}
|
||||
current_shell_env->mdump_addr = (int)pb;
|
||||
return main_mdump(0,NULL);
|
||||
}
|
||||
|
||||
shell_cmd_t Shell_MEDIT_Command = {
|
||||
"medit", /* name */
|
||||
"medit addr value [value ...]", /* usage */
|
||||
"mem", /* topic */
|
||||
main_medit, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
int main_mfill(int argc,char * argv[]) {
|
||||
int addr;
|
||||
int size;
|
||||
unsigned char value;
|
||||
|
||||
if (argc<4) {
|
||||
fprintf(stdout,"too few arguments\n");
|
||||
return 0;
|
||||
}
|
||||
addr = str2int(argv[1]);
|
||||
size = str2int(argv[2]);
|
||||
value= str2int(argv[3]) % 0x100;
|
||||
memset((unsigned char*)addr,size,value);
|
||||
current_shell_env->mdump_addr = addr;
|
||||
return main_mdump(0,NULL);
|
||||
}
|
||||
|
||||
shell_cmd_t Shell_MFILL_Command = {
|
||||
"mfill", /* name */
|
||||
"mfill addr size value", /* usage */
|
||||
"mem", /* topic */
|
||||
main_mfill, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
int main_mmove(int argc,char * argv[]) {
|
||||
int src;
|
||||
int dst;
|
||||
int size;
|
||||
|
||||
if (argc<4) {
|
||||
fprintf(stdout,"too few arguments\n");
|
||||
return 0;
|
||||
}
|
||||
dst = str2int(argv[1]);
|
||||
src = str2int(argv[2]);
|
||||
size = str2int(argv[3]);
|
||||
memcpy((unsigned char*)dst,(unsigned char*)src,size);
|
||||
current_shell_env->mdump_addr = dst;
|
||||
return main_mdump(0,NULL);
|
||||
}
|
||||
|
||||
shell_cmd_t Shell_MMOVE_Command = {
|
||||
"mmove", /* name */
|
||||
"mmove dst src size", /* usage */
|
||||
"mem", /* topic */
|
||||
main_mmove, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
@@ -24,9 +24,9 @@
|
||||
#include <rtems/shell.h>
|
||||
#include "internal.h"
|
||||
|
||||
extern int main_mdump(int, char *);
|
||||
extern int rtems_shell_main_mdump(int, char *);
|
||||
|
||||
int main_medit(int argc,char * argv[]) {
|
||||
int rtems_shell_main_medit(int argc,char * argv[]) {
|
||||
unsigned char * pb;
|
||||
int n,i;
|
||||
|
||||
@@ -35,22 +35,22 @@ int main_medit(int argc,char * argv[]) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
pb = (unsigned char*)str2int(argv[1]);
|
||||
pb = (unsigned char*)rtems_shell_str2int(argv[1]);
|
||||
i = 2;
|
||||
n = 0;
|
||||
while (i<=argc) {
|
||||
pb[n++] = str2int(argv[i++])%0x100;
|
||||
pb[n++] = rtems_shell_str2int(argv[i++])%0x100;
|
||||
}
|
||||
current_shell_env->mdump_addr = (int)pb;
|
||||
rtems_current_shell_env->mdump_addr = (int)pb;
|
||||
|
||||
return main_mdump(0,NULL);
|
||||
return rtems_shell_main_mdump(0,NULL);
|
||||
}
|
||||
|
||||
shell_cmd_t Shell_MEDIT_Command = {
|
||||
rtems_shell_cmd_t rtems_Shell_MEDIT_Command = {
|
||||
"medit", /* name */
|
||||
"medit addr value [value ...]", /* usage */
|
||||
"mem", /* topic */
|
||||
main_medit, /* command */
|
||||
rtems_shell_main_medit, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
@@ -24,9 +24,9 @@
|
||||
#include <rtems/shell.h>
|
||||
#include "internal.h"
|
||||
|
||||
extern int main_mdump(int, char *);
|
||||
extern int rtems_shell_main_mdump(int, char *);
|
||||
|
||||
int main_mfill(int argc,char * argv[]) {
|
||||
int rtems_shell_main_mfill(int argc,char * argv[]) {
|
||||
uintptr_t addr;
|
||||
size_t size;
|
||||
unsigned char value;
|
||||
@@ -36,20 +36,20 @@ int main_mfill(int argc,char * argv[]) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
addr = str2int(argv[1]);
|
||||
size = str2int(argv[2]);
|
||||
value= str2int(argv[3]) % 0x100;
|
||||
addr = rtems_shell_str2int(argv[1]);
|
||||
size = rtems_shell_str2int(argv[2]);
|
||||
value= rtems_shell_str2int(argv[3]) % 0x100;
|
||||
memset((unsigned char*)addr,size,value);
|
||||
current_shell_env->mdump_addr = addr;
|
||||
rtems_current_shell_env->mdump_addr = addr;
|
||||
|
||||
return main_mdump(0,NULL);
|
||||
return rtems_shell_main_mdump(0,NULL);
|
||||
}
|
||||
|
||||
shell_cmd_t Shell_MFILL_Command = {
|
||||
rtems_shell_cmd_t rtems_Shell_MFILL_Command = {
|
||||
"mfill", /* name */
|
||||
"mfill addr size value", /* usage */
|
||||
"mem", /* topic */
|
||||
main_mfill, /* command */
|
||||
rtems_shell_main_mfill, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <rtems/shell.h>
|
||||
#include "internal.h"
|
||||
|
||||
int main_mkdir(int argc, char *argv[]) {
|
||||
int rtems_shell_main_mkdir(int argc, char *argv[]) {
|
||||
char *dir;
|
||||
|
||||
int n;
|
||||
@@ -41,11 +41,11 @@ int main_mkdir(int argc, char *argv[]) {
|
||||
return errno;
|
||||
}
|
||||
|
||||
shell_cmd_t Shell_MKDIR_Command = {
|
||||
rtems_shell_cmd_t rtems_Shell_MKDIR_Command = {
|
||||
"mkdir", /* name */
|
||||
"mkdir dir # make a directory", /* usage */
|
||||
"files", /* topic */
|
||||
main_mkdir, /* command */
|
||||
rtems_shell_main_mkdir, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
@@ -24,9 +24,9 @@
|
||||
#include <rtems/shell.h>
|
||||
#include "internal.h"
|
||||
|
||||
extern int main_mdump(int, char *);
|
||||
extern int rtems_shell_main_mdump(int, char *);
|
||||
|
||||
int main_mmove(int argc,char * argv[]) {
|
||||
int rtems_shell_main_mmove(int argc,char * argv[]) {
|
||||
uintptr_t src;
|
||||
uintptr_t dst;
|
||||
size_t size;
|
||||
@@ -36,20 +36,20 @@ int main_mmove(int argc,char * argv[]) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
dst = str2int(argv[1]);
|
||||
src = str2int(argv[2]);
|
||||
size = str2int(argv[3]);
|
||||
dst = rtems_shell_str2int(argv[1]);
|
||||
src = rtems_shell_str2int(argv[2]);
|
||||
size = rtems_shell_str2int(argv[3]);
|
||||
memcpy((unsigned char*)dst, (unsigned char*)src, size);
|
||||
current_shell_env->mdump_addr = dst;
|
||||
rtems_current_shell_env->mdump_addr = dst;
|
||||
|
||||
return main_mdump(0,NULL);
|
||||
return rtems_shell_main_mdump(0,NULL);
|
||||
}
|
||||
|
||||
shell_cmd_t Shell_MMOVE_Command = {
|
||||
rtems_shell_cmd_t rtems_Shell_MMOVE_Command = {
|
||||
"mmove", /* name */
|
||||
"mmove dst src size", /* usage */
|
||||
"mem", /* topic */
|
||||
main_mmove, /* command */
|
||||
rtems_shell_main_mmove, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
* Shell Command Implmentation
|
||||
*
|
||||
* Author: Fernando RUIZ CASAS
|
||||
* Work: fernando.ruiz@ctv.es
|
||||
* Home: correo@fernando-ruiz.com
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <rtems.h>
|
||||
#include <rtems/shell.h>
|
||||
#include <rtems/shellconfig.h>
|
||||
#include <rtems/dosfs.h>
|
||||
#include <rtems/fsmount.h>
|
||||
#include "internal.h"
|
||||
|
||||
int rtems_shell_libc_mounter(const char* driver,
|
||||
const char* path,
|
||||
rtems_shell_filesystems_t* fs,
|
||||
rtems_filesystem_options_t options)
|
||||
{
|
||||
rtems_filesystem_mount_table_entry_t* mt_entry;
|
||||
/*
|
||||
* Mount the disk.
|
||||
*/
|
||||
|
||||
if (mount (&mt_entry, fs->fs_ops, options, (char*) driver, (char*) path) < 0)
|
||||
{
|
||||
printf ("error: mount failed: %s\n", strerror (errno));
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define NUMOF(_i) (sizeof (_i) / sizeof (_i[0]))
|
||||
|
||||
int rtems_shell_main_mount(int argc, char *argv[])
|
||||
{
|
||||
rtems_filesystem_options_t options = RTEMS_FILESYSTEM_READ_WRITE;
|
||||
rtems_shell_filesystems_t* fs = NULL;
|
||||
char* driver = NULL;
|
||||
char* mount_point = NULL;
|
||||
int arg;
|
||||
|
||||
for (arg = 1; arg < argc; arg++)
|
||||
{
|
||||
if (argv[arg][0] == '-')
|
||||
{
|
||||
if (argv[arg][1] == 't')
|
||||
{
|
||||
rtems_shell_filesystems_t** a;
|
||||
|
||||
arg++;
|
||||
if (arg == argc)
|
||||
{
|
||||
fprintf (stdout, "error: -t needs a type of file-system;; see -L.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (a = rtems_Shell_Mount_filesystems; *a; a++)
|
||||
{
|
||||
if (strcmp (argv[arg], (*a)->name) == 0)
|
||||
{
|
||||
fs = *a;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (argv[arg][1] == 'r')
|
||||
{
|
||||
options = RTEMS_FILESYSTEM_READ_ONLY;
|
||||
}
|
||||
else if (argv[arg][1] == 'L')
|
||||
{
|
||||
rtems_shell_filesystems_t** a;
|
||||
fprintf (stdout, "File systems: ");
|
||||
for (a = rtems_Shell_Mount_filesystems; *a; a++)
|
||||
if (*a)
|
||||
fprintf (stdout, "%s ", (*a)->name);
|
||||
fprintf (stdout, "\n");
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (stdout, "unknown option: %s\n", argv[arg]);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!driver)
|
||||
driver = argv[arg];
|
||||
else if (!mount_point)
|
||||
mount_point = argv[arg];
|
||||
else
|
||||
{
|
||||
printf ("error: driver and mount only require: %s\n", argv[arg]);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fs == NULL)
|
||||
{
|
||||
fprintf (stdout, "error: no file-system; see the -L option\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (fs->driver_needed && !driver)
|
||||
{
|
||||
fprintf (stdout, "error: no driver\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!mount_point)
|
||||
{
|
||||
printf ("error: no mount point\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Mount the disk.
|
||||
*/
|
||||
|
||||
if (fs->mounter (driver, mount_point, fs, options))
|
||||
return 1;
|
||||
|
||||
printf ("mounted %s -> %s\n", driver, mount_point);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
rtems_shell_cmd_t rtems_Shell_MOUNT_Command = {
|
||||
"mount", /* name */
|
||||
"mount [-t fstype] [-r] [-L] device path # mount disk", /* usage */
|
||||
"files", /* topic */
|
||||
rtems_shell_main_mount, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Shell Command Implmentation
|
||||
*
|
||||
* Author: Fernando RUIZ CASAS
|
||||
* Work: fernando.ruiz@ctv.es
|
||||
* Home: correo@fernando-ruiz.com
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <rtems.h>
|
||||
#include <rtems/shell.h>
|
||||
#include <rtems/dosfs.h>
|
||||
#include <rtems/fsmount.h>
|
||||
#include "internal.h"
|
||||
|
||||
#include <rtems/ftpfs.h>
|
||||
|
||||
rtems_shell_filesystems_t rtems_Shell_Mount_FTP = {
|
||||
name: "ftp",
|
||||
driver_needed: 1,
|
||||
fs_ops: &rtems_ftp_ops,
|
||||
mounter: rtems_shell_libc_mounter
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Shell Command Implmentation
|
||||
*
|
||||
* Author: Fernando RUIZ CASAS
|
||||
* Work: fernando.ruiz@ctv.es
|
||||
* Home: correo@fernando-ruiz.com
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <rtems.h>
|
||||
#include <rtems/shell.h>
|
||||
#include <rtems/dosfs.h>
|
||||
#include <rtems/fsmount.h>
|
||||
#include "internal.h"
|
||||
|
||||
rtems_shell_filesystems_t rtems_Shell_Mount_MSDOS = {
|
||||
name: "msdos",
|
||||
driver_needed: 1,
|
||||
fs_ops: &msdos_ops,
|
||||
mounter: rtems_shell_libc_mounter
|
||||
};
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Shell Command Implmentation
|
||||
*
|
||||
* Author: Fernando RUIZ CASAS
|
||||
* Work: fernando.ruiz@ctv.es
|
||||
* Home: correo@fernando-ruiz.com
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <rtems.h>
|
||||
#include <rtems/shell.h>
|
||||
#include "internal.h"
|
||||
|
||||
#include <librtemsNfs.h>
|
||||
|
||||
static int
|
||||
rtems_shell_nfs_mounter (const char* device,
|
||||
const char* mntpoint,
|
||||
rtems_shell_filesystems_t* fs,
|
||||
rtems_filesystem_options_t options)
|
||||
{
|
||||
char* uidhost;
|
||||
char* path;
|
||||
int ret;
|
||||
|
||||
if (strchr (device, ':') == NULL)
|
||||
{
|
||||
fprintf (stdout, "error: nfs mount device is [uid.gid@]host:path\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
uidhost = strdup (device);
|
||||
path = strchr (uidhost, ':');
|
||||
*path = '\0';
|
||||
path++;
|
||||
|
||||
ret = nfsMount(uidhost, path, (char*) mntpoint);
|
||||
|
||||
free (uidhost);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
rtems_shell_filesystems_t rtems_Shell_Mount_NFS = {
|
||||
name: "ftp",
|
||||
driver_needed: 1,
|
||||
fs_ops: NULL,
|
||||
mounter: rtems_shell_nfs_mounter
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Shell Command Implmentation
|
||||
*
|
||||
* Author: Fernando RUIZ CASAS
|
||||
* Work: fernando.ruiz@ctv.es
|
||||
* Home: correo@fernando-ruiz.com
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <rtems.h>
|
||||
#include <rtems/shell.h>
|
||||
#include <rtems/fsmount.h>
|
||||
#include "internal.h"
|
||||
|
||||
#include <rtems/ftpfs.h>
|
||||
#include <rtems/tftp.h>
|
||||
|
||||
rtems_shell_filesystems_t rtems_Shell_Mount_TFTP = {
|
||||
name: "tftp",
|
||||
driver_needed: 0,
|
||||
fs_ops: &rtems_tftp_ops,
|
||||
mounter: rtems_shell_libc_mounter
|
||||
};
|
||||
@@ -24,15 +24,15 @@
|
||||
#include <rtems/shell.h>
|
||||
#include "internal.h"
|
||||
|
||||
int main_mwdump(int argc,char * argv[]) {
|
||||
int rtems_shell_main_mwdump(int argc,char * argv[]) {
|
||||
unsigned char n,m,max=0;
|
||||
int addr=current_shell_env->mdump_addr;
|
||||
int addr=rtems_current_shell_env->mdump_addr;
|
||||
unsigned short * pw;
|
||||
|
||||
if (argc>1)
|
||||
addr = str2int(argv[1]);
|
||||
addr = rtems_shell_str2int(argv[1]);
|
||||
if (argc>2)
|
||||
max = str2int(argv[2]);
|
||||
max = rtems_shell_str2int(argv[2]);
|
||||
|
||||
max /= 16;
|
||||
|
||||
@@ -51,15 +51,15 @@ int main_mwdump(int argc,char * argv[]) {
|
||||
fprintf(stdout,"\n");
|
||||
addr += 16;
|
||||
}
|
||||
current_shell_env->mdump_addr = addr;
|
||||
rtems_current_shell_env->mdump_addr = addr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
shell_cmd_t Shell_WDUMP_Command = {
|
||||
rtems_shell_cmd_t rtems_Shell_WDUMP_Command = {
|
||||
"wdump", /* name */
|
||||
"wdump [addr [size]]", /* usage */
|
||||
"mem", /* topic */
|
||||
main_mwdump, /* command */
|
||||
rtems_shell_main_mwdump, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <rtems/shell.h>
|
||||
#include "internal.h"
|
||||
|
||||
int main_pwd (int argc, char *argv[]) {
|
||||
int rtems_shell_main_pwd (int argc, char *argv[]) {
|
||||
char dir[1024];
|
||||
|
||||
getcwd(dir,1024);
|
||||
@@ -31,11 +31,11 @@ int main_pwd (int argc, char *argv[]) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
shell_cmd_t Shell_PWD_Command = {
|
||||
rtems_shell_cmd_t rtems_Shell_PWD_Command = {
|
||||
"pwd", /* name */
|
||||
"pwd # print work directory", /* usage */
|
||||
"files", /* topic */
|
||||
main_pwd , /* command */
|
||||
rtems_shell_main_pwd, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <rtems/shell.h>
|
||||
#include "internal.h"
|
||||
|
||||
int main_rm(int argc, char *argv[])
|
||||
int rtems_shell_main_rm(int argc, char *argv[])
|
||||
{
|
||||
int n;
|
||||
n = 1;
|
||||
@@ -40,11 +40,11 @@ int main_rm(int argc, char *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
shell_cmd_t Shell_RM_Command = {
|
||||
rtems_shell_cmd_t rtems_Shell_RM_Command = {
|
||||
"rm", /* name */
|
||||
"rm n1 [n2 [n3...]] # remove files", /* usage */
|
||||
"files", /* topic */
|
||||
main_rm, /* command */
|
||||
rtems_shell_main_rm, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <rtems/shell.h>
|
||||
#include "internal.h"
|
||||
|
||||
int main_rmdir (int argc, char *argv[])
|
||||
int rtems_shell_main_rmdir (int argc, char *argv[])
|
||||
{
|
||||
char *dir;
|
||||
int n;
|
||||
@@ -39,11 +39,11 @@ int main_rmdir (int argc, char *argv[])
|
||||
return errno;
|
||||
}
|
||||
|
||||
shell_cmd_t Shell_RMDIR_Command = {
|
||||
rtems_shell_cmd_t rtems_Shell_RMDIR_Command = {
|
||||
"rmdir", /* name */
|
||||
"rmdir dir # remove directory", /* usage */
|
||||
"files", /* topic */
|
||||
main_rmdir, /* command */
|
||||
rtems_shell_main_rmdir, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include <rtems/shell.h>
|
||||
#include "internal.h"
|
||||
|
||||
int main_stackuse(int argc,char *argv[])
|
||||
int rtems_shell_main_stackuse(int argc,char *argv[])
|
||||
{
|
||||
rtems_stack_checker_report_usage_with_plugin(
|
||||
stdout,
|
||||
@@ -31,11 +31,11 @@ int main_stackuse(int argc,char *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
shell_cmd_t Shell_STACKUSE_Command = {
|
||||
rtems_shell_cmd_t rtems_Shell_STACKUSE_Command = {
|
||||
"stackuse", /* name */
|
||||
"print per thread stack usage", /* usage */
|
||||
"rtems", /* topic */
|
||||
main_stackuse, /* command */
|
||||
rtems_shell_main_stackuse, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
@@ -26,17 +26,17 @@
|
||||
#include <rtems/shell.h>
|
||||
#include "internal.h"
|
||||
|
||||
int main_tty(int argc,char *argv[])
|
||||
int rtems_shell_main_tty(int argc,char *argv[])
|
||||
{
|
||||
printf("%s\n",ttyname(fileno(stdin)));
|
||||
return 0;
|
||||
}
|
||||
|
||||
shell_cmd_t Shell_TTY_Command = {
|
||||
rtems_shell_cmd_t rtems_Shell_TTY_Command = {
|
||||
"tty", /* name */
|
||||
"show ttyname", /* usage */
|
||||
"misc", /* topic */
|
||||
main_tty , /* command */
|
||||
rtems_shell_main_tty, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
@@ -28,12 +28,12 @@
|
||||
#include <rtems/shell.h>
|
||||
#include "internal.h"
|
||||
|
||||
int main_umask(int argc,char *argv[])
|
||||
int rtems_shell_main_umask(int argc,char *argv[])
|
||||
{
|
||||
mode_t msk = umask(0);
|
||||
|
||||
if (argc == 2)
|
||||
msk = str2int(argv[1]);
|
||||
msk = rtems_shell_str2int(argv[1]);
|
||||
umask(msk);
|
||||
|
||||
msk = umask(0);
|
||||
@@ -42,11 +42,11 @@ int main_umask(int argc,char *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
shell_cmd_t Shell_UMASK_Command = {
|
||||
rtems_shell_cmd_t rtems_Shell_UMASK_Command = {
|
||||
"umask", /* name */
|
||||
"umask [new_umask]", /* usage */
|
||||
"misc", /* topic */
|
||||
main_umask , /* command */
|
||||
rtems_shell_main_umask, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <rtems/shell.h>
|
||||
#include "internal.h"
|
||||
|
||||
int main_whoami(int argc,char *argv[])
|
||||
int rtems_shell_main_whoami(int argc,char *argv[])
|
||||
{
|
||||
struct passwd *pwd;
|
||||
|
||||
@@ -36,11 +36,11 @@ int main_whoami(int argc,char *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
shell_cmd_t Shell_WHOAMI_Command = {
|
||||
rtems_shell_cmd_t rtems_Shell_WHOAMI_Command = {
|
||||
"whoami", /* name */
|
||||
"show current user", /* usage */
|
||||
"misc", /* topic */
|
||||
main_whoami, /* command */
|
||||
rtems_shell_main_whoami, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -11,69 +11,71 @@
|
||||
* HOME: correo@fernando-ruiz.com
|
||||
*
|
||||
* Thanks at:
|
||||
* Chris John
|
||||
* Chris Johns
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_H__
|
||||
#define __SHELL_H__
|
||||
#ifndef __RTEMS_SHELL_H__
|
||||
#define __RTEMS_SHELL_H__
|
||||
|
||||
#include <rtems.h>
|
||||
#include <stdio.h>
|
||||
#include <termios.h>
|
||||
#include <rtems/fs.h>
|
||||
#include <rtems/libio.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef int (*shell_command_t)(int argc,char * argv[]);
|
||||
typedef int (*rtems_shell_command_t)(int argc,char * argv[]);
|
||||
|
||||
struct shell_cmd_tt;
|
||||
typedef struct shell_cmd_tt shell_cmd_t;
|
||||
struct rtems_shell_cmd_tt;
|
||||
typedef struct rtems_shell_cmd_tt rtems_shell_cmd_t;
|
||||
|
||||
struct shell_cmd_tt {
|
||||
char *name;
|
||||
char *usage;
|
||||
char *topic;
|
||||
shell_command_t command;
|
||||
shell_cmd_t *alias;
|
||||
shell_cmd_t *next;
|
||||
struct rtems_shell_cmd_tt {
|
||||
char *name;
|
||||
char *usage;
|
||||
char *topic;
|
||||
rtems_shell_command_t command;
|
||||
rtems_shell_cmd_t *alias;
|
||||
rtems_shell_cmd_t *next;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
char *alias;
|
||||
} shell_alias_t;
|
||||
} rtems_shell_alias_t;
|
||||
|
||||
shell_cmd_t * shell_lookup_cmd(char * cmd);
|
||||
rtems_shell_cmd_t * rtems_shell_lookup_cmd(char * cmd);
|
||||
|
||||
shell_cmd_t *shell_add_cmd_struct(
|
||||
shell_cmd_t *shell_cmd
|
||||
rtems_shell_cmd_t *rtems_shell_add_cmd_struct(
|
||||
rtems_shell_cmd_t *shell_cmd
|
||||
);
|
||||
|
||||
shell_cmd_t * shell_add_cmd(
|
||||
char *cmd,
|
||||
char *topic,
|
||||
char *usage,
|
||||
shell_command_t command
|
||||
rtems_shell_cmd_t * rtems_shell_add_cmd(
|
||||
char *cmd,
|
||||
char *topic,
|
||||
char *usage,
|
||||
rtems_shell_command_t command
|
||||
);
|
||||
|
||||
shell_cmd_t * shell_alias_cmd(
|
||||
rtems_shell_cmd_t * rtems_shell_alias_cmd(
|
||||
char *cmd,
|
||||
char *alias
|
||||
);
|
||||
|
||||
int shell_make_args(
|
||||
int rtems_shell_make_args(
|
||||
char *commandLine,
|
||||
int *argc_p,
|
||||
char **argv_p,
|
||||
int max_args
|
||||
);
|
||||
|
||||
int shell_scanline(char * line,int size,FILE * in,FILE * out) ;
|
||||
void cat_file(FILE * out,char *name);
|
||||
void write_file(char *name,char * content);
|
||||
int rtems_shell_scanline(char * line,int size,FILE * in,FILE * out) ;
|
||||
void rtems_shell_cat_file(FILE * out,char *name);
|
||||
void rtems_shell_write_file(char *name,char * content);
|
||||
|
||||
/**
|
||||
* Initialise the shell creating tasks to login and run the shell
|
||||
@@ -90,7 +92,7 @@ void write_file(char *name,char * content);
|
||||
* needs to adjust the termios for its use but it should assume the
|
||||
* settings are set by the user for things like baudrate etc.
|
||||
*/
|
||||
rtems_status_code shell_init(
|
||||
rtems_status_code rtems_shell_init(
|
||||
char *task_name,
|
||||
uint32_t task_stacksize, /*0 default*/
|
||||
rtems_task_priority task_priority,
|
||||
@@ -103,7 +105,7 @@ rtems_status_code shell_init(
|
||||
* Things that are useful to external entities developing commands and plugging
|
||||
* them in.
|
||||
*/
|
||||
int str2int(char * s);
|
||||
int rtems_shell_str2int(char * s);
|
||||
|
||||
typedef struct {
|
||||
rtems_name magic; /* 'S','E','N','V': Shell Environment */
|
||||
@@ -115,14 +117,36 @@ typedef struct {
|
||||
int forever ; /* repeat login */
|
||||
int errorlevel;
|
||||
uintptr_t mdump_addr;
|
||||
} shell_env_t;
|
||||
} rtems_shell_env_t;
|
||||
|
||||
rtems_boolean shell_shell_loop(
|
||||
shell_env_t *shell_env
|
||||
rtems_boolean rtems_shell_shell_loop(
|
||||
rtems_shell_env_t *rtems_shell_env
|
||||
);
|
||||
|
||||
extern shell_env_t global_shell_env;
|
||||
extern shell_env_t *current_shell_env;
|
||||
extern rtems_shell_env_t rtems_global_shell_env;
|
||||
extern rtems_shell_env_t *rtems_current_shell_env;
|
||||
|
||||
/*
|
||||
* The types of file systems we can mount. We have them broken out
|
||||
* out like this so they can be configured by shellconfig.h. The
|
||||
* mount command needs special treatment due to some file systems
|
||||
* being dependent on the network stack and some not. If we had
|
||||
* all possible file systems being included it would force the
|
||||
* networking stack into the applcation and this may not be
|
||||
* required.
|
||||
*/
|
||||
struct rtems_shell_filesystems_tt;
|
||||
typedef struct rtems_shell_filesystems_tt rtems_shell_filesystems_t;
|
||||
typedef int (*rtems_shell_filesystems_mounter_t)(const char* driver,
|
||||
const char* path,
|
||||
rtems_shell_filesystems_t* fs,
|
||||
rtems_filesystem_options_t options);
|
||||
struct rtems_shell_filesystems_tt {
|
||||
const char* name;
|
||||
int driver_needed;
|
||||
rtems_filesystem_operations_table* fs_ops;
|
||||
rtems_shell_filesystems_mounter_t mounter;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -17,7 +17,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
int shell_make_args(
|
||||
int rtems_shell_make_args(
|
||||
char *commandLine,
|
||||
int *argc_p,
|
||||
char **argv_p,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
* str to int "0xaffe" "0b010010" "0123" "192939"
|
||||
*/
|
||||
int str2int(char * s) {
|
||||
int rtems_shell_str2int(char * s) {
|
||||
int sign=1;
|
||||
int base=10;
|
||||
int value=0;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
void write_file(
|
||||
void rtems_shell_write_file(
|
||||
char *name,
|
||||
char * content
|
||||
)
|
||||
|
||||
@@ -27,9 +27,14 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/libio.h>
|
||||
|
||||
/* create mount point and mount ftp file system */
|
||||
int rtems_bsdnet_initialize_ftp_filesystem () ;
|
||||
|
||||
/* FTP File sysem operations table. */
|
||||
extern rtems_filesystem_operations_table rtems_ftp_ops;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -30,12 +30,20 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/libio.h>
|
||||
|
||||
/*
|
||||
* Filesystem initialization routine
|
||||
*/
|
||||
|
||||
int rtems_bsdnet_initialize_tftp_filesystem( void );
|
||||
|
||||
/*
|
||||
* TFTP file system operations table.
|
||||
*/
|
||||
|
||||
extern rtems_filesystem_operations_table rtems_tftp_ops;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user