Added support for zip files.
[tangerine.git] / arch / all-mingw32 / bootloader / bootloader_init.c
blobb461aa41a525dfd4ad8b475129e57730663e85de
1 /*
2 Copyright © 1995-2009, The AROS Development Team. All rights reserved.
3 $Id: bootloader_init.c 29778 2008-10-16 19:40:21Z neil $
5 Bootloader information initialisation.
6 */
8 #define DEBUG 0
10 #include <aros/debug.h>
11 #include <aros/kernel.h>
12 #include <exec/types.h>
13 #include <exec/memory.h>
14 #include <exec/resident.h>
15 #include <utility/utility.h>
16 #include <utility/tagitem.h>
17 #include <proto/exec.h>
18 #include <proto/bootloader.h>
19 #include <proto/kernel.h>
20 #include <proto/utility.h>
22 #include <aros/symbolsets.h>
23 #include <aros/bootloader.h>
24 #include "bootloader_intern.h"
25 #include LC_LIBDEFS_FILE
27 #include <string.h>
29 static int GM_UNIQUENAME(Init)(LIBBASETYPEPTR BootLoaderBase)
31 struct TagItem *bootinfo;
32 STRPTR Kernel_Args;
34 D(bug("[BootLdr] Init\n"));
36 BootLoaderBase->Flags = 0;
37 NEWLIST(&(BootLoaderBase->Args));
39 bootinfo = KrnGetBootInfo();
40 BootLoaderBase->LdrName = NULL; /* TODO */
42 Kernel_Args = (STRPTR)GetTagData(KRN_CmdLine, 0, bootinfo);
43 if (Kernel_Args) {
44 STRPTR cmd,buff;
45 ULONG temp;
46 struct Node *node;
47 ULONG len = strlen(Kernel_Args) + 1;
49 D(bug("[BootLdr] Kernel arguments: %s\n", Kernel_Args));
50 /* First make a working copy of the command line */
51 if ((buff = AllocMem(len, MEMF_ANY|MEMF_CLEAR)))
53 strcpy(buff,Kernel_Args);
54 /* remove any leading spaces */
55 cmd = stpblk(buff);
56 while(cmd[0])
58 /* Split the command line */
59 temp = strcspn(cmd," ");
60 cmd[temp++] = 0x00;
61 D(bug("[BootLdr] Init: Argument %s\n",cmd));
62 /* Allocate node and insert into list */
63 node = AllocMem(sizeof(struct Node),MEMF_ANY|MEMF_CLEAR);
64 node->ln_Name = cmd;
65 AddTail(&(BootLoaderBase->Args),node);
66 /* Skip to next part */
67 cmd = stpblk(cmd+temp);
70 BootLoaderBase->Flags |= BL_FLAGS_CMDLINE;
74 return TRUE;
77 ADD2INITLIB(GM_UNIQUENAME(Init), 0)