diff --git a/libc/include/brand.h b/libc/include/brand.h
new file mode 100644
index 00000000..50c40eea
--- /dev/null
+++ b/libc/include/brand.h
@@ -0,0 +1,103 @@
+/*******************************************************************************
+
+ Copyright(C) Jonas 'Sortie' Termansen 2013.
+
+ This file is part of the Sortix C Library.
+
+ The Sortix C Library is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or (at your
+ option) any later version.
+
+ The Sortix C Library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with the Sortix C Library. If not, see .
+
+ brand.h
+ Macros expanding to the name of the operating system and distribution.
+
+*******************************************************************************/
+
+#ifndef INCLUDE_BRAND_H
+#define INCLUDE_BRAND_H
+
+/* The name of the distribution of the operation system. */
+#define BRAND_DISTRIBUTION_NAME "Sortix"
+
+/* The website of the distribution. */
+#define BRAND_DISTRIBUTION_WEBSITE "http://sortix.org"
+
+/* The name of the operating system. */
+#define BRAND_OPERATING_SYSTEM_NAME "Sortix"
+
+/* The name of the kernel. */
+#define BRAND_KERNEL_NAME "Sortix Kernel"
+
+/* Ascii version of the maxsi logo. */
+#define BRAND_MAXSI \
+" _ \n" \
+" / \\ \n" \
+" /\\ /\\ / \\ \n" \
+" / \\ / \\ | | \n" \
+" / \\/ \\ | | \n" \
+" | O O \\_______________________ / | \n" \
+" | | \n" \
+" | \\_______/ / \n" \
+" \\ / \n" \
+" ------ --------------- ---/ \n" \
+" / \\ / \\ \n" \
+" / \\ / \\ \n" \
+" / \\ / \\ \n" \
+" /_____________\\ /____________\\ \n" \
+" \n" \
+
+/* Dead version of the maxsi logo, used for panic screens and such. */
+#define BRAND_MAXSI_DEAD \
+" _ \n" \
+" / \\ \n" \
+" /\\ /\\ / \\ \n" \
+" / \\ / \\ | | \n" \
+" / \\/ \\ | | \n" \
+" | X X \\_______________________ / | \n" \
+" | | \n" \
+" | _________ / \n" \
+" \\ / \n" \
+" ------ --------------- ---/ \n" \
+" / \\ / \\ \n" \
+" / \\ / \\ \n" \
+" / \\ / \\ \n" \
+" /_____________\\ /____________\\ \n" \
+" \n" \
+
+/* Message printed by the kernel just after boot. */
+#define BRAND_KERNEL_BOOT_MESSAGE \
+"\e[37;41m\e[2J" \
+BRAND_MAXSI \
+" BOOTING OPERATING SYSTEM... "
+
+/* Message printed by init after it takes control. */
+#define BRAND_INIT_BOOT_MESSAGE \
+"\r\e[m\e[J"
+
+/* Message printed when a critical error occurs and the system panics. */
+#define BRAND_PANIC_LONG \
+"\e[m\e[31;40m\e[2J\e[H" \
+BRAND_MAXSI_DEAD \
+" \n" \
+" RED MAXSI OF DEATH \n" \
+" \n" \
+"A critical error occured within the kernel of the operating system and it has\n" \
+"forcefully shut down as a last resort.\n" \
+"\n" \
+"Technical information:\n" \
+
+/* Short version of the panic version that consumes minimal space. */
+#define BRAND_PANIC_SHORT \
+"\e[m\e[31m\e[0J" \
+"RED MAXSI OF DEATH\n" \
+
+#endif
diff --git a/sortix/kernel.cpp b/sortix/kernel.cpp
index 9d6467aa..9570847a 100644
--- a/sortix/kernel.cpp
+++ b/sortix/kernel.cpp
@@ -26,6 +26,7 @@
#include
#include
+#include
#include
#include
#include
@@ -104,30 +105,9 @@ extern "C" { size_t stack[STACK_SIZE / sizeof(size_t)] = {0}; }
namespace Sortix {
-void DoMaxsiLogo()
-{
- Log::Print("\e[37;41m\e[2J"); // Make the background color red.
- Log::Print(" _ \n");
- Log::Print(" / \\ \n");
- Log::Print(" /\\ /\\ / \\ \n");
- Log::Print(" / \\ / \\ | | \n");
- Log::Print(" / \\/ \\ | | \n");
- Log::Print(" | O O \\_______________________ / | \n");
- Log::Print(" | | \n");
- Log::Print(" | \\_______/ / \n");
- Log::Print(" \\ / \n");
- Log::Print(" ------ --------------- ---/ \n");
- Log::Print(" / \\ / \\ \n");
- Log::Print(" / \\ / \\ \n");
- Log::Print(" / \\ / \\ \n");
- Log::Print(" /_____________\\ /____________\\ \n");
- Log::Print(" \n");
-}
-
void DoWelcome()
{
- DoMaxsiLogo();
- Log::Print(" BOOTING OPERATING SYSTEM... ");
+ Log::Print(BRAND_KERNEL_BOOT_MESSAGE);
}
// Forward declarations.
diff --git a/sortix/kernelinfo.cpp b/sortix/kernelinfo.cpp
index 983fad8a..494c069d 100644
--- a/sortix/kernelinfo.cpp
+++ b/sortix/kernelinfo.cpp
@@ -22,6 +22,7 @@
*******************************************************************************/
+#include
#include
#include
@@ -38,7 +39,7 @@ namespace Info {
const char* KernelInfo(const char* req)
{
- if ( strcmp(req, "name") == 0 ) { return "Sortix"; }
+ if ( strcmp(req, "name") == 0 ) { return BRAND_KERNEL_NAME; }
if ( strcmp(req, "version") == 0 ) { return VERSIONSTR; }
if ( strcmp(req, "builddate") == 0 ) { return __DATE__; }
if ( strcmp(req, "buildtime") == 0 ) { return __TIME__; }
diff --git a/sortix/panic.cpp b/sortix/panic.cpp
index c6e41587..72b85f88 100644
--- a/sortix/panic.cpp
+++ b/sortix/panic.cpp
@@ -22,6 +22,7 @@
*******************************************************************************/
+#include
#include
#include
@@ -43,35 +44,12 @@ static bool doublepanic = false;
static void PanicLogoLong()
{
- Log::Print("\e[m\e[31;40m\e[2J\e[H");
- Log::Print(" _ \n");
- Log::Print(" / \\ \n");
- Log::Print(" /\\ /\\ / \\ \n");
- Log::Print(" / \\ / \\ | | \n");
- Log::Print(" / \\/ \\ | | \n");
- Log::Print(" | X X \\_______________________ / | \n");
- Log::Print(" | | \n");
- Log::Print(" | _________ / \n");
- Log::Print(" \\ / \n");
- Log::Print(" ------ --------------- ---/ \n");
- Log::Print(" / \\ / \\ \n");
- Log::Print(" / \\ / \\ \n");
- Log::Print(" / \\ / \\ \n");
- Log::Print(" /_____________\\ /____________\\ \n");
- Log::Print(" \n");
- Log::Print(" \n");
- Log::Print(" RED MAXSI OF DEATH \n");
- Log::Print(" \n");
- Log::Print("A critical error occured within the kernel of the operating system and it has\n");
- Log::Print("forcefully shut down as a last resort.\n");
- Log::Print("\n");
- Log::Print("Technical information:\n");
+ Log::PrintF(BRAND_PANIC_LONG);
}
static void PanicLogoShort()
{
- Log::Print("\e[m\e[31m\e[0J");
- Log::Print("RED MAXSI OF DEATH\n");
+ Log::Print(BRAND_PANIC_SHORT);
}
void PanicInit()
diff --git a/utils/init.cpp b/utils/init.cpp
index bfca8a3d..781db6a2 100644
--- a/utils/init.cpp
+++ b/utils/init.cpp
@@ -28,6 +28,7 @@
#include
#include
+#include
#include
#include
#include
@@ -454,7 +455,7 @@ int main(int /*argc*/, char* /*argv*/[])
return 2;
// Reset the terminal's color and the rest of it.
- printf("\r\e[m\e[J");
+ printf(BRAND_INIT_BOOT_MESSAGE);
fflush(stdout);
// Set the default file creation mask.
diff --git a/utils/uname.cpp b/utils/uname.cpp
index 552b6815..ed31e13f 100644
--- a/utils/uname.cpp
+++ b/utils/uname.cpp
@@ -21,13 +21,15 @@
*******************************************************************************/
#include
-#include
-#include
-#include
-#include
+
+#include
#include
#include
#include
+#include
+#include
+#include
+#include
#if !defined(VERSIONSTR)
#define VERSIONSTR "unknown version"
@@ -99,7 +101,7 @@ const char* GetHardwarePlatform()
const char* GetOperatingSystem()
{
- return GetKernelName();
+ return BRAND_OPERATING_SYSTEM_NAME;
}
bool has_printed = false;