Files
xv6-custom-os/screen.c
iDunnoDev c65c58a954 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
2022-12-16 15:23:38 +00:00

70 lines
1.8 KiB
C

#include "types.h"
#include "user.h"
int main(int argc, char *argv[]) {
int pid;
int bgcol = 0x4F00;
for (int i = 1; i < argc; i++) {
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;
}
}
pid = fork();
if (pid < 0) {
printf(1, "screen: fork failed\n");
}
if (pid == 0) {
if (screen(bgcol) != 0)
{
exec("sh", argv);
printf(1, "screen: exec sh failed\n");
}
else
{
printf(1, "screen: failed to create a new console\n");
}
}
exit();
}