Changes in kernel/genarch/src/multiboot/multiboot.c [32817cc:c8cbd39] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/src/multiboot/multiboot.c
r32817cc rc8cbd39 71 71 } 72 72 73 /** Extract arguments from the multiboot module command line. 74 * 75 * @param buf Destination buffer (will be always NULL-terminated). 76 * @param size Size of destination buffer (in bytes). 77 * @param cmd_line Input string (the command line). 78 * 79 */ 80 void multiboot_extract_argument(char *buf, size_t size, const char *cmd_line) 81 { 82 /* Start after first space. */ 83 const char *start = str_chr(cmd_line, ' '); 84 if (start == NULL) { 85 str_cpy(buf, size, ""); 86 return; 87 } 88 89 const char *end = cmd_line + str_size(cmd_line); 90 91 /* Skip the space(s). */ 92 while (start != end) { 93 if (start[0] == ' ') 94 start++; 95 else 96 break; 97 } 98 99 str_ncpy(buf, size, start, (size_t) (end - start)); 100 } 101 73 102 static void multiboot_modules(uint32_t count, multiboot_module_t *mods) 74 103 { … … 84 113 multiboot_extract_command(init.tasks[init.cnt].name, 85 114 CONFIG_TASK_NAME_BUFLEN, MULTIBOOT_PTR(mods[i].string)); 86 } else 115 multiboot_extract_argument(init.tasks[init.cnt].arguments, 116 CONFIG_TASK_ARGUMENTS_BUFLEN, MULTIBOOT_PTR(mods[i].string)); 117 } else { 87 118 init.tasks[init.cnt].name[0] = 0; 119 init.tasks[init.cnt].arguments[0] = 0; 120 } 88 121 89 122 init.cnt++;
Note:
See TracChangeset
for help on using the changeset viewer.