projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altos: Include struct ao_data declaration only when used
[fw/altos]
/
src
/
core
/
ao_cmd.c
diff --git
a/src/core/ao_cmd.c
b/src/core/ao_cmd.c
index fbf0c34778094ae08ec176525bc58d49318a2ec8..1814cecf5021848e4fe88b8fc3841dd10e6a491f 100644
(file)
--- a/
src/core/ao_cmd.c
+++ b/
src/core/ao_cmd.c
@@
-36,10
+36,16
@@
put_string(__code char *s)
putchar(c);
}
putchar(c);
}
+static void
+backspace(void)
+{
+ put_string ("\010 \010");
+}
+
static void
readline(void)
{
static void
readline(void)
{
-
__pdata
char c;
+ char c;
if (ao_echo())
put_string("> ");
cmd_len = 0;
if (ao_echo())
put_string("> ");
cmd_len = 0;
@@
-50,7
+56,7
@@
readline(void)
if (c == '\010' || c == '\177') {
if (cmd_len != 0) {
if (ao_echo())
if (c == '\010' || c == '\177') {
if (cmd_len != 0) {
if (ao_echo())
-
put_string("\010 \010"
);
+
backspace(
);
--cmd_len;
}
continue;
--cmd_len;
}
continue;
@@
-60,7
+66,7
@@
readline(void)
if (c == '\025') {
while (cmd_len != 0) {
if (ao_echo())
if (c == '\025') {
while (cmd_len != 0) {
if (ao_echo())
-
put_string("\010 \010"
);
+
backspace(
);
--cmd_len;
}
continue;
--cmd_len;
}
continue;
@@
-76,11
+82,8
@@
readline(void)
break;
}
break;
}
- if (cmd_len >= CMD_LEN - 2) {
- if (ao_echo())
- putchar('\007');
+ if (cmd_len >= CMD_LEN - 2)
continue;
continue;
- }
cmd_line[cmd_len++] = c;
if (ao_echo())
putchar(c);
cmd_line[cmd_len++] = c;
if (ao_echo())
putchar(c);
@@
-271,13
+274,14
@@
help(void)
__pdata uint8_t cmds;
__pdata uint8_t cmd;
__code struct ao_cmds * __pdata cs;
__pdata uint8_t cmds;
__pdata uint8_t cmd;
__code struct ao_cmds * __pdata cs;
+ const char *h;
for (cmds = 0; cmds < ao_ncmds; cmds++) {
cs = ao_cmds[cmds];
for (cmds = 0; cmds < ao_ncmds; cmds++) {
cs = ao_cmds[cmds];
- for (cmd = 0; cs[cmd].func; cmd++)
- printf("%-45s %s\n",
- cs[cmd].help,
- cs[cmd].help+1+strlen(cs[cmd].help));
+ for (cmd = 0; cs[cmd].func; cmd++)
{
+ h = cs[cmd].help;
+ printf("%-45s %s\n", h, h + 1 + strlen(h));
+ }
}
}
}
}