Changes in kernel/genarch/src/multiboot/multiboot.c [c8cbd39:32817cc] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/src/multiboot/multiboot.c
rc8cbd39 r32817cc 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 else96 break;97 }98 99 str_ncpy(buf, size, start, (size_t) (end - start));100 }101 102 73 static void multiboot_modules(uint32_t count, multiboot_module_t *mods) 103 74 { … … 113 84 multiboot_extract_command(init.tasks[init.cnt].name, 114 85 CONFIG_TASK_NAME_BUFLEN, MULTIBOOT_PTR(mods[i].string)); 115 multiboot_extract_argument(init.tasks[init.cnt].arguments, 116 CONFIG_TASK_ARGUMENTS_BUFLEN, MULTIBOOT_PTR(mods[i].string)); 117 } else { 86 } else 118 87 init.tasks[init.cnt].name[0] = 0; 119 init.tasks[init.cnt].arguments[0] = 0;120 }121 88 122 89 init.cnt++;
Note:
See TracChangeset
for help on using the changeset viewer.