diff --git a/jtag/ChangeLog b/jtag/ChangeLog index 5e312072..5fe03bc6 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -11,11 +11,13 @@ * doc/UrJTAG.txt: How to use initbus (and ejtag/prototype bus driver) and some other smaller updates in the "commands" section. Also - added note about unsupported spiflash* commands, and about now + added note about unsupported spiflash* commands, and about now obsolete script command (see below) * Merged src/script.c into src/include.c. The command looks for the specified file in the repository if it's neither an absolute path nor begins with ./ or ../, otherwise it uses the filename as is. + When called as "script", the command behaves as before but emits + a warning that "include" should be used in future. 2008-02-17 Arnim Laeuger diff --git a/jtag/src/cmd/include.c b/jtag/src/cmd/include.c index 4cd056d5..b18f556a 100644 --- a/jtag/src/cmd/include.c +++ b/jtag/src/cmd/include.c @@ -34,7 +34,7 @@ #include "bsdl.h" static int -cmd_include_run( char *params[] ) +cmd_include_or_script_run( int is_include, char *params[] ) { int go = 0, i, j = 1; char *path; @@ -43,12 +43,17 @@ cmd_include_run( char *params[] ) if (cmd_params( params ) < 2) return -1; + if( ! is_include ) + { + printf(_("Please use the 'include' command instead of 'script'\n") ); + } + /* If "params[1]" begins with a slash, or dots followed by a slash, * assume that user wants to ignore the search path */ path = params[1]; while( *path == '.' ) path++; - if(*path == '/') // TODO: use sysdependent PATH_SEP + if(*path == '/' || ! is_include) { path = strdup(params[1]); } @@ -97,27 +102,51 @@ cmd_include_run( char *params[] ) } static void -cmd_script_help( void ) +cmd_include_or_script_help( char *cmd ) { printf( _( "Usage: %s FILENAME [n] \n" "Run command sequence n times from external FILENAME.\n" "\n" "FILENAME Name of the file with commands\n" - ), "script" ); + ), cmd ); +} + +static int +cmd_include_run( char *params[] ) +{ + return cmd_include_or_script_run( 1, params ); +} + +static void +cmd_include_help( void ) +{ + cmd_include_or_script_help( "include" ); } cmd_t cmd_include = { "include", N_("include command sequence from external repository"), - cmd_script_help, + cmd_include_help, cmd_include_run }; +static int +cmd_script_run( char *params[] ) +{ + return cmd_include_or_script_run( 0, params ); +} + +static void +cmd_script_help( void ) +{ + cmd_include_or_script_help( "script" ); +} + cmd_t cmd_script = { "script", N_("run command sequence from external file"), cmd_script_help, - cmd_include_run + cmd_script_run };