Now only echoes the input if ECHO is defined.
Ignores a "--login" argument (that's what consoled does). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11381 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -23,8 +23,10 @@ print_usage(bool error)
|
|||||||
fprintf((error ? stderr : stdout), kUsage);
|
fprintf((error ? stderr : stdout), kUsage);
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_arguments(int argc,char **argv){
|
|
||||||
|
|
||||||
|
void
|
||||||
|
init_arguments(int argc,char **argv)
|
||||||
|
{
|
||||||
int cnt = 1;
|
int cnt = 1;
|
||||||
int shell_argc = 0;
|
int shell_argc = 0;
|
||||||
char name[255];
|
char name[255];
|
||||||
@@ -48,6 +50,10 @@ void init_arguments(int argc,char **argv){
|
|||||||
gCommandToExecute = argv[cnt];
|
gCommandToExecute = argv[cnt];
|
||||||
// ignore further args
|
// ignore further args
|
||||||
return;
|
return;
|
||||||
|
case '-':
|
||||||
|
// ignore standard bash option
|
||||||
|
if (!strcmp(option, "--login"))
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
print_usage(true);
|
print_usage(true);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|||||||
@@ -19,6 +19,10 @@
|
|||||||
#include "shell_history.h"
|
#include "shell_history.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define ECHO 0
|
||||||
|
// echoes input when unequal 0
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
readline(char *buf, int len)
|
readline(char *buf, int len)
|
||||||
{
|
{
|
||||||
@@ -33,9 +37,11 @@ readline(char *buf, int len)
|
|||||||
// ESC -- used to display command history:
|
// ESC -- used to display command history:
|
||||||
// erase all characters on the current line,
|
// erase all characters on the current line,
|
||||||
// then display the previously saved command
|
// then display the previously saved command
|
||||||
|
#if ECHO
|
||||||
while (i--) {
|
while (i--) {
|
||||||
printf("\b");
|
printf("\b");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
strcpy (buf, fetch_history_command());
|
strcpy (buf, fetch_history_command());
|
||||||
i = printf("%s", buf);
|
i = printf("%s", buf);
|
||||||
@@ -45,7 +51,9 @@ readline(char *buf, int len)
|
|||||||
// backspace:
|
// backspace:
|
||||||
// erase the last character written
|
// erase the last character written
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
|
#if ECHO
|
||||||
printf("\b");
|
printf("\b");
|
||||||
|
#endif
|
||||||
--i;
|
--i;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -53,12 +61,16 @@ readline(char *buf, int len)
|
|||||||
case '\n':
|
case '\n':
|
||||||
buf[i] = 0;
|
buf[i] = 0;
|
||||||
store_history_command(buf);
|
store_history_command(buf);
|
||||||
|
#if ECHO
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
#endif
|
||||||
return i;
|
return i;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
buf[i] = ch;
|
buf[i] = ch;
|
||||||
|
#if ECHO
|
||||||
printf("%c", ch);
|
printf("%c", ch);
|
||||||
|
#endif
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user