aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2012-11-26 13:08:06 +0000
committerMatt Fleming <matt.fleming@intel.com>2012-11-26 13:11:36 +0000
commit390ec0fa8881da48852e6693df6d5cada6031235 (patch)
tree32d043a94ba9bd84a79361857f685246603ab383
parent71e195441ea968c0fd9af48c1d2e5823b7a0db41 (diff)
downloadsyslinux-390ec0fa8881da48852e6693df6d5cada6031235.tar.gz
syslinux-390ec0fa8881da48852e6693df6d5cada6031235.tar.xz
syslinux-390ec0fa8881da48852e6693df6d5cada6031235.zip
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@intel.com>
-rw-r--r--com32/elflink/ldlinux/config.h1
-rw-r--r--com32/elflink/ldlinux/execute.c12
-rw-r--r--com32/elflink/ldlinux/ldlinux.c2
3 files changed, 13 insertions, 2 deletions
diff --git a/com32/elflink/ldlinux/config.h b/com32/elflink/ldlinux/config.h
index 63e33b69..9b7ce4a4 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 6ccde49d..e06192e6 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 004769ce..d3f8e627 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;