[syslinux:elflink] ldlinux: Automatically apply ".c32" extension for COM32 files
syslinux-bot for Matt Fleming
matt.fleming at intel.com
Mon Nov 26 05:27:04 PST 2012
Commit-ID: 390ec0fa8881da48852e6693df6d5cada6031235
Gitweb: http://www.syslinux.org/commit/390ec0fa8881da48852e6693df6d5cada6031235
Author: Matt Fleming <matt.fleming at intel.com>
AuthorDate: Mon, 26 Nov 2012 13:08:06 +0000
Committer: Matt Fleming <matt.fleming at intel.com>
CommitDate: Mon, 26 Nov 2012 13:11:36 +0000
ldlinux: Automatically apply ".c32" extension for COM32 files
If a type-specifier is used on the command line, e.g.
.com32 pwd
we should apply the ".c32" filename extension automatically as this
works elsewhere and this behaviour was present in 4.0x.
Signed-off-by: Matt Fleming <matt.fleming at intel.com>
---
com32/elflink/ldlinux/config.h | 1 +
com32/elflink/ldlinux/execute.c | 12 +++++++++++-
com32/elflink/ldlinux/ldlinux.c | 2 +-
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/com32/elflink/ldlinux/config.h b/com32/elflink/ldlinux/config.h
index 63e33b6..9b7ce4a 100644
--- a/com32/elflink/ldlinux/config.h
+++ b/com32/elflink/ldlinux/config.h
@@ -48,5 +48,6 @@ extern int new_linux_kernel(char *okernel, char *ocmdline);
extern void pm_load_high(com32sys_t *regs);
extern void ldlinux_enter_command(void);
+extern const char *apply_extension(const char *kernel, const char *ext);
#endif /* __CONFIG_H__ */
diff --git a/com32/elflink/ldlinux/execute.c b/com32/elflink/ldlinux/execute.c
index 6ccde49..e06192e 100644
--- a/com32/elflink/ldlinux/execute.c
+++ b/com32/elflink/ldlinux/execute.c
@@ -84,7 +84,17 @@ void execute(const char *cmdline, uint32_t type)
const struct image_types *t;
for (t = image_boot_types; t->name; t++) {
if (!strcmp(kernel + 1, t->name)) {
- /* Strip the type specifier and retry */
+ /*
+ * Strip the type specifier, apply the
+ * filename extension if COM32 and
+ * retry.
+ */
+ if (t->type == IMAGE_TYPE_COM32) {
+ p = apply_extension(p, ".c32");
+ if (!p)
+ return;
+ }
+
execute(p, t->type);
return;
}
diff --git a/com32/elflink/ldlinux/ldlinux.c b/com32/elflink/ldlinux/ldlinux.c
index 004769c..d3f8e62 100644
--- a/com32/elflink/ldlinux/ldlinux.c
+++ b/com32/elflink/ldlinux/ldlinux.c
@@ -102,7 +102,7 @@ static const char *get_extension(const char *kernel)
return NULL;
}
-static const char *apply_extension(const char *kernel, const char *ext)
+const char *apply_extension(const char *kernel, const char *ext)
{
const char *p;
char *k;
More information about the Syslinux-commits
mailing list