#include <malloc.h>
#endif
#endif
-//#ifdef HAVE_STRINGS_H
-//#include <strings.h>
-//#endif
int handle_rm_command(struct command_context_s *cmd_ctx, char *cmd,
for (i = 1; i < argc; i++)
{
- if (fwrite(args[i], strlen(args[i]), 1, config_file)!=strlen(args[i]))
+ if (fwrite(args[i], 1, strlen(args[i]), config_file)!=strlen(args[i]))
break;
if (i != argc - 1)
{
break;
}
- command_print(cmd_ctx, "%d", len - pos);
+ command_print(cmd_ctx, "%zu", len - pos);
pos += chunk;
int fd1, fd2;
ssize_t done, wrote;
- fd1 = open(name1, O_WRONLY | O_CREAT);
+ fd1 = open(name1, O_WRONLY | O_CREAT, 0664);
if (fd1 < 0)
SHOW_RESULT( open, fd1 );
break;
}
- if( done == 0 ) break;
+ if ( done == 0 ) break;
wrote = write(fd1, buf, done);
- if( wrote != done ) SHOW_RESULT( write, wrote );
+ if ( wrote != done ) SHOW_RESULT( write, wrote );
- if( wrote != done ) break;
+ if ( wrote != done ) break;
}
err = close(fd1);
- if( err < 0 ) SHOW_RESULT( close, err );
+ if ( err < 0 ) SHOW_RESULT( close, err );
err = close(fd2);
- if( err < 0 ) SHOW_RESULT( close, err );
+ if ( err < 0 ) SHOW_RESULT( close, err );
}
}
dirp = opendir(name);
- if( dirp == NULL ) SHOW_RESULT( opendir, -1 );
+ if ( dirp == NULL ) SHOW_RESULT( opendir, -1 );
for (;;)
{
}
err = closedir(dirp);
- if( err < 0 ) SHOW_RESULT( stat, err );
+ if ( err < 0 ) SHOW_RESULT( stat, err );
}
return JIM_OK;
}
-int handle_peek_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
-{
- if (argc != 1)
- {
- return ERROR_COMMAND_SYNTAX_ERROR;
- }
- unsigned long addr = strtoul(args[0], NULL, 0);
- volatile unsigned *address = (volatile unsigned *)addr;
- unsigned value = *address;
- command_print(cmd_ctx, "0x%p : 0x%x", address, (int)value);
- return ERROR_OK;
-}
-
-int handle_poke_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
-{
- if (argc != 2)
- {
- return ERROR_INVALID_ARGUMENTS;
- }
- unsigned long addr = strtoul(args[0], NULL, 0);
- volatile int *address = (volatile int *)addr;
- int value=strtoul(args[1], NULL, 0);
- *address=value;
- return ERROR_OK;
-}
-
static int
zylinjtag_Jim_Command_peek(Jim_Interp *interp,
int argc,