shell: Add an md5 hash command for files.

This command lets you get an MD5 hash for a file in an RTEMS file system.
This commit is contained in:
Chris Johns
2014-09-15 09:10:45 +10:00
parent ebf9a057b5
commit b299960aed
4 changed files with 258 additions and 70 deletions

View File

@@ -85,9 +85,9 @@ libshell_a_SOURCES = shell/cat_file.c shell/cmds.c shell/internal.h \
shell/main_cp.c shell/main_cpuuse.c shell/main_date.c shell/main_dir.c \ shell/main_cp.c shell/main_cpuuse.c shell/main_date.c shell/main_dir.c \
shell/main_echo.c shell/main_exit.c shell/main_halt.c shell/main_help.c \ shell/main_echo.c shell/main_exit.c shell/main_halt.c shell/main_help.c \
shell/main_id.c shell/main_logoff.c shell/main_ln.c shell/main_ls.c \ shell/main_id.c shell/main_logoff.c shell/main_ln.c shell/main_ls.c \
shell/main_mallocinfo.c shell/main_mdump.c shell/main_medit.c \ shell/main_mallocinfo.c shell/main_md5.c shell/main_mdump.c \
shell/main_mfill.c shell/main_mkdir.c shell/main_mount.c \ shell/main_medit.c shell/main_mfill.c shell/main_mkdir.c \
shell/main_mmove.c shell/main_msdosfmt.c \ shell/main_mount.c shell/main_mmove.c shell/main_msdosfmt.c \
shell/main_mv.c shell/main_perioduse.c shell/main_ping.c \ shell/main_mv.c shell/main_perioduse.c shell/main_ping.c \
shell/main_pwd.c shell/main_rm.c shell/main_rmdir.c shell/main_sleep.c \ shell/main_pwd.c shell/main_rm.c shell/main_rmdir.c shell/main_sleep.c \
shell/main_stackuse.c shell/main_tty.c shell/main_umask.c \ shell/main_stackuse.c shell/main_tty.c shell/main_umask.c \

View File

@@ -0,0 +1,110 @@
/*
* MD5 Shell Command Implmentation
*
* 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.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <rtems.h>
#include <rtems/shell.h>
#include <md5.h>
#define BUFFER_SIZE (4 * 1024)
static int rtems_shell_main_md5(
int argc,
char *argv[])
{
uint8_t* buffer;
uint8_t hash[16];
size_t h;
buffer = malloc(BUFFER_SIZE);
if (!buffer)
{
printf("error: no memory\n");
return 1;
}
--argc;
++argv;
while (argc)
{
struct stat sb;
MD5_CTX md5;
int in;
if (stat(*argv, &sb) < 0)
{
free(buffer);
printf("error: stat of %s: %s\n", *argv, strerror(errno));
return 1;
}
in = open(*argv, O_RDONLY);
if (in < 0)
{
free(buffer);
printf("error: opening %s: %s\n", *argv, strerror(errno));
return 1;
}
MD5Init(&md5);
while (sb.st_size)
{
ssize_t size = sb.st_size > BUFFER_SIZE ? BUFFER_SIZE : sb.st_size;
if (read(in, buffer, size) != size)
{
close(in);
free(buffer);
printf("error: reading %s: %s\n", *argv, strerror(errno));
return 1;
}
MD5Update(&md5, buffer, size);
sb.st_size -= size;
}
MD5Final(hash, &md5);
close(in);
printf("MD5 (%s) = ", *argv);
for (h = 0; h < sizeof(hash); ++h)
printf("%02x", (int) hash[h]);
printf("\n");
--argc;
++argv;
}
free(buffer);
return 0;
}
rtems_shell_cmd_t rtems_shell_MD5_Command = {
"md5", /* name */
"md5 [file ...]", /* usage */
"files", /* topic */
rtems_shell_main_md5, /* command */
NULL, /* alias */
NULL /* next */
};

View File

@@ -71,6 +71,7 @@ extern rtems_shell_cmd_t rtems_shell_DD_Command;
extern rtems_shell_cmd_t rtems_shell_HEXDUMP_Command; extern rtems_shell_cmd_t rtems_shell_HEXDUMP_Command;
extern rtems_shell_cmd_t rtems_shell_DEBUGRFS_Command; extern rtems_shell_cmd_t rtems_shell_DEBUGRFS_Command;
extern rtems_shell_cmd_t rtems_shell_DF_Command; extern rtems_shell_cmd_t rtems_shell_DF_Command;
extern rtems_shell_cmd_t rtems_shell_MD5_Command;
extern rtems_shell_cmd_t rtems_shell_RTC_Command; extern rtems_shell_cmd_t rtems_shell_RTC_Command;
@@ -382,6 +383,11 @@ extern rtems_shell_alias_t *rtems_shell_Initial_aliases[];
defined(CONFIGURE_SHELL_COMMAND_DF) defined(CONFIGURE_SHELL_COMMAND_DF)
&rtems_shell_DF_Command, &rtems_shell_DF_Command,
#endif #endif
#if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \
!defined(CONFIGURE_SHELL_NO_COMMAND_MD5)) || \
defined(CONFIGURE_SHELL_COMMAND_MD5)
&rtems_shell_MD5_Command,
#endif
/* /*
* RTEMS Related commands * RTEMS Related commands

View File

@@ -36,6 +36,7 @@ The RTEMS shell has the following file and directory commands:
@item @code{mkrfs} - format RFS file system @item @code{mkrfs} - format RFS file system
@item @code{cd} - alias for chdir @item @code{cd} - alias for chdir
@item @code{df} - display file system disk space usage @item @code{df} - display file system disk space usage
@item @code{md5} - display file system disk space usage
@end itemize @end itemize
@@ -91,7 +92,7 @@ SHLL [/] $ umask
@findex CONFIGURE_SHELL_NO_COMMAND_UMASK @findex CONFIGURE_SHELL_NO_COMMAND_UMASK
@findex CONFIGURE_SHELL_COMMAND_UMASK @findex CONFIGURE_SHELL_COMMAND_UMASK
This command is included in the default shell command set. This command is included in the default shell command set.
When building a custom command set, define When building a custom command set, define
@code{CONFIGURE_SHELL_COMMAND_UMASK} to have this @code{CONFIGURE_SHELL_COMMAND_UMASK} to have this
command included. command included.
@@ -246,7 +247,7 @@ tty:!:2:2:tty owner::/:/bin/false
SHLL [/] # ls SHLL [/] # ls
drwxr-xr-x 1 root root 536 Jan 01 00:00 dev/ drwxr-xr-x 1 root root 536 Jan 01 00:00 dev/
drwxr-xr-x 1 root root 1072 Jan 01 00:00 etc/ drwxr-xr-x 1 root root 1072 Jan 01 00:00 etc/
-rw-r--r-- 1 root root 102 Jan 01 00:00 joel -rw-r--r-- 1 root root 102 Jan 01 00:00 joel
3 files 1710 bytes occupied 3 files 1710 bytes occupied
@end example @end example
@@ -256,18 +257,18 @@ use the same @code{basename} in the destination directory:
@example @example
SHLL [/] # mkdir tmp SHLL [/] # mkdir tmp
SHLL [/] # ls tmp SHLL [/] # ls tmp
0 files 0 bytes occupied 0 files 0 bytes occupied
SHLL [/] # cp /etc/passwd tmp SHLL [/] # cp /etc/passwd tmp
SHLL [/] # ls /tmp SHLL [/] # ls /tmp
-rw-r--r-- 1 root root 102 Jan 01 00:01 passwd -rw-r--r-- 1 root root 102 Jan 01 00:01 passwd
1 files 102 bytes occupied 1 files 102 bytes occupied
SHLL [/] # cp /etc/passwd /etc/group /tmp SHLL [/] # cp /etc/passwd /etc/group /tmp
SHLL [/] # ls /tmp SHLL [/] # ls /tmp
-rw-r--r-- 1 root root 102 Jan 01 00:01 passwd -rw-r--r-- 1 root root 102 Jan 01 00:01 passwd
-rw-r--r-- 1 root root 42 Jan 01 00:01 group -rw-r--r-- 1 root root 42 Jan 01 00:01 group
2 files 144 bytes occupied 2 files 144 bytes occupied
SHLL [/] # SHLL [/] #
@end example @end example
@subheading CONFIGURATION: @subheading CONFIGURATION:
@@ -275,7 +276,7 @@ SHLL [/] #
@findex CONFIGURE_SHELL_NO_COMMAND_CP @findex CONFIGURE_SHELL_NO_COMMAND_CP
@findex CONFIGURE_SHELL_COMMAND_CP @findex CONFIGURE_SHELL_COMMAND_CP
This command is included in the default shell command set. This command is included in the default shell command set.
When building a custom command set, define When building a custom command set, define
@code{CONFIGURE_SHELL_COMMAND_CP} to have this @code{CONFIGURE_SHELL_COMMAND_CP} to have this
command included. command included.
@@ -448,7 +449,7 @@ pwd
@subheading DESCRIPTION: @subheading DESCRIPTION:
This command prints the fully qualified filename of the current This command prints the fully qualified filename of the current
working directory. working directory.
@subheading EXIT STATUS: @subheading EXIT STATUS:
@@ -475,7 +476,7 @@ SHLL [/dev] $ pwd
@findex CONFIGURE_SHELL_NO_COMMAND_PWD @findex CONFIGURE_SHELL_NO_COMMAND_PWD
@findex CONFIGURE_SHELL_COMMAND_PWD @findex CONFIGURE_SHELL_COMMAND_PWD
This command is included in the default shell command set. This command is included in the default shell command set.
When building a custom command set, define When building a custom command set, define
@code{CONFIGURE_SHELL_COMMAND_PWD} to have this @code{CONFIGURE_SHELL_COMMAND_PWD} to have this
command included. command included.
@@ -531,7 +532,7 @@ This command returns 0 on success and non-zero if an error is encountered.
@subheading NOTES: @subheading NOTES:
This command currently does not display information on a set of This command currently does not display information on a set of
files like the POSIX ls(1). It only displays the contents of files like the POSIX ls(1). It only displays the contents of
entire directories. entire directories.
@@ -545,14 +546,14 @@ drwxr-xr-x 1 root root 536 Jan 01 00:00 dev/
drwxr-xr-x 1 root root 1072 Jan 01 00:00 etc/ drwxr-xr-x 1 root root 1072 Jan 01 00:00 etc/
2 files 1608 bytes occupied 2 files 1608 bytes occupied
SHLL [/] $ ls etc SHLL [/] $ ls etc
-rw-r--r-- 1 root root 102 Jan 01 00:00 passwd -rw-r--r-- 1 root root 102 Jan 01 00:00 passwd
-rw-r--r-- 1 root root 42 Jan 01 00:00 group -rw-r--r-- 1 root root 42 Jan 01 00:00 group
-rw-r--r-- 1 root root 30 Jan 01 00:00 issue -rw-r--r-- 1 root root 30 Jan 01 00:00 issue
-rw-r--r-- 1 root root 28 Jan 01 00:00 issue.net -rw-r--r-- 1 root root 28 Jan 01 00:00 issue.net
4 files 202 bytes occupied 4 files 202 bytes occupied
SHLL [/] $ ls dev etc SHLL [/] $ ls dev etc
-rwxr-xr-x 1 rtems root 0 Jan 01 00:00 console -rwxr-xr-x 1 rtems root 0 Jan 01 00:00 console
-rwxr-xr-x 1 root root 0 Jan 01 00:00 console_b -rwxr-xr-x 1 root root 0 Jan 01 00:00 console_b
@end example @end example
@subheading CONFIGURATION: @subheading CONFIGURATION:
@@ -560,7 +561,7 @@ SHLL [/] $ ls dev etc
@findex CONFIGURE_SHELL_NO_COMMAND_LS @findex CONFIGURE_SHELL_NO_COMMAND_LS
@findex CONFIGURE_SHELL_COMMAND_LS @findex CONFIGURE_SHELL_COMMAND_LS
This command is included in the default shell command set. This command is included in the default shell command set.
When building a custom command set, define When building a custom command set, define
@code{CONFIGURE_SHELL_COMMAND_LS} to have this @code{CONFIGURE_SHELL_COMMAND_LS} to have this
command included. command included.
@@ -626,7 +627,7 @@ The following is an example of how to use @code{chdir}:
SHLL [/] $ pwd SHLL [/] $ pwd
/ /
SHLL [/] $ chdir etc SHLL [/] $ chdir etc
SHLL [/etc] $ pwd SHLL [/etc] $ pwd
/etc /etc
@end example @end example
@@ -635,7 +636,7 @@ SHLL [/etc] $ pwd
@findex CONFIGURE_SHELL_NO_COMMAND_CHDIR @findex CONFIGURE_SHELL_NO_COMMAND_CHDIR
@findex CONFIGURE_SHELL_COMMAND_CHDIR @findex CONFIGURE_SHELL_COMMAND_CHDIR
This command is included in the default shell command set. This command is included in the default shell command set.
When building a custom command set, define When building a custom command set, define
@code{CONFIGURE_SHELL_COMMAND_CHDIR} to have this @code{CONFIGURE_SHELL_COMMAND_CHDIR} to have this
command included. command included.
@@ -683,7 +684,7 @@ mkdir dir [dir1 .. dirN]
This command creates the set of directories in the order they This command creates the set of directories in the order they
are specified on the command line. If an error is encountered are specified on the command line. If an error is encountered
making one of the directories, the command will continue to making one of the directories, the command will continue to
attempt to create the remaining directories on the command line. attempt to create the remaining directories on the command line.
@subheading EXIT STATUS: @subheading EXIT STATUS:
@@ -712,7 +713,7 @@ SHLL [/] # ls joel
0 files 0 bytes occupied 0 files 0 bytes occupied
SHLL [/] # cp etc/passwd joel SHLL [/] # cp etc/passwd joel
SHLL [/] # ls joel SHLL [/] # ls joel
-rw-r--r-- 1 root root 102 Jan 01 00:02 passwd -rw-r--r-- 1 root root 102 Jan 01 00:02 passwd
1 files 102 bytes occupied 1 files 102 bytes occupied
@end example @end example
@@ -721,7 +722,7 @@ SHLL [/] # ls joel
@findex CONFIGURE_SHELL_NO_COMMAND_MKDIR @findex CONFIGURE_SHELL_NO_COMMAND_MKDIR
@findex CONFIGURE_SHELL_COMMAND_MKDIR @findex CONFIGURE_SHELL_COMMAND_MKDIR
This command is included in the default shell command set. This command is included in the default shell command set.
When building a custom command set, define When building a custom command set, define
@code{CONFIGURE_SHELL_COMMAND_MKDIR} to have this @code{CONFIGURE_SHELL_COMMAND_MKDIR} to have this
command included. command included.
@@ -767,7 +768,7 @@ rmdir [dir1 .. dirN]
@subheading DESCRIPTION: @subheading DESCRIPTION:
This command removes the specified set of directories. If no This command removes the specified set of directories. If no
directories are provided on the command line, no actions are taken. directories are provided on the command line, no actions are taken.
@subheading EXIT STATUS: @subheading EXIT STATUS:
@@ -795,7 +796,7 @@ joeldir: No such file or directory.
@findex CONFIGURE_SHELL_NO_COMMAND_RMDIR @findex CONFIGURE_SHELL_NO_COMMAND_RMDIR
@findex CONFIGURE_SHELL_COMMAND_RMDIR @findex CONFIGURE_SHELL_COMMAND_RMDIR
This command is included in the default shell command set. This command is included in the default shell command set.
When building a custom command set, define When building a custom command set, define
@code{CONFIGURE_SHELL_COMMAND_RMDIR} to have this @code{CONFIGURE_SHELL_COMMAND_RMDIR} to have this
command included. command included.
@@ -966,9 +967,9 @@ are from NetBSD 4.0.
@subheading SYNOPSYS: @subheading SYNOPSYS:
@example @example
mknod [-rR] [-F fmt] [-g gid] [-m mode] [-u uid] name [c | b] mknod [-rR] [-F fmt] [-g gid] [-m mode] [-u uid] name [c | b]
[driver | major] minor [driver | major] minor
mknod [-rR] [-F fmt] [-g gid] [-m mode] [-u uid] name [c | b] mknod [-rR] [-F fmt] [-g gid] [-m mode] [-u uid] name [c | b]
major unit subunit major unit subunit
mknod [-rR] [-g gid] [-m mode] [-u uid] name [c | b] number mknod [-rR] [-g gid] [-m mode] [-u uid] name [c | b] number
mknod [-rR] [-g gid] [-m mode] [-u uid] name p mknod [-rR] [-g gid] [-m mode] [-u uid] name p
@@ -1145,7 +1146,7 @@ cat: /etc/passwd: No such file or directory
@findex CONFIGURE_SHELL_NO_COMMAND_CHROOT @findex CONFIGURE_SHELL_NO_COMMAND_CHROOT
@findex CONFIGURE_SHELL_COMMAND_CHROOT @findex CONFIGURE_SHELL_COMMAND_CHROOT
This command is included in the default shell command set. This command is included in the default shell command set.
When building a custom command set, define When building a custom command set, define
@code{CONFIGURE_SHELL_COMMAND_CHROOT} to have this @code{CONFIGURE_SHELL_COMMAND_CHROOT} to have this
command included. Additional to that you have to add one command included. Additional to that you have to add one
@@ -1214,31 +1215,31 @@ The following is an example of how to use @code{chmod}:
@example @example
SHLL [/] # cd etc SHLL [/] # cd etc
SHLL [/etc] # ls SHLL [/etc] # ls
-rw-r--r-- 1 root root 102 Jan 01 00:00 passwd -rw-r--r-- 1 root root 102 Jan 01 00:00 passwd
-rw-r--r-- 1 root root 42 Jan 01 00:00 group -rw-r--r-- 1 root root 42 Jan 01 00:00 group
-rw-r--r-- 1 root root 30 Jan 01 00:00 issue -rw-r--r-- 1 root root 30 Jan 01 00:00 issue
-rw-r--r-- 1 root root 28 Jan 01 00:00 issue.net -rw-r--r-- 1 root root 28 Jan 01 00:00 issue.net
4 files 202 bytes occupied 4 files 202 bytes occupied
SHLL [/etc] # chmod 0777 passwd SHLL [/etc] # chmod 0777 passwd
SHLL [/etc] # ls SHLL [/etc] # ls
-rwxrwxrwx 1 root root 102 Jan 01 00:00 passwd -rwxrwxrwx 1 root root 102 Jan 01 00:00 passwd
-rw-r--r-- 1 root root 42 Jan 01 00:00 group -rw-r--r-- 1 root root 42 Jan 01 00:00 group
-rw-r--r-- 1 root root 30 Jan 01 00:00 issue -rw-r--r-- 1 root root 30 Jan 01 00:00 issue
-rw-r--r-- 1 root root 28 Jan 01 00:00 issue.net -rw-r--r-- 1 root root 28 Jan 01 00:00 issue.net
4 files 202 bytes occupied 4 files 202 bytes occupied
SHLL [/etc] # chmod 0322 passwd SHLL [/etc] # chmod 0322 passwd
SHLL [/etc] # ls SHLL [/etc] # ls
--wx-w--w- 1 nouser root 102 Jan 01 00:00 passwd --wx-w--w- 1 nouser root 102 Jan 01 00:00 passwd
-rw-r--r-- 1 nouser root 42 Jan 01 00:00 group -rw-r--r-- 1 nouser root 42 Jan 01 00:00 group
-rw-r--r-- 1 nouser root 30 Jan 01 00:00 issue -rw-r--r-- 1 nouser root 30 Jan 01 00:00 issue
-rw-r--r-- 1 nouser root 28 Jan 01 00:00 issue.net -rw-r--r-- 1 nouser root 28 Jan 01 00:00 issue.net
4 files 202 bytes occupied 4 files 202 bytes occupied
SHLL [/etc] # chmod 0644 passwd SHLL [/etc] # chmod 0644 passwd
SHLL [/etc] # ls SHLL [/etc] # ls
-rw-r--r-- 1 root root 102 Jan 01 00:00 passwd -rw-r--r-- 1 root root 102 Jan 01 00:00 passwd
-rw-r--r-- 1 root root 42 Jan 01 00:00 group -rw-r--r-- 1 root root 42 Jan 01 00:00 group
-rw-r--r-- 1 root root 30 Jan 01 00:00 issue -rw-r--r-- 1 root root 30 Jan 01 00:00 issue
-rw-r--r-- 1 root root 28 Jan 01 00:00 issue.net -rw-r--r-- 1 root root 28 Jan 01 00:00 issue.net
4 files 202 bytes occupied 4 files 202 bytes occupied
@end example @end example
@@ -1247,7 +1248,7 @@ SHLL [/etc] # ls
@findex CONFIGURE_SHELL_NO_COMMAND_CHMOD @findex CONFIGURE_SHELL_NO_COMMAND_CHMOD
@findex CONFIGURE_SHELL_COMMAND_CHMOD @findex CONFIGURE_SHELL_COMMAND_CHMOD
This command is included in the default shell command set. This command is included in the default shell command set.
When building a custom command set, define When building a custom command set, define
@code{CONFIGURE_SHELL_COMMAND_CHMOD} to have this @code{CONFIGURE_SHELL_COMMAND_CHMOD} to have this
command included. command included.
@@ -1319,7 +1320,7 @@ tty:!:2:2:tty owner::/:/bin/false
@findex CONFIGURE_SHELL_NO_COMMAND_CAT @findex CONFIGURE_SHELL_NO_COMMAND_CAT
@findex CONFIGURE_SHELL_COMMAND_CAT @findex CONFIGURE_SHELL_COMMAND_CAT
This command is included in the default shell command set. This command is included in the default shell command set.
When building a custom command set, define When building a custom command set, define
@code{CONFIGURE_SHELL_COMMAND_CAT} to have this @code{CONFIGURE_SHELL_COMMAND_CAT} to have this
command included. command included.
@@ -1365,7 +1366,7 @@ rm file1 [file2 ... fileN]
@subheading DESCRIPTION: @subheading DESCRIPTION:
This command deletes a name from the filesystem. If the specified file name This command deletes a name from the filesystem. If the specified file name
was the last link to a file and there are no @code{open} file descriptor was the last link to a file and there are no @code{open} file descriptor
references to that file, then it is deleted and the associated space in references to that file, then it is deleted and the associated space in
the file system is made available for subsequent use. the file system is made available for subsequent use.
@@ -1403,7 +1404,7 @@ cat: tmpfile: No such file or directory
@findex CONFIGURE_SHELL_NO_COMMAND_RM @findex CONFIGURE_SHELL_NO_COMMAND_RM
@findex CONFIGURE_SHELL_COMMAND_RM @findex CONFIGURE_SHELL_COMMAND_RM
This command is included in the default shell command set. This command is included in the default shell command set.
When building a custom command set, define When building a custom command set, define
@code{CONFIGURE_SHELL_COMMAND_RM} to have this @code{CONFIGURE_SHELL_COMMAND_RM} to have this
command included. command included.
@@ -1510,7 +1511,7 @@ $ cat /tftp/10.10.10.10/test.txt
@findex CONFIGURE_SHELL_NO_COMMAND_MOUNT @findex CONFIGURE_SHELL_NO_COMMAND_MOUNT
@findex CONFIGURE_SHELL_COMMAND_MOUNT @findex CONFIGURE_SHELL_COMMAND_MOUNT
This command is included in the default shell command set. This command is included in the default shell command set.
When building a custom command set, define When building a custom command set, define
@code{CONFIGURE_SHELL_COMMAND_MOUNT} to have this @code{CONFIGURE_SHELL_COMMAND_MOUNT} to have this
command included. command included.
@@ -1603,7 +1604,7 @@ EXAMPLE_TBD
@findex CONFIGURE_SHELL_NO_COMMAND_UNMOUNT @findex CONFIGURE_SHELL_NO_COMMAND_UNMOUNT
@findex CONFIGURE_SHELL_COMMAND_UNMOUNT @findex CONFIGURE_SHELL_COMMAND_UNMOUNT
This command is included in the default shell command set. This command is included in the default shell command set.
When building a custom command set, define When building a custom command set, define
@code{CONFIGURE_SHELL_COMMAND_UNMOUNT} to have this @code{CONFIGURE_SHELL_COMMAND_UNMOUNT} to have this
command included. command included.
@@ -1672,7 +1673,7 @@ EXAMPLE_TBD
@findex CONFIGURE_SHELL_NO_COMMAND_BLKSYNC @findex CONFIGURE_SHELL_NO_COMMAND_BLKSYNC
@findex CONFIGURE_SHELL_COMMAND_BLKSYNC @findex CONFIGURE_SHELL_COMMAND_BLKSYNC
This command is included in the default shell command set. This command is included in the default shell command set.
When building a custom command set, define When building a custom command set, define
@code{CONFIGURE_SHELL_COMMAND_BLKSYNC} to have this @code{CONFIGURE_SHELL_COMMAND_BLKSYNC} to have this
command included. command included.
@@ -2069,7 +2070,7 @@ An asterisk (*) may not be used as a field width or precision.
A byte count or field precision is required for each ``s'' con- A byte count or field precision is required for each ``s'' con-
version character (unlike the fprintf(3) default which prints the version character (unlike the fprintf(3) default which prints the
entire string if the precision is unspecified). entire string if the precision is unspecified).
@item @item
The conversion characters ``h'', ``l'', ``n'', ``p'' and ``q'' are not The conversion characters ``h'', ``l'', ``n'', ``p'' and ``q'' are not
supported. supported.
@item @item
@@ -2243,7 +2244,7 @@ fdisk
@findex CONFIGURE_SHELL_NO_COMMAND_FDISK @findex CONFIGURE_SHELL_NO_COMMAND_FDISK
@findex CONFIGURE_SHELL_COMMAND_FDISK @findex CONFIGURE_SHELL_COMMAND_FDISK
This command is included in the default shell command set. This command is included in the default shell command set.
When building a custom command set, define When building a custom command set, define
@code{CONFIGURE_SHELL_COMMAND_FDISK} to have this @code{CONFIGURE_SHELL_COMMAND_FDISK} to have this
command included. command included.
@@ -2268,7 +2269,7 @@ dir [dir]
@subheading DESCRIPTION: @subheading DESCRIPTION:
This command is an alias or alternate name for the @code{ls}. This command is an alias or alternate name for the @code{ls}.
See @ref{File and Directory Commands ls - list files in the directory, ls} See @ref{File and Directory Commands ls - list files in the directory, ls}
for more information. for more information.
@@ -2290,10 +2291,10 @@ drwxr-xr-x 1 root root 536 Jan 01 00:00 dev/
drwxr-xr-x 1 root root 1072 Jan 01 00:00 etc/ drwxr-xr-x 1 root root 1072 Jan 01 00:00 etc/
2 files 1608 bytes occupied 2 files 1608 bytes occupied
SHLL [/] $ dir etc SHLL [/] $ dir etc
-rw-r--r-- 1 root root 102 Jan 01 00:00 passwd -rw-r--r-- 1 root root 102 Jan 01 00:00 passwd
-rw-r--r-- 1 root root 42 Jan 01 00:00 group -rw-r--r-- 1 root root 42 Jan 01 00:00 group
-rw-r--r-- 1 root root 30 Jan 01 00:00 issue -rw-r--r-- 1 root root 30 Jan 01 00:00 issue
-rw-r--r-- 1 root root 28 Jan 01 00:00 issue.net -rw-r--r-- 1 root root 28 Jan 01 00:00 issue.net
4 files 202 bytes occupied 4 files 202 bytes occupied
@end example @end example
@@ -2302,7 +2303,7 @@ SHLL [/] $ dir etc
@findex CONFIGURE_SHELL_NO_COMMAND_DIR @findex CONFIGURE_SHELL_NO_COMMAND_DIR
@findex CONFIGURE_SHELL_COMMAND_DIR @findex CONFIGURE_SHELL_COMMAND_DIR
This command is included in the default shell command set. This command is included in the default shell command set.
When building a custom command set, define When building a custom command set, define
@code{CONFIGURE_SHELL_COMMAND_DIR} to have this @code{CONFIGURE_SHELL_COMMAND_DIR} to have this
command included. command included.
@@ -2407,7 +2408,7 @@ SHLL [/] $ mkrfs /dev/fdda
@findex CONFIGURE_SHELL_NO_COMMAND_MKRFS @findex CONFIGURE_SHELL_NO_COMMAND_MKRFS
@findex CONFIGURE_SHELL_COMMAND_MKRFS @findex CONFIGURE_SHELL_COMMAND_MKRFS
This command is included in the default shell command set. This command is included in the default shell command set.
When building a custom command set, define When building a custom command set, define
@code{CONFIGURE_SHELL_COMMAND_MKRFS} to have this @code{CONFIGURE_SHELL_COMMAND_MKRFS} to have this
command included. command included.
@@ -2448,7 +2449,7 @@ extern rtems_shell_cmd_t rtems_shell_MKRFS_Command;
@subheading SYNOPSYS: @subheading SYNOPSYS:
@example @example
debugrfs [-hl] path command [options] debugrfs [-hl] path command [options]
@end example @end example
@subheading DESCRIPTION: @subheading DESCRIPTION:
@@ -2476,7 +2477,7 @@ The commands are:
Display the contents of the blocks from start to end. Display the contents of the blocks from start to end.
@item data @item data
Display the file system data and configuration. Display the file system data and configuration.
@item dir bno @item dir bno
Process the block as a directory displaying the entries. Process the block as a directory displaying the entries.
@@ -2519,7 +2520,7 @@ SHLL [/] $ debugrfs /c data
@findex CONFIGURE_SHELL_NO_COMMAND_DEBUGRFS @findex CONFIGURE_SHELL_NO_COMMAND_DEBUGRFS
@findex CONFIGURE_SHELL_COMMAND_DEBUGRFS @findex CONFIGURE_SHELL_COMMAND_DEBUGRFS
This command is included in the default shell command set. This command is included in the default shell command set.
When building a custom command set, define When building a custom command set, define
@code{CONFIGURE_SHELL_COMMAND_DEBUGRFS} to have this @code{CONFIGURE_SHELL_COMMAND_DEBUGRFS} to have this
command included. command included.
@@ -2565,7 +2566,7 @@ cd directory
@subheading DESCRIPTION: @subheading DESCRIPTION:
This command is an alias or alternate name for the @code{chdir}. This command is an alias or alternate name for the @code{chdir}.
See @ref{File and Directory Commands chdir - change the current directory, cd} See @ref{File and Directory Commands chdir - change the current directory, cd}
for more information. for more information.
@@ -2601,7 +2602,7 @@ SHLL [/] $ pwd
@findex CONFIGURE_SHELL_NO_COMMAND_CD @findex CONFIGURE_SHELL_NO_COMMAND_CD
@findex CONFIGURE_SHELL_COMMAND_CD @findex CONFIGURE_SHELL_COMMAND_CD
This command is included in the default shell command set. This command is included in the default shell command set.
When building a custom command set, define When building a custom command set, define
@code{CONFIGURE_SHELL_COMMAND_CD} to have this @code{CONFIGURE_SHELL_COMMAND_CD} to have this
command included. command included.
@@ -2678,7 +2679,7 @@ Filesystem Size Used Available Use% Mounted on
@findex CONFIGURE_SHELL_NO_COMMAND_DF @findex CONFIGURE_SHELL_NO_COMMAND_DF
@findex CONFIGURE_SHELL_COMMAND_DF @findex CONFIGURE_SHELL_COMMAND_DF
This command is included in the default shell command set. This command is included in the default shell command set.
When building a custom command set, define When building a custom command set, define
@code{CONFIGURE_SHELL_COMMAND_DF} to have this @code{CONFIGURE_SHELL_COMMAND_DF} to have this
command included. command included.
@@ -2708,3 +2709,74 @@ following prototype:
extern rtems_shell_cmd_t rtems_shell_DF_Command; extern rtems_shell_cmd_t rtems_shell_DF_Command;
@end example @end example
@c
@c
@c
@page
@subsection md5 - compute the Md5 hash of a file or list of files
@pgindex md5
@subheading SYNOPSYS:
@example
md5 <files>
@end example
@subheading DESCRIPTION:
This command prints the MD5 of a file. You can provide one or more
files on the command line and a hash for each file is printed in a
single line of output.
@subheading EXIT STATUS:
This command returns 0 on success and non-zero if an error is encountered.
@subheading NOTES:
NONE
@subheading EXAMPLES:
The following is an example of how to use @code{md5}:
@example
SHLL [/] $ md5 shell-init
MD5 (shell-init) = 43b4d2e71b47db79eae679a2efeacf31
@end example
@subheading CONFIGURATION:
@findex CONFIGURE_SHELL_NO_COMMAND_MD5
@findex CONFIGURE_SHELL_COMMAND_MD5
This command is included in the default shell command set.
When building a custom command set, define
@code{CONFIGURE_SHELL_COMMAND_MD5} to have this
command included.
This command can be excluded from the shell command set by
defining @code{CONFIGURE_SHELL_NO_COMMAND_MD5} when all
shell commands have been configured.
@subheading PROGRAMMING INFORMATION:
@findex rtems_shell_rtems_main_md5
The @code{df} is implemented by a C language function
which has the following prototype:
@example
int rtems_shell_main_md5(
int argc,
char **argv
);
@end example
The configuration structure for the @code{md5} has the
following prototype:
@example
extern rtems_shell_cmd_t rtems_shell_MD5_Command;
@end example