55#include " ../Drivers/Keyboard.h"
66#include " ../Shell/Shell.h"
77#include " ../Include/multiboot.h"
8+ #include " ../Include/func.h"
9+ #include " Settings.h"
810#include " ../Hardcom/SerialPort.h"
911#include " ../CPU/syscall.h"
1012#include " ../Drivers/Mouse.h"
@@ -25,11 +27,16 @@ static uint8_t cursorx;
2527static bool useMouse = true ;
2628bool isused;
2729
30+ bool isPrefix;
31+ bool lkl;
32+ int index = 0 ;
33+ int spind = 0 ;
34+
2835static uint8_t x = 0 , y = 0 ;
2936
3037bool isTxtMode;
31- KeyboardDriver* kbrd;
32- DriverManager* drvMngr;
38+ KeyboardDriver * kbrd;
39+ DriverManager * drvMngr;
3340InterruptManager* intMngr;
3441SyscallHandler* shand;
3542extern const void *mb;
@@ -45,6 +52,7 @@ port8BIT port61(0x61);
4552int delay;
4653volatile int done;
4754static uint16_t *VideoMemory = (uint16_t *)0xb8000 ;
55+ Settings set;
4856
4957static void play_sound (uint32_t nFrequence)
5058{
@@ -724,7 +732,6 @@ void printf(char *str)
724732 for (int i = 0 ; i != 80 ; i++)
725733 VideoMemory[80 * 1 + i] = (VideoMemory[80 * 1 + i] & 0xFF00 ) | foo[i];
726734 printf (" \n " );
727- play_sound (440 );
728735 }
729736 }
730737
@@ -743,6 +750,42 @@ void PrintDate()
743750 printf (INTTOCHARPOINT (rtclock.year ));
744751}
745752
753+ void PrintPrompt ()
754+ {
755+ for (int i = 0 ; SPIndex > i; i++)
756+ {
757+ if (SP[i][0 ] == ' %' )
758+ {
759+ switch (SP[i + 1 ][0 ])
760+ {
761+ case ' d' :
762+ {
763+ PrintDate ();
764+ index = 2 ;
765+ break ;
766+ }
767+ case ' u' :
768+ {
769+ printf (set.UserName );
770+ index = 2 ;
771+ break ;
772+ }
773+ case ' h' :
774+ {
775+ printf (set.Hostname );
776+ index = 2 ;
777+ break ;
778+ }
779+ }
780+ }
781+ else if (index <= 0 )
782+ {
783+ printf (SP[i]);
784+ }
785+ index--;
786+ }
787+ }
788+
746789void printTime ()
747790{
748791 if (!done && delay)
@@ -1162,7 +1205,8 @@ extern "C" void kernelMain(const void *multiboot_structure, uint32_t multiboot_m
11621205
11631206 printf (" Allocating Memory....\n " );
11641207 PrintMEM (multiboot_structure);
1165- // PrintPartitions();
1208+
1209+ // PrintPartitions();
11661210 sp.logToSerialPort (" \n Hardware initialising stage 3 finished" );
11671211 detect_cpu ();
11681212
@@ -1186,9 +1230,10 @@ extern "C" void kernelMain(const void *multiboot_structure, uint32_t multiboot_m
11861230 printf (" Welcome to SectorOS Shell\n Run help to get the list of commands which is implemented \n \n " );
11871231 sp.logToSerialPort (" \n Kernel initialization surcessful.\n Giving execution access to the kernel.\n Awaiting user input..." );
11881232
1189- SPIndex = 15 ;
1233+ SPIndex = set. UserNameLength + set. HostnameLength + 5 + 11 ;
11901234
1191- asm (" int $0x80" :: " a" (1 ), " b" (" root@secos:~#> " )); // Used syscall to print this prompt
1235+ // asm("int $0x80" :: "a"(1), "b"("root@secos:~#> ")); // Used syscall to print this prompt
1236+ PrintPrompt ();
11921237 SPOMEMLOC (sp);
11931238
11941239 while (1 );
0 commit comments