summaryrefslogtreecommitdiff
path: root/board/MAI/bios_emulator/scitech/src/v86bios/command.c
diff options
context:
space:
mode:
authorwdenk <wdenk>2002-11-19 11:04:11 +0000
committerwdenk <wdenk>2002-11-19 11:04:11 +0000
commitc7de829c796978e519984df2f1c8cfcf921a39a4 (patch)
tree43e42aa9a09f5265783c1622a5cea080471ef50e /board/MAI/bios_emulator/scitech/src/v86bios/command.c
parent2262cfeef91458b01a1bfe3812ccbbfdf8b82807 (diff)
* Patch by Thomas Frieden, 13 Nov 2002:
Add code for AmigaOne board (preliminary merge to U-Boot, still WIP) * Patch by Jon Diekema, 12 Nov 2002: - Adding URL for IEEE OUI lookup - Making the autoboot #defines dependent on CONFIG_AUTOBOOT_KEYED being defined. - In the CONFIG_EXTRA_ENV_SETTINGS #define, the root-on-initrd and root-on-nfs macros are designed to switch how the default boot method gets defined.
Diffstat (limited to 'board/MAI/bios_emulator/scitech/src/v86bios/command.c')
-rw-r--r--board/MAI/bios_emulator/scitech/src/v86bios/command.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/board/MAI/bios_emulator/scitech/src/v86bios/command.c b/board/MAI/bios_emulator/scitech/src/v86bios/command.c
new file mode 100644
index 0000000000..3a468da313
--- /dev/null
+++ b/board/MAI/bios_emulator/scitech/src/v86bios/command.c
@@ -0,0 +1,41 @@
+#include <stdio.h>
+#include <readline/readline.h>
+#include <readline/history.h>
+#include <malloc.h>
+
+#define PROMPT ">"
+
+
+void
+getline(char *buf,int *num,int max_num)
+{
+ static int line_len = 0;
+ static char *line = NULL;
+ static char *line_pointer = NULL;
+ static int len = 0;
+ int tmp_len;
+ char *buff;
+
+ if (len <= 0) {
+ buff = readline(PROMPT);
+ add_history(buff);
+
+ if ((tmp_len = strlen(buff)) > line_len) {
+ free(line);
+ line = malloc(tmp_len);
+ line_len = tmp_len;
+ }
+ sprintf(line,"%s\n",buff);
+ free(buff);
+ line_pointer = line;
+ len = strlen(line);
+ }
+
+ *num = max_num > len? len : max_num;
+ strncpy(buf,line_pointer,*num);
+ line_pointer = line_pointer + *num;
+ len = len - *num;
+}
+
+
+