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);
|
||||
}
|
||||
|
||||
void init_arguments(int argc,char **argv){
|
||||
|
||||
void
|
||||
init_arguments(int argc,char **argv)
|
||||
{
|
||||
int cnt = 1;
|
||||
int shell_argc = 0;
|
||||
char name[255];
|
||||
@@ -48,6 +50,10 @@ void init_arguments(int argc,char **argv){
|
||||
gCommandToExecute = argv[cnt];
|
||||
// ignore further args
|
||||
return;
|
||||
case '-':
|
||||
// ignore standard bash option
|
||||
if (!strcmp(option, "--login"))
|
||||
break;
|
||||
default:
|
||||
print_usage(true);
|
||||
exit(1);
|
||||
|
||||
@@ -19,6 +19,10 @@
|
||||
#include "shell_history.h"
|
||||
|
||||
|
||||
#define ECHO 0
|
||||
// echoes input when unequal 0
|
||||
|
||||
|
||||
static int
|
||||
readline(char *buf, int len)
|
||||
{
|
||||
@@ -33,9 +37,11 @@ readline(char *buf, int len)
|
||||
// ESC -- used to display command history:
|
||||
// erase all characters on the current line,
|
||||
// then display the previously saved command
|
||||
#if ECHO
|
||||
while (i--) {
|
||||
printf("\b");
|
||||
}
|
||||
#endif
|
||||
|
||||
strcpy (buf, fetch_history_command());
|
||||
i = printf("%s", buf);
|
||||
@@ -45,7 +51,9 @@ readline(char *buf, int len)
|
||||
// backspace:
|
||||
// erase the last character written
|
||||
if (i > 0) {
|
||||
#if ECHO
|
||||
printf("\b");
|
||||
#endif
|
||||
--i;
|
||||
}
|
||||
break;
|
||||
@@ -53,12 +61,16 @@ readline(char *buf, int len)
|
||||
case '\n':
|
||||
buf[i] = 0;
|
||||
store_history_command(buf);
|
||||
#if ECHO
|
||||
printf("\n");
|
||||
#endif
|
||||
return i;
|
||||
|
||||
default:
|
||||
buf[i] = ch;
|
||||
#if ECHO
|
||||
printf("%c", ch);
|
||||
#endif
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user