Build 601
This commit is contained in:
parent
852cf1bb17
commit
04449cb787
@ -282,6 +282,10 @@ void CommandDir (string argv[], int32 argc)
|
|||||||
ConsoleWrite("%#! Invalid path!\n", ColorLightRed); return;
|
ConsoleWrite("%#! Invalid path!\n", ColorLightRed); return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((temp->Flags & 0x7) == 0x1) {
|
||||||
|
ConsoleWrite("%#! Not a directory!\n", ColorLightRed); return;
|
||||||
|
}
|
||||||
|
|
||||||
// Write contents
|
// Write contents
|
||||||
ConsoleWrite ("Content of directory %#%s:\n\n", ColorWhite, argv[1]);
|
ConsoleWrite ("Content of directory %#%s:\n\n", ColorWhite, argv[1]);
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "commands.c"
|
#include "commands.c"
|
||||||
|
|
||||||
void _process_command (string params[16], int32 count);
|
void _process_command (string params[16], int32 count);
|
||||||
void _command_does_not_exist(string command);
|
int32 _command_does_not_exist(string command);
|
||||||
|
|
||||||
void ConsoleMain()
|
void ConsoleMain()
|
||||||
{
|
{
|
||||||
@ -57,9 +57,12 @@ void _process_command (string params[CONSOLE_MAX_PARAMS], int32 count)
|
|||||||
for (i = 0; i < ConsoleCommandsCount && Cmd == -1; i++)
|
for (i = 0; i < ConsoleCommandsCount && Cmd == -1; i++)
|
||||||
if (strcmp(params[0], ConsoleCommands[i]) == 0) Cmd = i;
|
if (strcmp(params[0], ConsoleCommands[i]) == 0) Cmd = i;
|
||||||
|
|
||||||
|
loop:
|
||||||
switch (Cmd)
|
switch (Cmd)
|
||||||
{
|
{
|
||||||
case -1: _command_does_not_exist(params[0]); break;
|
case -1: Cmd = _command_does_not_exist(params[0]);
|
||||||
|
if (Cmd != -1) goto loop;
|
||||||
|
break;
|
||||||
case 0: CommandOsver(); break;
|
case 0: CommandOsver(); break;
|
||||||
case 1: CommandTime(); break;
|
case 1: CommandTime(); break;
|
||||||
case 2: ConsoleClear(); break;
|
case 2: ConsoleClear(); break;
|
||||||
@ -78,18 +81,36 @@ void _process_command (string params[CONSOLE_MAX_PARAMS], int32 count)
|
|||||||
Color(0,ColorLightRed), Color(0,ColorWhite), params[0], Color(0,ColorLightRed)); break;
|
Color(0,ColorLightRed), Color(0,ColorWhite), params[0], Color(0,ColorLightRed)); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _command_does_not_exist(string command)
|
int32 _command_does_not_exist(string command)
|
||||||
{
|
{
|
||||||
|
// Try finding a command that starts with strlen(command) letters
|
||||||
|
int32 count, i, last;
|
||||||
|
for (i = 0, count = 0; i < ConsoleCommandsCount; i++)
|
||||||
|
if (!strncmp(command, ConsoleCommands[i], strlen(command))) { ++count; last = i; }
|
||||||
|
|
||||||
|
// Found a good command
|
||||||
|
if (count == 1) {
|
||||||
|
ConsoleWrite ("%#Did you mean %#%s%#?\n", ColorYellow, ColorWhite, ConsoleCommands[last], ColorYellow);
|
||||||
|
return last;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shorten if too long
|
||||||
if (strlen(command) > 20)
|
if (strlen(command) > 20)
|
||||||
{
|
{
|
||||||
command[18] = command[19] = command[20] = '.';
|
command[18] = command[19] = command[20] = '.';
|
||||||
command[21] = null;
|
command[21] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleWrite ("%#! Command %#%s%# does not exist!\n",
|
// Display error
|
||||||
Color(0,ColorLightRed), Color(0,ColorWhite), command, Color(0,ColorLightRed));
|
ConsoleWrite ("%#! Command %#%s%# does not exist!\n", Color(0,ColorLightRed), Color(0,ColorWhite), command, Color(0,ColorLightRed));
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
|
ConsoleWrite ("Available options:\n");
|
||||||
|
for (i = 0; i < ConsoleCommandsCount; i++)
|
||||||
|
if (!strncmp(command, ConsoleCommands[i], strlen(command))) ConsoleWrite ("\t>%# %s\n", ColorYellow, ConsoleCommands[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,8 @@ int32 LogWrite (uint8 error, string device, string format, ...)
|
|||||||
_write_char(' ');
|
_write_char(' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else return 0;
|
||||||
|
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
if (format[i] != '%' && allowed) _write_char(format[i]);
|
if (format[i] != '%' && allowed) _write_char(format[i]);
|
||||||
else
|
else
|
||||||
@ -61,14 +63,14 @@ int32 LogWrite (uint8 error, string device, string format, ...)
|
|||||||
// Character
|
// Character
|
||||||
case 'c': {
|
case 'c': {
|
||||||
char c = va_arg (args, char);
|
char c = va_arg (args, char);
|
||||||
if (allowed) _write_char(c);
|
_write_char(c);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// String
|
// String
|
||||||
case 's': {
|
case 's': {
|
||||||
int32* c = (int32*) va_arg (args, string);
|
int32* c = (int32*) va_arg (args, string);
|
||||||
if (allowed) _write_string((string)c);
|
_write_string((string)c);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,10 +78,8 @@ int32 LogWrite (uint8 error, string device, string format, ...)
|
|||||||
case 'd':
|
case 'd':
|
||||||
case 'i': {
|
case 'i': {
|
||||||
int32 c = va_arg(args, int32); char temp[32];
|
int32 c = va_arg(args, int32); char temp[32];
|
||||||
if (allowed) {
|
|
||||||
ConvertIntToString(temp, c, 10);
|
ConvertIntToString(temp, c, 10);
|
||||||
_write_string(temp);
|
_write_string(temp);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,20 +87,18 @@ int32 LogWrite (uint8 error, string device, string format, ...)
|
|||||||
case 'X':
|
case 'X':
|
||||||
case 'x': {
|
case 'x': {
|
||||||
int32 c = va_arg(args, int32); char temp[32];
|
int32 c = va_arg(args, int32); char temp[32];
|
||||||
if (allowed) {
|
|
||||||
ConvertUIntToString(temp, c, 16);
|
ConvertUIntToString(temp, c, 16);
|
||||||
_write_string(temp);
|
_write_string(temp);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Integers - unsigned
|
// Integers - unsigned
|
||||||
case 'u': {
|
case 'u': {
|
||||||
int32 c = va_arg(args, uint32); char temp[32];
|
int32 c = va_arg(args, uint32); char temp[32];
|
||||||
if (allowed) {
|
|
||||||
ConvertUIntToString (temp, c, 10);
|
ConvertUIntToString (temp, c, 10);
|
||||||
_write_string(temp);
|
_write_string(temp);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,13 +108,13 @@ int32 LogWrite (uint8 error, string device, string format, ...)
|
|||||||
ConsoleDefaultColor = c;
|
ConsoleDefaultColor = c;
|
||||||
break; }
|
break; }
|
||||||
|
|
||||||
default: va_end(args); return 1;
|
case '%' : _write_char('%'); break;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
ConsoleDefaultColor = 0x7;
|
ConsoleDefaultColor = temp_color;
|
||||||
ConsoleCursorUpdateHardware();
|
ConsoleCursorUpdateHardware();
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
#define OS_BUILD "0.1.0.590"
|
#define OS_BUILD "0.1.0.601"
|
||||||
|
BIN
build/console.o
BIN
build/console.o
Binary file not shown.
BIN
build/logger.o
BIN
build/logger.o
Binary file not shown.
BIN
kernel.bin
BIN
kernel.bin
Binary file not shown.
@ -1 +1 @@
|
|||||||
590
|
601
|
||||||
|
Loading…
Reference in New Issue
Block a user