aboutsummaryrefslogtreecommitdiffstats
path: root/com32
diff options
context:
space:
mode:
authorErwan Velu <erwan.velu@free.fr>2009-03-19 18:27:11 +0100
committerErwan Velu <erwan.velu@free.fr>2009-03-19 18:27:11 +0100
commit537b0b1af03cc6c53eada6df7afb4b4283f6dadb (patch)
tree28df7331482b22962eed53bde7989c68dd1afaa4 /com32
parentb8749d1f878f18c9598200aab265633a690a63f7 (diff)
downloadsyslinux.git-537b0b1af03cc6c53eada6df7afb4b4283f6dadb.tar.gz
syslinux.git-537b0b1af03cc6c53eada6df7afb4b4283f6dadb.tar.xz
syslinux.git-537b0b1af03cc6c53eada6df7afb4b4283f6dadb.zip
hdt: Skip heading spaces
Impact: Allow user to put some space char before the real command Before that patch, it was required not having any space before the command. That's not so user friendly ;o)
Diffstat (limited to 'com32')
-rw-r--r--com32/hdt/hdt-cli.c2
-rw-r--r--com32/hdt/hdt-common.c10
-rw-r--r--com32/hdt/hdt-common.h1
3 files changed, 12 insertions, 1 deletions
diff --git a/com32/hdt/hdt-cli.c b/com32/hdt/hdt-cli.c
index 3550f794..5f25b4c7 100644
--- a/com32/hdt/hdt-cli.c
+++ b/com32/hdt/hdt-cli.c
@@ -370,7 +370,7 @@ void start_cli_mode(struct s_hardware *hardware)
break;
case KEY_ENTER:
more_printf("\n");
- exec_command(cli.input, &cli, hardware);
+ exec_command(skipspace(cli.input), &cli, hardware);
reset_prompt(&cli);
break;
case KEY_BACKSPACE:
diff --git a/com32/hdt/hdt-common.c b/com32/hdt/hdt-common.c
index fb0c4c9e..a2802f82 100644
--- a/com32/hdt/hdt-common.c
+++ b/com32/hdt/hdt-common.c
@@ -391,3 +391,13 @@ void clear_screen(void)
fputs("\033e\033%@\033)0\033(B\1#0\033[?25l\033[2J", stdout);
display_line_nb = 0;
}
+
+/* searching the next char that is not a space */
+char *skipspace(char *p)
+{
+ while (*p && *p <= ' ')
+ p++;
+
+ return p;
+}
+
diff --git a/com32/hdt/hdt-common.h b/com32/hdt/hdt-common.h
index 8f5da7b1..bb18ca28 100644
--- a/com32/hdt/hdt-common.h
+++ b/com32/hdt/hdt-common.h
@@ -120,6 +120,7 @@ struct s_hardware {
};
const char *find_argument(const char **argv, const char *argument);
+char *skipspace(char *p);
int detect_dmi(struct s_hardware *hardware);
void detect_disks(struct s_hardware *hardware);
void detect_pci(struct s_hardware *hardware);