Commit 61fa00b7 authored by Neil Turton's avatar Neil Turton
Browse files

Import from cleaned 370 CD

parent 6352679c
......@@ -14,7 +14,7 @@
;
title-string: BootCommands
help-string: Boot_Commands 1.14
help-string: Boot_Commands 1.16
initialisation-code: main_initialise
......
......@@ -24,8 +24,6 @@
VPATH = @ <Support$Dir>
RESDIR = <resource$dir>.Resources2.${COMPONENT}
#
# Generic options:
#
......@@ -50,13 +48,14 @@ ABSSYM = RISC_OSLib:o.abssym
#
# Program specific options:
#
COMPONENT = BootCmds
TARGET = aof.BootCmds
#COMPONENT = Set in Components/Installation file to 'rom' or 'Repeat'
TARGET = aof.BootCmds
RESDIR = <resource$dir>.Resources2.BootCmds
OBJS = o.files o.header o.main o.Messages o.Repeat o.riscos
OBJSD = o.header o.hostfs debug.m debug.main debug.trace \
debug.riscos debug.files o.Repeat o.Messages
debug.riscos debug.files o.Repeat o.Messages debug.svc
ROM_OBJS = o.files o.header o.main o.Repeat o.riscos
......@@ -67,25 +66,37 @@ RESOURCES = o.Messages o.Repeat
#
# Generic rules {used by top-level build}:
#
all: ${COMPONENT}; @
rom: ${TARGET}
@echo ${COMPONENT}: rom module built
@echo BootCmds: rom module built
Repeat: Resources.Repeat; @
@echo Repeat: programme built
export:
@echo ${COMPONENT}: export complete
@echo BootCmds: export complete
install: install_${COMPONENT}; @
install_rom: ${TARGET}
${CP} ${TARGET} ${INSTDIR}.${COMPONENT} ${CPFLAGS}
@echo ${COMPONENT}: rom module installed
${CP} ${TARGET} ${INSTDIR}.BootCmds ${CPFLAGS}
@echo BootCmds: rom module installed
install_Repeat: Resources.Repeat
${CP} Resources.Repeat ${INSTDIR}.Repeat ${CPFLAGS}
@echo Repeat: installed
clean:
-Destroy RM.BootCmds ${OBJS} ${OBJSD} ${TARGET} map.BootCmds linked.BootCmds \
o.repeatcmd Resources.Repeat
@echo ${COMPONENT}: cleaned
@echo BootCmds: cleaned
resources:
${MKDIR} ${RESDIR}
${CP} Resources.Messages ${RESDIR}.Messages ${CPFLAGS}
@echo ${COMPONENT}: Resources copied to Messages module
@echo BootCmds: Resources copied to Messages module
#
# ROM target (re-linked at ROM Image build time)
......@@ -97,19 +108,16 @@ ${TARGET}: ${ROM_OBJS} ${OSLIB} ${RSTUBS}
# Final link for the ROM Image (using given base address)
#
rom_link:
${LINK} -o linked.${COMPONENT} -bin -base ${ADDRESS} ${TARGET} ${ABSSYM} \
-map > map.${COMPONENT}
truncate map.${COMPONENT} linked.${COMPONENT}
${CP} linked.${COMPONENT} ${LINKDIR}.${COMPONENT} ${CPFLAGS}
@echo ${COMPONENT}: rom_link complete
${LINK} -o linked.BootCmds -bin -base ${ADDRESS} ${TARGET} ${ABSSYM} \
-map > map.BootCmds
truncate map.BootCmds linked.BootCmds
${CP} linked.BootCmds ${LINKDIR}.BootCmds ${CPFLAGS}
@echo BootCmds: rom_link complete
#
# Extra {development} rules:
#
all: RM.BootCmds RM.BootCmdsD
@Echo Made all
asms: ${ASMS}
release: RM.BootCmds
......
......@@ -59,6 +59,9 @@ 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 os_error *Register (resourcefs_file *file, char *name,
int data_size, byte *data, bits load_addr, bits exec_addr,
int *size_out)
......@@ -81,7 +84,7 @@ static os_error *Register (resourcefs_file *file, char *name,
fh->load_addr = load_addr;
fh->exec_addr = exec_addr;
fh->size = data_size;
fh->attr = osfile_ATTR_OWNER_READ | osfile_ATTR_OWNER_WRITE;
fh->attr = fileswitch_ATTR_OWNER_READ | fileswitch_ATTR_OWNER_WRITE;
strcpy (fh->name, name);
fd = (resourcefs_file_data *) &fh->name [ALIGN (name_len + 1)];
......@@ -101,19 +104,39 @@ static os_error *Add_App (char *tail)
{ struct {char *applications; char argb [os_CLI_LIMIT + 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],
dir_name [os_FILE_NAME_LIMIT + 1], entry [os_FILE_NAME_LIMIT + 1],
application [os_FILE_NAME_LIMIT + 1];
#else
char *leaf_name, *name, *boot_name, *help_name, *run_name, *boot_data,
*help_data, *run_data, *canon, *dir_name, *entry, *application;
#endif
int boot_type, help_type, sprites_type, resource_size, size, context, found;
resourcefs_file_list *file_list;
resourcefs_file *file;
os_date_and_time *now;
osfile_info_words info_words;
fileswitch_info_words info_words;
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);
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;
if ((error = xos_read_args ("applications/a", tail, (char *) &argl,
sizeof argl, NULL)) != NULL)
goto finish;
......@@ -130,7 +153,7 @@ static os_error *Add_App (char *tail)
context = 0;
while (TRUE)
{ if ((error = xosgbpb_dir_entries (dir_name, (osgbpb_string_list *) entry,
1, context, sizeof entry, leaf_name, &found, &context)) != NULL)
1, context, 257, leaf_name, &found, &context)) != NULL)
goto finish;
if (context == osgbpb_NO_MORE) break;
......@@ -142,7 +165,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, sizeof application, NULL)) != NULL)
canon, NULL, NULL, 257, NULL)) != NULL)
goto finish;
resource_size = 0;
......@@ -264,6 +287,7 @@ static os_error *Add_App (char *tail)
}
finish:
free(name);
return error;
}
/*------------------------------------------------------------------------*/
......@@ -339,7 +363,6 @@ finish:
static os_error *Do (char *tail)
{ os_error *error = NULL;
char buffer [os_CLI_LIMIT + 1];
bits psr;
tracef ("Do\n");
......@@ -363,7 +386,7 @@ finish:
static os_error *If_There (char *tail)
{ os_error *error = NULL;
char s [os_CLI_LIMIT + 1], *cc;
char *cc;
int i, obj_type;
tracef ("If_There\n");
......@@ -376,26 +399,26 @@ static os_error *If_There (char *tail)
/*Copy non-spaces into |s| - this is the file name.*/
i = 0;
while (*cc > ' ')
s [i++] = *cc++;
s [i] = '\0';
tracef ("file name \"%s\"\n" _ s);
buffer[i++] = *cc++;
buffer[i] = '\0';
tracef ("file name \"%s\"\n" _ buffer);
/*So, is it there?*/
/*Fix MED-3984: if this fails, behave as if the file were absent. JRC 19th
Dec 1994*/
if (xosfile_read_stamped_no_path (s, &obj_type, NULL, NULL, NULL, NULL,
if (xosfile_read_stamped_no_path (buffer, &obj_type, NULL, NULL, NULL, NULL,
NULL) != NULL)
obj_type = osfile_NOT_FOUND;
/*Wizard wheeze to avoid parsing the rest of the line.*/
sprintf (s, "If %d%.*s",
sprintf (buffer, "If %d%.*s",
obj_type != osfile_NOT_FOUND, riscos_strlen (cc), cc);
/*Fix bizarre fault - strip trailing spaces. J R C 23rd Feb 1995*/
for (i = strlen (s) - 1; s [i] == ' '; i--)
s [i] = '\0';
tracef ("command \"%s\"\n" _ s);
for (i = strlen (buffer) - 1; buffer [i] == ' '; i--)
buffer [i] = '\0';
tracef ("command \"%s\"\n" _ buffer);
if ((error = xos_cli (s)) != NULL)
if ((error = xos_cli (buffer)) != NULL)
{ /*Fix MED-3984: if this gives a syntax error, change it to our own
message. JRC 19th Dec 1994*/
if (error->errnum == error_SYNTAX)
......@@ -474,22 +497,25 @@ finish:
if (error == NULL) error = error1;
}
return error;
/*Never return an error from here - it would just mess up the boot
sequence. J R C 23rd Aug 1995*/
if (error != NULL) fprintf (stderr, "%s\n", error->errmess);
return NULL;
}
/*------------------------------------------------------------------------*/
static os_error *Repeat (char *tail)
{ os_error *error = NULL;
char cmd [os_CLI_LIMIT + 1];
tracef ("Repeat\n");
/*Repeat is done by running a file, since it is then running in USR mode
and handlers work.*/
sprintf (cmd, "Resources:$.Resources.BootCmds.Repeat %.*s",
sprintf (buffer, "Resources:$.Resources.BootCmds.Repeat %.*s",
riscos_strlen (tail), tail);
tracef ("/%s\n" _ cmd);
if ((error = xosfscontrol_run (cmd)) != NULL)
tracef ("/%s\n" _ buffer);
if ((error = xosfscontrol_run (buffer)) != NULL)
goto finish;
#if 0
......@@ -508,39 +534,44 @@ finish:
/*------------------------------------------------------------------------*/
static os_error *Safe_Logon (char *tail)
{ struct {char *fs, *user, *password; char argb [os_CLI_LIMIT + 1];} argl;
int station, net, context, collate, temp_fs;
{ struct safelogon_args {char *fs, *user, *password; char argb [os_CLI_LIMIT + 1];} *argl;
int station, net, context, collate;
fileswitch_fs_no temp_fs;
netfs_file_server_context file_server_context;
char password [os_CLI_LIMIT + 1], *end;
char *end;
bool logon_required = TRUE, found_fs, named_fs;
os_error *error = NULL;
tracef ("Safe_Logon\n");
argl = malloc(sizeof(struct safelogon_args));
if (argl == 0)
goto finish;
/*Fix bug: check that the temporary filing system is indeed NetFS. JRC
16th Feb 1995*/
if ((error = xosargs_read_temporary_fs (&temp_fs)) != NULL)
goto finish;
if (temp_fs == osfscontrol_FS_NUMBER_NETFS)
if (temp_fs == fileswitch_FS_NUMBER_NETFS)
{ if ((error = xos_read_args ("fs/a,user/a,password", tail,
(char *) &argl, sizeof argl, NULL)) != NULL)
(char *) argl, sizeof *argl, NULL)) != NULL)
goto finish;
tracef ("fs \"%s\"\n" _ argl.fs);
tracef ("user \"%s\"\n" _ argl.user);
tracef ("fs \"%s\"\n" _ argl->fs);
tracef ("user \"%s\"\n" _ argl->user);
tracef ("password \"%s\"\n" _
argl.password != NULL? argl.password: "NULL");
argl->password != NULL? argl->password: "NULL");
/*If the first character of the fs is not ':', we steer clear.*/
if (argl.fs [0] == ':')
{ argl.fs++;
if (argl->fs [0] == ':')
{ argl->fs++;
/*Station number or name?*/
named_fs = xeconet_read_station_number (argl.fs, NULL, &station,
named_fs = xeconet_read_station_number (argl->fs, NULL, &station,
&net) != NULL;
if (named_fs)
tracef ("fs is named \"%s\"\n" _ argl.fs);
tracef ("fs is named \"%s\"\n" _ argl->fs);
else
tracef ("fs is numbered %d.%d\n" _ net _ station);
......@@ -565,7 +596,7 @@ static os_error *Safe_Logon (char *tail)
file_server_context.user_name);
if (named_fs)
{ if ((error = xterritory_collate (territory_CURRENT, argl.fs,
{ if ((error = xterritory_collate (territory_CURRENT, argl->fs,
file_server_context.disc_name, territory_IGNORE_CASE,
&collate)) != NULL)
goto finish;
......@@ -577,7 +608,7 @@ static os_error *Safe_Logon (char *tail)
file_server_context.net_no == net;
if (found_fs)
{ if ((error = xterritory_collate (territory_CURRENT, argl.user,
{ if ((error = xterritory_collate (territory_CURRENT, argl->user,
file_server_context.user_name, territory_IGNORE_CASE,
&collate)) != NULL)
goto finish;
......@@ -589,7 +620,7 @@ static os_error *Safe_Logon (char *tail)
on? JRC 19th Dec 1994*/
netfs_read_user_info info;
sprintf (info AS request.user_name, "%s\r", argl.user);
sprintf (info AS request.user_name, "%s\r", argl->user);
tracef ("doing fs op ...\n");
if ((error = xnetfs_do_fs_op_to_given_fs
......@@ -608,6 +639,7 @@ static os_error *Safe_Logon (char *tail)
} } } } }
finish:
free(argl);
/*Ignore errors up to this point. If there have been any, it's a safe bet
that |logon_required| is TRUE.*/
if (error != NULL)
......@@ -616,16 +648,12 @@ finish:
/*If that user is not logged on to that file server, do it now.*/
if (logon_required)
{ char cmd [os_CLI_LIMIT + 1];
sprintf (cmd, "%%Logon %.*s", riscos_strlen (tail), tail);
{
sprintf (buffer, "%%Logon %.*s", riscos_strlen (tail), tail);
/*Not Net:%%Logon! JRC 17th Feb 1995*/
error = xos_cli (cmd);
error = xos_cli (buffer);
}
memset (&argl, '\0', sizeof argl);
memset (password, '\0', sizeof password);
return error;
}
/*------------------------------------------------------------------------*/
......
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