mirror of
https://github.com/limine-bootloader/limine
synced 2024-11-25 01:49:52 +03:00
print: Specifier for printing URIs
This commit is contained in:
parent
a1bcf3c09b
commit
71eb143611
@ -192,6 +192,25 @@ void vprint(const char *fmt, va_list args) {
|
||||
char c = (char)va_arg(args, int);
|
||||
prn_char(print_buf, &print_buf_i, c); }
|
||||
break;
|
||||
case '#': {
|
||||
bool printed = false;
|
||||
char *str = (char *)va_arg(args, const char *);
|
||||
for (int i = (int)strlen(str) - 1; i >= 0; i--) {
|
||||
if (str[i] != '#') {
|
||||
continue;
|
||||
}
|
||||
|
||||
prn_nstr(print_buf, &print_buf_i, str, i);
|
||||
printed = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!printed) {
|
||||
prn_str(print_buf, &print_buf_i, str);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
prn_char(print_buf, &print_buf_i, '?');
|
||||
break;
|
||||
|
@ -194,7 +194,7 @@ struct file_handle *uri_open(char *uri) {
|
||||
uri_resolve(uri, &resource, &root, &path);
|
||||
|
||||
if (resource == NULL) {
|
||||
panic(true, "No resource specified for URI `%s`.", uri);
|
||||
panic(true, "No resource specified for URI `%#`.", uri);
|
||||
}
|
||||
|
||||
bool compressed = false;
|
||||
|
@ -281,11 +281,11 @@ noreturn void limine_load(char *config, char *cmdline) {
|
||||
if (kernel_path == NULL)
|
||||
panic(true, "limine: KERNEL_PATH not specified");
|
||||
|
||||
print("limine: Loading kernel `%s`...\n", kernel_path);
|
||||
print("limine: Loading kernel `%#`...\n", kernel_path);
|
||||
|
||||
struct file_handle *kernel_file;
|
||||
if ((kernel_file = uri_open(kernel_path)) == NULL)
|
||||
panic(true, "limine: Failed to open kernel with path `%s`. Is the path correct?", kernel_path);
|
||||
panic(true, "limine: Failed to open kernel with path `%#`. Is the path correct?", kernel_path);
|
||||
|
||||
uint8_t *kernel = freadall(kernel_file, MEMMAP_BOOTLOADER_RECLAIMABLE);
|
||||
|
||||
@ -632,11 +632,11 @@ FEAT_START
|
||||
module_cmdline = "";
|
||||
}
|
||||
|
||||
print("limine: Loading module `%s`...\n", module_path);
|
||||
print("limine: Loading module `%#`...\n", module_path);
|
||||
|
||||
struct file_handle *f;
|
||||
if ((f = uri_open(module_path)) == NULL)
|
||||
panic(true, "limine: Failed to open module with path `%s`. Is the path correct?", module_path);
|
||||
panic(true, "limine: Failed to open module with path `%#`. Is the path correct?", module_path);
|
||||
|
||||
struct limine_file *l = &modules[i];
|
||||
*l = get_file(f, module_cmdline);
|
||||
|
@ -357,10 +357,10 @@ noreturn void linux_load(char *config, char *cmdline) {
|
||||
if (kernel_path == NULL)
|
||||
panic(true, "linux: KERNEL_PATH not specified");
|
||||
|
||||
print("linux: Loading kernel `%s`...\n", kernel_path);
|
||||
print("linux: Loading kernel `%#`...\n", kernel_path);
|
||||
|
||||
if ((kernel_file = uri_open(kernel_path)) == NULL)
|
||||
panic(true, "linux: Failed to open kernel with path `%s`. Is the path correct?", kernel_path);
|
||||
panic(true, "linux: Failed to open kernel with path `%#`. Is the path correct?", kernel_path);
|
||||
|
||||
uint32_t signature;
|
||||
fread(kernel_file, &signature, 0x202, sizeof(uint32_t));
|
||||
@ -475,11 +475,11 @@ noreturn void linux_load(char *config, char *cmdline) {
|
||||
if (module_path == NULL)
|
||||
break;
|
||||
|
||||
print("linux: Loading module `%s`...\n", module_path);
|
||||
print("linux: Loading module `%#`...\n", module_path);
|
||||
|
||||
struct file_handle *module;
|
||||
if ((module = uri_open(module_path)) == NULL)
|
||||
panic(true, "linux: Could not open `%s`", module_path);
|
||||
panic(true, "linux: Could not open `%#`", module_path);
|
||||
|
||||
fread(module, (void *)_modules_mem_base, 0, module->size);
|
||||
|
||||
|
@ -53,10 +53,10 @@ noreturn void multiboot1_load(char *config, char *cmdline) {
|
||||
if (kernel_path == NULL)
|
||||
panic(true, "multiboot1: KERNEL_PATH not specified");
|
||||
|
||||
print("multiboot1: Loading kernel `%s`...\n", kernel_path);
|
||||
print("multiboot1: Loading kernel `%#`...\n", kernel_path);
|
||||
|
||||
if ((kernel_file = uri_open(kernel_path)) == NULL)
|
||||
panic(true, "multiboot1: Failed to open kernel with path `%s`. Is the path correct?", kernel_path);
|
||||
panic(true, "multiboot1: Failed to open kernel with path `%#`. Is the path correct?", kernel_path);
|
||||
|
||||
uint8_t *kernel = freadall(kernel_file, MEMMAP_KERNEL_AND_MODULES);
|
||||
|
||||
@ -248,11 +248,11 @@ noreturn void multiboot1_load(char *config, char *cmdline) {
|
||||
if (module_path == NULL)
|
||||
panic(true, "multiboot1: Module disappeared unexpectedly");
|
||||
|
||||
print("multiboot1: Loading module `%s`...\n", module_path);
|
||||
print("multiboot1: Loading module `%#`...\n", module_path);
|
||||
|
||||
struct file_handle *f;
|
||||
if ((f = uri_open(module_path)) == NULL)
|
||||
panic(true, "multiboot1: Failed to open module with path `%s`. Is the path correct?", module_path);
|
||||
panic(true, "multiboot1: Failed to open module with path `%#`. Is the path correct?", module_path);
|
||||
|
||||
char *module_cmdline = conf_tuple.value2;
|
||||
if (module_cmdline == NULL) {
|
||||
|
@ -70,10 +70,10 @@ noreturn void multiboot2_load(char *config, char* cmdline) {
|
||||
if (kernel_path == NULL)
|
||||
panic(true, "multiboot2: KERNEL_PATH not specified");
|
||||
|
||||
print("multiboot2: Loading kernel `%s`...\n", kernel_path);
|
||||
print("multiboot2: Loading kernel `%#`...\n", kernel_path);
|
||||
|
||||
if ((kernel_file = uri_open(kernel_path)) == NULL)
|
||||
panic(true, "multiboot2: Failed to open kernel with path `%s`. Is the path correct?", kernel_path);
|
||||
panic(true, "multiboot2: Failed to open kernel with path `%#`. Is the path correct?", kernel_path);
|
||||
|
||||
uint8_t *kernel = freadall(kernel_file, MEMMAP_KERNEL_AND_MODULES);
|
||||
|
||||
@ -397,11 +397,11 @@ noreturn void multiboot2_load(char *config, char* cmdline) {
|
||||
char *module_path = conf_tuple.value1;
|
||||
if (!module_path) panic(true, "multiboot2: Module disappeared unexpectedly");
|
||||
|
||||
print("multiboot2: Loading module `%s`...\n", module_path);
|
||||
print("multiboot2: Loading module `%#`...\n", module_path);
|
||||
|
||||
struct file_handle *f;
|
||||
if ((f = uri_open(module_path)) == NULL)
|
||||
panic(true, "multiboot2: Failed to open module with path `%s`. Is the path correct?", module_path);
|
||||
panic(true, "multiboot2: Failed to open module with path `%#`. Is the path correct?", module_path);
|
||||
|
||||
// Module commandline can be null, so we guard against that and make the
|
||||
// string "".
|
||||
|
Loading…
Reference in New Issue
Block a user