Some more stuff.
-Erik
This commit is contained in:
parent
6c41c44898
commit
c7c634bd88
@ -12,6 +12,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
extern int cmdedit_read_input(int inputFd, int outputFd, char command[BUFSIZ]);
|
||||
extern int cmdedit_read_input(char* prompt, int inputFd, int outputFd, char command[BUFSIZ]);
|
||||
extern void cmdedit_init(void);
|
||||
|
||||
|
@ -216,6 +216,12 @@ extern int check_wildcard_match(const char* text, const char* pattern);
|
||||
extern long getNum (const char *cp);
|
||||
extern pid_t findPidByName( char* pidName);
|
||||
extern void *xmalloc (size_t size);
|
||||
#ifdef BB_FEATURE_SH_COMMAND_EDITING
|
||||
#include <stdio.h>
|
||||
extern int cmdedit_read_input(char* prompt, int inputFd, int outputFd, char command[BUFSIZ]);
|
||||
extern void cmdedit_init(void);
|
||||
#endif
|
||||
|
||||
#if defined BB_INIT || defined BB_SYSLOGD
|
||||
extern int device_open(char *device, int mode);
|
||||
#endif
|
||||
|
21
lash.c
21
lash.c
@ -39,10 +39,6 @@
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
#ifdef BB_FEATURE_SH_COMMAND_EDITING
|
||||
#include "cmdedit.h"
|
||||
#endif
|
||||
|
||||
#define JOB_STATUS_FORMAT "[%d] %-22s %.40s\n"
|
||||
|
||||
|
||||
@ -123,8 +119,7 @@ static struct builtInCommand bltins[] = {
|
||||
{"export", "Set environment variable", "export [VAR=value]", shell_export},
|
||||
{"unset", "Unset environment variable", "unset VAR", shell_unset},
|
||||
|
||||
{".", "Source-in and run commands in a file", ". filename",
|
||||
shell_source},
|
||||
{".", "Source-in and run commands in a file", ". filename", shell_source},
|
||||
{"help", "List shell built-in commands", "help", shell_help},
|
||||
{NULL, NULL, NULL, NULL}
|
||||
};
|
||||
@ -396,11 +391,19 @@ static void checkJobs(struct jobSet *jobList)
|
||||
static int getCommand(FILE * source, char *command)
|
||||
{
|
||||
if (source == stdin) {
|
||||
fprintf(stdout, "BBSHELL %s %s", cwd, prompt);
|
||||
fflush(stdout);
|
||||
#ifdef BB_FEATURE_SH_COMMAND_EDITING
|
||||
cmdedit_read_input(fileno(stdin), fileno(stdout), command);
|
||||
int len;
|
||||
char *promptStr;
|
||||
len=fprintf(stdout, "BBSHELL %s %s", cwd, prompt);
|
||||
fflush(stdout);
|
||||
promptStr=(char*)malloc(sizeof(char)*(len+1));
|
||||
sprintf(promptStr, "BBSHELL %s %s", cwd, prompt);
|
||||
cmdedit_read_input(promptStr, fileno(stdin), fileno(stdout), command);
|
||||
free( promptStr);
|
||||
return 0;
|
||||
#else
|
||||
fprintf(stdout, "%s %s", cwd, prompt);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
21
sh.c
21
sh.c
@ -39,10 +39,6 @@
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
#ifdef BB_FEATURE_SH_COMMAND_EDITING
|
||||
#include "cmdedit.h"
|
||||
#endif
|
||||
|
||||
#define JOB_STATUS_FORMAT "[%d] %-22s %.40s\n"
|
||||
|
||||
|
||||
@ -123,8 +119,7 @@ static struct builtInCommand bltins[] = {
|
||||
{"export", "Set environment variable", "export [VAR=value]", shell_export},
|
||||
{"unset", "Unset environment variable", "unset VAR", shell_unset},
|
||||
|
||||
{".", "Source-in and run commands in a file", ". filename",
|
||||
shell_source},
|
||||
{".", "Source-in and run commands in a file", ". filename", shell_source},
|
||||
{"help", "List shell built-in commands", "help", shell_help},
|
||||
{NULL, NULL, NULL, NULL}
|
||||
};
|
||||
@ -396,11 +391,19 @@ static void checkJobs(struct jobSet *jobList)
|
||||
static int getCommand(FILE * source, char *command)
|
||||
{
|
||||
if (source == stdin) {
|
||||
fprintf(stdout, "BBSHELL %s %s", cwd, prompt);
|
||||
fflush(stdout);
|
||||
#ifdef BB_FEATURE_SH_COMMAND_EDITING
|
||||
cmdedit_read_input(fileno(stdin), fileno(stdout), command);
|
||||
int len;
|
||||
char *promptStr;
|
||||
len=fprintf(stdout, "BBSHELL %s %s", cwd, prompt);
|
||||
fflush(stdout);
|
||||
promptStr=(char*)malloc(sizeof(char)*(len+1));
|
||||
sprintf(promptStr, "BBSHELL %s %s", cwd, prompt);
|
||||
cmdedit_read_input(promptStr, fileno(stdin), fileno(stdout), command);
|
||||
free( promptStr);
|
||||
return 0;
|
||||
#else
|
||||
fprintf(stdout, "%s %s", cwd, prompt);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
935
shell/cmdedit.c
935
shell/cmdedit.c
File diff suppressed because it is too large
Load Diff
@ -12,6 +12,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
extern int cmdedit_read_input(int inputFd, int outputFd, char command[BUFSIZ]);
|
||||
extern int cmdedit_read_input(char* prompt, int inputFd, int outputFd, char command[BUFSIZ]);
|
||||
extern void cmdedit_init(void);
|
||||
|
||||
|
21
shell/lash.c
21
shell/lash.c
@ -39,10 +39,6 @@
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
#ifdef BB_FEATURE_SH_COMMAND_EDITING
|
||||
#include "cmdedit.h"
|
||||
#endif
|
||||
|
||||
#define JOB_STATUS_FORMAT "[%d] %-22s %.40s\n"
|
||||
|
||||
|
||||
@ -123,8 +119,7 @@ static struct builtInCommand bltins[] = {
|
||||
{"export", "Set environment variable", "export [VAR=value]", shell_export},
|
||||
{"unset", "Unset environment variable", "unset VAR", shell_unset},
|
||||
|
||||
{".", "Source-in and run commands in a file", ". filename",
|
||||
shell_source},
|
||||
{".", "Source-in and run commands in a file", ". filename", shell_source},
|
||||
{"help", "List shell built-in commands", "help", shell_help},
|
||||
{NULL, NULL, NULL, NULL}
|
||||
};
|
||||
@ -396,11 +391,19 @@ static void checkJobs(struct jobSet *jobList)
|
||||
static int getCommand(FILE * source, char *command)
|
||||
{
|
||||
if (source == stdin) {
|
||||
fprintf(stdout, "BBSHELL %s %s", cwd, prompt);
|
||||
fflush(stdout);
|
||||
#ifdef BB_FEATURE_SH_COMMAND_EDITING
|
||||
cmdedit_read_input(fileno(stdin), fileno(stdout), command);
|
||||
int len;
|
||||
char *promptStr;
|
||||
len=fprintf(stdout, "BBSHELL %s %s", cwd, prompt);
|
||||
fflush(stdout);
|
||||
promptStr=(char*)malloc(sizeof(char)*(len+1));
|
||||
sprintf(promptStr, "BBSHELL %s %s", cwd, prompt);
|
||||
cmdedit_read_input(promptStr, fileno(stdin), fileno(stdout), command);
|
||||
free( promptStr);
|
||||
return 0;
|
||||
#else
|
||||
fprintf(stdout, "%s %s", cwd, prompt);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user