Navigation Menu

Skip to content

Commit

Permalink
Merge of Fredrik Hultin command_line
Browse files Browse the repository at this point in the history
  • Loading branch information
Marty Connor committed Aug 9, 2006
1 parent 6915572 commit 41af745
Show file tree
Hide file tree
Showing 13 changed files with 1,184 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Makefile
Expand Up @@ -91,6 +91,7 @@ CFLAGS += -I include -I arch/$(ARCH)/include -I . -DARCH=$(ARCH)
CFLAGS += -Os -ffreestanding
CFLAGS += -Wall -W
CFLAGS += -g
CFLAGS += -DCONSOLE_DUAL -DCOMCONSOLE=0x3F8 -DCONSPEED=9600
CFLAGS += $(EXTRA_CFLAGS)
ASFLAGS += $(EXTRA_ASFLAGS)
LDFLAGS += $(EXTRA_LDFLAGS)
Expand Down Expand Up @@ -145,6 +146,8 @@ SRCDIRS += interface/pxe
SRCDIRS += tests
SRCDIRS += crypto
SRCDIRS += hci/mucurses
SRCDIRS += commandline
SRCDIRS += commandline/commands

# NON_AUTO_SRCS lists files that are excluded from the normal
# automatic build system.
Expand Down
81 changes: 81 additions & 0 deletions src/commandline/cmdline.c
@@ -0,0 +1,81 @@
#include <console.h>
#include "etherboot.h"
#include "cmdline.h"
#include "cmdlinelib.h"
#include "cmdlist.h"


#define CMDL_DELAY (2000 * TICKS_PER_SEC) / 1000;

void cmdl_exec_cmdline();
char cmdl_spin();

void cmdl_start()
{
unsigned int stop;
//int spin;

//printf("gPXE %s (GPL) etherboot.org ... ", VERSION);
printf("gPXE %s (GPL) etherboot.org\n", VERSION);

stop = currticks() + CMDL_DELAY;

while(currticks() < stop){

/*if(spin++ % 250 == 0){
putchar(8);
putchar(cmdl_spin());
}*/

if(iskey()){
if(getchar() == 2){
putchar('\n');
cmdl_exec_cmdline();
break;
}else{
putchar('\n');
printf("Skipping command line.\n");
break;
}
}
}
putchar('\n');

// empty the input buffer
while(iskey()) {
getchar();
}
}

/*char cmdl_spin()
{
static int state;*/
//int spinner[4] = {'-', '\\', '|', '/'}; <- undefined reference to memcpy!
/* int spinner[4];
spinner[0] = '-';
spinner[1] = '\\';
spinner[2] = '|';
spinner[3] = '/';
return spinner[state++ % 4];
}*/

void cmdl_exec_cmdline(){
cmd_line* cmd;
cmd = cmdl_create();

cmdl_setputchar(cmd, putchar);
cmdl_setgetchar(cmd, getchar);
cmdl_setprintf(cmd, printf);

cmdl_setpropmt(cmd, "gPXE>");

printf("Welcome to Etherboot\n\n");


cmdl_enterloop(cmd);

cmdl_free(cmd);
}

0 comments on commit 41af745

Please sign in to comment.