File indexing completed on 2025-05-11 08:24:19
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifdef HAVE_CONFIG_H
0016 #include "config.h"
0017 #endif
0018
0019 #include <ctype.h>
0020 #include <stdio.h>
0021 #include <string.h>
0022
0023 #include <rtems.h>
0024 #include <rtems/shell.h>
0025 #include <rtems/stringto.h>
0026 #include "internal.h"
0027
0028 static int rtems_shell_main_medit(
0029 int argc,
0030 char *argv[]
0031 )
0032 {
0033 unsigned char *pb;
0034 void *tmpp;
0035 int n;
0036 int i;
0037
0038 if ( argc < 3 ) {
0039 fprintf(stderr,"%s: too few arguments\n", argv[0]);
0040 return -1;
0041 }
0042
0043
0044
0045
0046 if ( rtems_string_to_pointer(argv[1], &tmpp, NULL) ) {
0047 printf( "Address argument (%s) is not a number\n", argv[1] );
0048 return -1;
0049 }
0050 pb = tmpp;
0051
0052
0053
0054
0055 n = 0;
0056 for (i=2 ; i<argc ; i++) {
0057 unsigned char tmpc;
0058
0059 if ( rtems_string_to_unsigned_char(argv[i], &tmpc, NULL, 0) ) {
0060 printf( "Value (%s) is not a number\n", argv[i] );
0061 continue;
0062 }
0063
0064 pb[n++] = tmpc;
0065 }
0066
0067 return 0;
0068 }
0069
0070 rtems_shell_cmd_t rtems_shell_MEDIT_Command = {
0071 "medit",
0072 "medit address value1 [value2 ...]",
0073 "mem",
0074 rtems_shell_main_medit,
0075 NULL,
0076 NULL
0077 };