Added the drawtitle function to console

Added ability to pick a bg preset for the title bar
Added counting program
Added function to set the current consoles title name
Removed some of the debug code
This commit is contained in:
iDunnoDev
2022-12-16 15:23:38 +00:00
committed by iDunnoDev
parent 924d90c066
commit c65c58a954
11 changed files with 284 additions and 52 deletions

View File

@ -1,14 +1,53 @@
#include "types.h"
#include "user.h"
int main(int argc, char *argv[]) {
//int consoles = 0;
int main(int argc, char *argv[]) {
int pid;
//char* comment = "";
int bgcol = 0x4F00;
for (int i = 1; i < argc; i++) {
if (strcmp(argv[i], "-c") == 0) {
if (strcmp(argv[i], "-bg") == 0)
{
int selopt = atoi(argv[i + 1]);
switch(selopt)
{
case 1:
bgcol = 0x1F00;
break;
case 2:
bgcol = 0x2F00;
break;
case 3:
bgcol = 0x3F00;
break;
case 4:
bgcol = 0x5F00;
break;
case 5:
bgcol = 0xF000;
break;
case 6:
bgcol = 0x8F00;
break;
case 7:
bgcol = 0x9F00;
break;
case 8:
bgcol = 0xAF00;
break;
case 9:
bgcol = 0xCF00;
break;
}
}
else if (strcmp(argv[i], "-help") == 0)
{
printf(1, "Creates a new virtual console.\n");
printf(1, "Options:\n");
printf(1, "-bg [0 - 9] : Sets a background preset for the title bar.");
exit();
return 0;
}
}
@ -17,7 +56,7 @@ int main(int argc, char *argv[]) {
printf(1, "screen: fork failed\n");
}
if (pid == 0) {
if (screen() != 0)
if (screen(bgcol) != 0)
{
exec("sh", argv);
printf(1, "screen: exec sh failed\n");