Commit dfbcd9d7 authored by Ben Avison's avatar Ben Avison
Browse files

A couple of bugfixes

Detail:
  * *Repeat allows for command lines up to 1024 bytes (RISC OS 4+ standard)
    rather than 256 bytes
 * Fixed crash on *Repeat -sort
 * Uses OS_HeapSort32 rather than OS_HeapSort
Admin:
  Provided by Thomas Milius

Version 1.39. Tagged as 'BootCmds-1_39'
parent 073f429b
/* (1.38)
/* (1.39)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 1.38
#define Module_MajorVersion_CMHG 1.39
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 12 Oct 2008
#define Module_Date_CMHG 19 Apr 2010
#define Module_MajorVersion "1.38"
#define Module_Version 138
#define Module_MajorVersion "1.39"
#define Module_Version 139
#define Module_MinorVersion ""
#define Module_Date "12 Oct 2008"
#define Module_Date "19 Apr 2010"
#define Module_ApplicationDate "12-Oct-08"
#define Module_ApplicationDate "19-Apr-10"
#define Module_ComponentName "BootCmds"
#define Module_ComponentPath "RiscOS/Sources/Programmer/BootCmds"
#define Module_ComponentPath "castle/RiscOS/Sources/Programmer/BootCmds"
#define Module_FullVersion "1.38"
#define Module_HelpVersion "1.38 (12 Oct 2008)"
#define Module_LibraryVersionInfo "1:38"
#define Module_FullVersion "1.39"
#define Module_HelpVersion "1.39 (19 Apr 2010)"
#define Module_LibraryVersionInfo "1:39"
......@@ -17,6 +17,7 @@
/*History
12th Sep 1994 J R C Started
17th Jan 2010 TM os_CLI_LIMIT_RO4 and some constants replaced by logical name
*/
......@@ -61,7 +62,7 @@ static os_error *(*Commands [main_COMMAND_COUNT]) (char *);
static messagetrans_control_block Control_Block;
/* A useful global buffer */
static char buffer[os_CLI_LIMIT + 1];
static char buffer[os_CLI_LIMIT_RO4 + 1];
static os_error *Register (resourcefs_file *file, char *name,
int data_size, byte *data, bits load_addr, bits exec_addr,
......@@ -103,13 +104,13 @@ static os_error *Register (resourcefs_file *file, char *name,
/*------------------------------------------------------------------------*/
static os_error *Add_App (char *tail)
{ struct {char *applications; char argb [os_CLI_LIMIT + 1];} argl;
{ struct {char *applications; char argb [os_CLI_LIMIT_RO4 + 1];} argl;
os_error *error = NULL;
#if 0
char *leaf_name, name [os_CLI_LIMIT + 1], boot_name [os_CLI_LIMIT + 1],
help_name [os_CLI_LIMIT + 1], run_name [os_CLI_LIMIT + 1],
boot_data [os_CLI_LIMIT + 1], help_data [os_CLI_LIMIT + 1],
run_data [os_CLI_LIMIT + 1], canon [os_CLI_LIMIT + 1],
char *leaf_name, name [os_CLI_LIMIT_RO4 + 1], boot_name [os_CLI_LIMIT_RO4 + 1],
help_name [os_CLI_LIMIT_RO4 + 1], run_name [os_CLI_LIMIT_RO4 + 1],
boot_data [os_CLI_LIMIT_RO4 + 1], help_data [os_CLI_LIMIT_RO4 + 1],
run_data [os_CLI_LIMIT_RO4 + 1], canon [os_CLI_LIMIT_RO4 + 1],
dir_name [os_FILE_NAME_LIMIT + 1], entry [os_FILE_NAME_LIMIT + 1],
application [os_FILE_NAME_LIMIT + 1];
#else
......@@ -124,19 +125,19 @@ static os_error *Add_App (char *tail)
tracef ("Add_App\n");
/* Horrible, I know, but better than getting it off the SVC stack like it used to */
name = (char *)malloc(11 * 257);
name = (char *)malloc((8 * (os_CLI_LIMIT_RO4 + 1)) + (3 * (os_FILE_NAME_LIMIT + 1)));
if (!name)
goto finish;
boot_name = name + 257;
help_name = boot_name + 257;
run_name = help_name + 257;
boot_data = run_name + 257;
help_data = boot_data + 257;
run_data = help_data + 257;
canon = run_data + 257;
dir_name = canon + 257;
entry = dir_name + 257;
application = entry + 257;
boot_name = name + (os_CLI_LIMIT_RO4 + 1);
help_name = boot_name + (os_CLI_LIMIT_RO4 + 1);
run_name = help_name + (os_CLI_LIMIT_RO4 + 1);
boot_data = run_name + (os_CLI_LIMIT_RO4 + 1);
help_data = boot_data + (os_CLI_LIMIT_RO4 + 1);
run_data = help_data + (os_CLI_LIMIT_RO4 + 1);
canon = run_data + (os_CLI_LIMIT_RO4 + 1);
dir_name = canon + (os_FILE_NAME_LIMIT + 1);
entry = dir_name + (os_FILE_NAME_LIMIT + 1);
application = entry + (os_FILE_NAME_LIMIT + 1);
if ((error = xos_read_args ("applications/a", tail, (char *) &argl,
sizeof argl, NULL)) != NULL)
......@@ -154,7 +155,7 @@ static os_error *Add_App (char *tail)
context = 0;
while (context != osgbpb_NO_MORE)
{ if ((error = xosgbpb_dir_entries (dir_name, (osgbpb_string_list *) entry,
1, context, 257, leaf_name, &found, &context)) != NULL)
1, context, (os_FILE_NAME_LIMIT + 1), leaf_name, &found, &context)) != NULL)
goto finish;
if (found == 1)
......@@ -165,7 +166,7 @@ static os_error *Add_App (char *tail)
/*We must canonicalise the argument, or else the path names in
ResourceFS won't be very much use.*/
if ((error = xosfscontrol_canonicalise_path (application,
canon, NULL, NULL, 257, NULL)) != NULL)
canon, NULL, NULL, (os_CLI_LIMIT_RO4 + 1), NULL)) != NULL)
goto finish;
resource_size = 0;
......@@ -586,7 +587,7 @@ static int get_nvm_size(void)
static os_error *Load_CMOS (char *tail)
{ struct {char *file; char argb [os_CLI_LIMIT + 1];} argl;
{ struct {char *file; char argb [os_CLI_LIMIT_RO4 + 1];} argl;
bool done_open = FALSE;
os_f f;
int r, w, i, size, obj_type, bootversion = 370, fileversion, xsum, fxsum;
......@@ -752,7 +753,7 @@ finish:
/*--------------------------------------------------------------------*/
static os_error *Save_CMOS (char *tail)
{ struct {char *file; char argb [os_CLI_LIMIT + 1];} argl;
{ struct {char *file; char argb [os_CLI_LIMIT_RO4 + 1];} argl;
bool done_open = FALSE;
os_f f;
int r, i;
......@@ -833,7 +834,7 @@ finish:
/*------------------------------------------------------------------------*/
static os_error *Safe_Logon (char *tail)
{ struct safelogon_args {char *fs, *user, *password; char argb [os_CLI_LIMIT + 1];} *argl;
{ struct safelogon_args {char *fs, *user, *password; char argb [os_CLI_LIMIT_RO4 + 1];} *argl;
int station, net, context, collate;
fileswitch_fs_no temp_fs;
netfs_file_server_context file_server_context;
......@@ -1163,7 +1164,7 @@ int main (void)
{ int context;
struct {char *prog, *command, *directory; osbool directories, applications,
files; char *type, *tail; osbool tasks; char argb [os_CLI_LIMIT + 1];} argl;
files; char *type, *tail; osbool tasks; char argb [os_CLI_LIMIT_RO4 + 1];} argl;
osgbpb_INFO_STAMPED (FILENAME_MAX + 1) info;
bool done_initialise = FALSE;
bits file_type;
......@@ -1225,7 +1226,7 @@ int main (void)
( argl.directories ||
(argl.applications && info.name [0] == '!')
) ) )
{ char cmd [os_CLI_LIMIT + 1];
{ char cmd [os_CLI_LIMIT_RO4 + 1];
if (!argl.tail)
sprintf (cmd, "%s %s.%s", argl.command, argl.directory,
......
......@@ -20,6 +20,7 @@
16th Dec 1999 SAR Rewritten to include the '-sort' switch and fill buffer in one go (if possible)
2nd Sep 2004 SAR Added -STB switch to control handling of errors in pre-desktop
20th Feb 2007 JWB extended buffer allocation to allow up to 8 retries with extended buffer
17th Jan 2010 TM os_CLI_LIMIT_RO4 and usage of OS_HeapSort32
*/
/*From CLib*/
......@@ -50,7 +51,7 @@ int main(void)
osbool directories, applications, files;
char *type, *tail;
osbool tasks, verbose, sort, stb;
char argb [os_CLI_LIMIT + 1];
char argb [os_CLI_LIMIT_RO4 + 1];
} argl;
bool done_initialise = FALSE;
bits file_type;
......@@ -149,7 +150,7 @@ int main(void)
/* Sort the leafname pointer array */
if (argl.sort)
{
error = (os_error *) _swix(OS_HeapSort, _INR(0,2), entries, *objects, 4);
error = (os_error *) _swix(OS_HeapSort32, _INR(0,2), entries, objects, 4);
if (error != NULL) goto finish;
}
......@@ -174,7 +175,7 @@ int main(void)
)
)
{
char cmd [os_CLI_LIMIT + 1];
char cmd [os_CLI_LIMIT_RO4 + 1];
/* Create the CLI string which we're going to execute */
if (!argl.tail)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment