2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
9 #include <aros/debug.h>
10 #include <utility/tagitem.h>
11 #include <dos/dostags.h>
12 #include <proto/utility.h>
13 #include <dos/dosextens.h>
14 #include <aros/asmcall.h>
15 #include <exec/ports.h>
17 #include "dos_intern.h"
19 #include <proto/dos.h>
21 static BPTR
findseg_any(CONST_STRPTR res
, CONST_STRPTR file
, struct DosLibrary
*DOSBase
)
26 D(bug("[%s] Looking for shell %s (aka %s)\n", __func__
, res
, file
));
29 seg
= FindSegment(res
, NULL
, TRUE
);
30 if (seg
!= NULL
&& seg
->seg_UC
<= 0) {
32 D(bug("[%s] Found %s in DOS Resident list\n", __func__
, res
));
36 /* Ok, *really* digging for it now.
39 found
= LoadSeg(file
);
41 /* We're going to keep this around for a long while. */
42 D(bug("[%s] Found %s on disk\n", __func__
, file
));
43 AddSegment(res
, found
, CMD_SYSTEM
);
45 D(bug("[%s] No such segment available\n", __func__
));
52 BPTR
findseg_cli(BOOL isBoot
, struct DosLibrary
*DOSBase
)
57 seg
= DOSBase
->dl_Root
->rn_ConsoleSegment
;
60 seg
= findseg_any("CLI", "L:Shell-Seg", DOSBase
);
62 DOSBase
->dl_Root
->rn_ConsoleSegment
= seg
;
68 BPTR
findseg_shell(BOOL isBoot
, struct DosLibrary
*DOSBase
)
73 seg
= DOSBase
->dl_Root
->rn_ShellSegment
;
76 seg
= findseg_any("shell", "L:UserShell-Seg", DOSBase
);
78 DOSBase
->dl_Root
->rn_ShellSegment
= seg
;