Index: /trunk/src/lib/graphics/text_engine.cc
===================================================================
--- /trunk/src/lib/graphics/text_engine.cc	(revision 5071)
+++ /trunk/src/lib/graphics/text_engine.cc	(revision 5072)
@@ -95,6 +95,14 @@
   if (this->text)
     delete []this->text;
-  this->text = new char[strlen(text)+1];
-  strcpy(this->text, text);
+  if (text != NULL)
+  {
+    this->text = new char[strlen(text)+1];
+    strcpy(this->text, text);
+  }
+  else
+  {
+    this->text = new char[1];
+    strcpy(this->text, "");
+  }
 
 
Index: /trunk/src/orxonox.cc
===================================================================
--- /trunk/src/orxonox.cc	(revision 5071)
+++ /trunk/src/orxonox.cc	(revision 5072)
@@ -49,4 +49,5 @@
 #include "class_list.h"
 #include "substring.h"
+#include "shell.h"
 
 #include <string.h>
@@ -93,4 +94,5 @@
   delete GarbageCollector::getInstance();
   FastFactory::deleteAll();
+  delete Shell::getInstance();
 
   delete EventHandler::getInstance();
@@ -247,4 +249,5 @@
 
   CDEngine::getInstance();
+  Shell::getInstance();
 
   return 0;
Index: /trunk/src/util/shell.cc
===================================================================
--- /trunk/src/util/shell.cc	(revision 5071)
+++ /trunk/src/util/shell.cc	(revision 5072)
@@ -18,4 +18,7 @@
 #include "shell.h"
 
+#include "text_engine.h"
+#include "list.h"
+
 using namespace std;
 
@@ -26,5 +29,12 @@
 Shell::Shell ()
 {
-   this->setClassID(CL_SHELL, "Shell");
+  this->setClassID(CL_SHELL, "Shell");
+  this->setName("Shell");
+
+  this->bufferText = new tList<Text>;
+  this->buffer = new tList<char>;
+
+  this->setBufferSize(100);
+  this->setBufferDisplaySize(5);
 }
 
@@ -42,8 +52,20 @@
 }
 
-
-
-
-void setBufferDisplaySize(unsigned int bufferDisplaySize);
+void Shell::setBufferDisplaySize(unsigned int bufferDisplaySize)
+{
+  this->bufferDisplaySize = bufferDisplaySize;
+
+  while (bufferDisplaySize < this->bufferText->getSize())
+  {
+    delete this->bufferText->lastElement();
+    this->bufferText->removeLast();
+  }
+  while(bufferDisplaySize > this->bufferText->getSize())
+  {
+    Text* newText = TextEngine::getInstance()->createText("fonts/earth.ttf", 30, TEXT_DYNAMIC, 0, 255, 0);
+    this->bufferText->add(newText);
+    // add the Text here
+  }
+}
 
 /**
@@ -52,5 +74,28 @@
 void Shell::flushBuffers()
 {
-
+  // remove all chars from the BufferTexts.
+  tIterator<Text>* textIterator = this->bufferText->getIterator();
+  Text* textElem = textIterator->nextElement();
+
+  while (textElem != NULL)
+  {
+    textElem->setText(NULL);
+
+    textElem = textIterator->nextElement();
+  }
+  delete textIterator;
+
+
+  // delete all the Chars in the Buffers
+  tIterator<char>* charIterator = this->buffer->getIterator();
+  char* charElem = charIterator->nextElement();
+
+  while (charElem != NULL)
+  {
+    delete charElem;
+
+    charElem = charIterator->nextElement();
+  }
+  delete charIterator;
 }
 
@@ -59,7 +104,22 @@
  * @param line the Line as in the first argument in printf
  * @param args the arguments as a va_list
+ *
+ * @todo optimize
  */
 void Shell::addBufferLine(const char* line, va_list args)
 {
+  char tmp[1024];// = new char*
+  vsprintf(tmp, line, args);
+
+  char* newLine = new char[strlen(tmp)+1];
+  strcpy(newLine, tmp);
+
+  this->buffer->add(newLine);
+
+  if (this->buffer->getSize() > this->bufferSize)
+  {
+    delete this->buffer->firstElement();
+    this->buffer->remove(this->buffer->firstElement());
+  }
 }
 
@@ -67,4 +127,6 @@
  * moves the buffer around lineCount lines upwards (negative values move down)
  * @param lineCount the Count of lines to move upwards
+ *
+ * @todo
  */
 void Shell::moveBuffer(int lineCount)
@@ -78,4 +140,19 @@
 const char* Shell::getBufferLine(unsigned int lineNumber)
 {
+  tIterator<char>* charIterator = this->buffer->getIterator();
+  char* charElem = charIterator->nextElement();
+
+  int i = 1;
+  while (charElem != NULL)
+  {
+    if (i++ < lineNumber)
+    {
+      delete charIterator;
+      return charElem;
+    }
+
+    charElem = charIterator->nextElement();
+  }
+  delete charIterator;
 }
 
@@ -86,4 +163,11 @@
 void Shell::flushInputLine()
 {
+  if (likely(this->inputLine != NULL))
+  {
+    delete [] this->inputLine;
+  }
+  this->inputLine = new char[1];
+  *this->inputLine = '\0';
+
 }
 
@@ -94,4 +178,9 @@
 void Shell::addCharacter(char character)
 {
+  char* addCharLine = new char[strlen(inputLine)+2];
+
+  sprintf(addCharLine, "%s%c", this->inputLine, character);
+  delete this->inputLine;
+  this->inputLine = addCharLine;
 }
 
@@ -102,4 +191,9 @@
 void Shell::addCharacters(const char* characters)
 {
+  char* addCharLine = new char[strlen(inputLine)+strlen(characters)+1];
+
+  sprintf(addCharLine, "%s%s", this->inputLine, characters);
+  delete this->inputLine;
+  this->inputLine = addCharLine;
 }
 
@@ -110,4 +204,12 @@
 void Shell::removeCharacters(unsigned int characterCount)
 {
+  if (characterCount > strlen(this->inputLine))
+    characterCount = strlen(this->inputLine);
+
+  char* removeCharLine = new char[strlen(inputLine)-characterCount+1];
+
+  strncpy(removeCharLine, this->inputLine, strlen(inputLine)-characterCount);
+  delete this->inputLine;
+  this->inputLine = removeCharLine;
 }
 
Index: /trunk/src/util/shell.h
===================================================================
--- /trunk/src/util/shell.h	(revision 5071)
+++ /trunk/src/util/shell.h	(revision 5072)
@@ -35,5 +35,5 @@
     virtual ~Shell();
     /** @returns a Pointer to the only object of this Class */
-    inline static Shell* getInstance(void) { if (!Shell::singletonRef) Shell::singletonRef = new Shell();  return Shell::singletonRef; };
+    inline static Shell* getInstance() { if (!Shell::singletonRef) Shell::singletonRef = new Shell();  return Shell::singletonRef; };
 
 
@@ -70,14 +70,14 @@
   private:
     Shell();
-    static Shell*          singletonRef;
+    static Shell*          singletonRef;           //!< The singleton-reference to the only memeber of this class.
 
-    unsigned int           bufferSize;
-    unsigned int           bufferDisplaySize;
+    unsigned int           bufferSize;             //!< The Size of the buffer
+    unsigned int           bufferDisplaySize;      //!< The Size of the Display-buffer, in lines (not in characters)
 
-    char*                  inputLine;
+    char*                  inputLine;              //!< the Char-Array of the Buffer
 
-    tList<char>*           buffer;
+    tList<char>*           buffer;                 //!< A list of stored char-arrays(strings) to store the history
 
-    tList<Text>*           bufferText;             //!< A list of sored bufferLines of the Shell
+    tList<Text>*           bufferText;             //!< A list of stored bufferTexts for the display of the buffer
     Text*                  inputLineText;          //!< The inputLine of the Shell
 };
