Build 601
This commit is contained in:
		| @@ -282,6 +282,10 @@ void CommandDir (string argv[], int32 argc) | ||||
| 		ConsoleWrite("%#! Invalid path!\n", ColorLightRed); return; | ||||
| 	} | ||||
|  | ||||
| 	if ((temp->Flags & 0x7) == 0x1) 	{ | ||||
| 		ConsoleWrite("%#! Not a directory!\n", ColorLightRed); return; | ||||
| 	} | ||||
|  | ||||
| 	// Write contents | ||||
| 	ConsoleWrite ("Content of directory %#%s:\n\n", ColorWhite, argv[1]); | ||||
|  | ||||
|   | ||||
| @@ -4,7 +4,7 @@ | ||||
| #include "commands.c" | ||||
|  | ||||
| void _process_command (string params[16], int32 count); | ||||
| void _command_does_not_exist(string command); | ||||
| int32 _command_does_not_exist(string command); | ||||
|  | ||||
| void ConsoleMain() | ||||
| { | ||||
| @@ -57,9 +57,12 @@ void _process_command (string params[CONSOLE_MAX_PARAMS], int32 count) | ||||
| 	for (i = 0; i < ConsoleCommandsCount && Cmd == -1; i++) | ||||
| 		if (strcmp(params[0], ConsoleCommands[i]) == 0) Cmd = i; | ||||
|  | ||||
| loop: | ||||
| 	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 1: CommandTime(); 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; | ||||
| 	} | ||||
|  | ||||
| 	 | ||||
| } | ||||
|  | ||||
| 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) | ||||
| 	{ | ||||
| 		command[18] = command[19] = command[20] = '.'; | ||||
| 		command[21] = null; | ||||
| 	} | ||||
|  | ||||
| 	ConsoleWrite ("%#! Command %#%s%# does not exist!\n", | ||||
| 				Color(0,ColorLightRed), Color(0,ColorWhite), command, Color(0,ColorLightRed)); | ||||
| 	// Display error | ||||
| 	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(' '); | ||||
| 	} | ||||
|  | ||||
| 	else return 0; | ||||
|  | ||||
| 	for (i = 0; i < len; i++) | ||||
| 		if (format[i] != '%' && allowed) _write_char(format[i]); | ||||
| 		else | ||||
| @@ -61,14 +63,14 @@ int32 LogWrite (uint8 error, string device, string format, ...) | ||||
| 				// Character | ||||
| 				case 'c': { | ||||
| 					char c = va_arg (args, char); | ||||
| 					if (allowed) _write_char(c); | ||||
| 					_write_char(c); | ||||
| 					break; | ||||
| 				} | ||||
|  | ||||
| 				// String | ||||
| 				case 's': { | ||||
| 					int32* c = (int32*) va_arg (args, string); | ||||
| 					if (allowed) _write_string((string)c); | ||||
| 					_write_string((string)c); | ||||
| 					break; | ||||
| 				} | ||||
|  | ||||
| @@ -76,10 +78,8 @@ int32 LogWrite (uint8 error, string device, string format, ...) | ||||
| 				case 'd': | ||||
| 				case 'i': { | ||||
| 					int32 c = va_arg(args, int32); char temp[32]; | ||||
| 					if (allowed) { | ||||
| 						ConvertIntToString(temp, c, 10); | ||||
| 						_write_string(temp); | ||||
| 					} | ||||
| 					ConvertIntToString(temp, c, 10); | ||||
| 					_write_string(temp); | ||||
| 					break; | ||||
| 				} | ||||
|  | ||||
| @@ -87,20 +87,18 @@ int32 LogWrite (uint8 error, string device, string format, ...) | ||||
| 				case 'X': | ||||
| 				case 'x': { | ||||
| 					int32 c = va_arg(args, int32); char temp[32]; | ||||
| 					if (allowed) { | ||||
| 						ConvertUIntToString(temp, c, 16); | ||||
| 						_write_string(temp); | ||||
| 					} | ||||
| 					ConvertUIntToString(temp, c, 16); | ||||
| 					_write_string(temp); | ||||
|  | ||||
| 					break; | ||||
| 				} | ||||
|  | ||||
| 				// Integers - unsigned | ||||
| 				case 'u': { | ||||
| 					int32 c = va_arg(args, uint32); char temp[32]; | ||||
| 					if (allowed) { | ||||
| 						ConvertUIntToString (temp, c, 10); | ||||
| 						_write_string(temp); | ||||
| 					} | ||||
| 					ConvertUIntToString (temp, c, 10); | ||||
| 					_write_string(temp); | ||||
|  | ||||
| 					break; | ||||
| 					} | ||||
|  | ||||
| @@ -110,13 +108,13 @@ int32 LogWrite (uint8 error, string device, string format, ...) | ||||
| 					ConsoleDefaultColor = c; | ||||
| 					break; } | ||||
|  | ||||
| 				default: va_end(args); return 1; | ||||
| 				case '%' : _write_char('%'); break; | ||||
| 			}; | ||||
| 		} | ||||
|  | ||||
| 	va_end(args); | ||||
|  | ||||
| 	ConsoleDefaultColor = 0x7; | ||||
| 	ConsoleDefaultColor = temp_color; | ||||
| 	ConsoleCursorUpdateHardware(); | ||||
| 	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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user