Index: soft/giet_vm/giet_libs/stdio.c
===================================================================
--- soft/giet_vm/giet_libs/stdio.c	(revision 641)
+++ soft/giet_vm/giet_libs/stdio.c	(revision 647)
@@ -49,5 +49,5 @@
 
 //////////////////////////////////////////////////////////////////////////////
-///////////////////// Task context  system calls /////////////////////////////
+///////////////////// Task related  system calls /////////////////////////////
 //////////////////////////////////////////////////////////////////////////////
 
@@ -73,4 +73,45 @@
 }
 
+//////////////////////////////
+void giet_exit( char* string ) 
+{
+    sys_call( SYSCALL_EXIT,
+              (unsigned int)string,
+              0, 0, 0 );
+}
+
+/////////////////////////////////////////
+void giet_assert( unsigned int condition,
+                  char*        string )
+{
+    if ( condition == 0 ) giet_exit( string );
+}
+
+//////////////////////////
+void giet_context_switch() 
+{
+    sys_call( SYSCALL_CTX_SWITCH,
+              0, 0, 0, 0 );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+///////////////////// Applications  system calls /////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////
+int giet_kill_application( char* name ) 
+{
+    return ( sys_call( SYSCALL_KILL_APP,
+                       (unsigned int)name,
+                       0, 0, 0 ) );
+}
+
+///////////////////////////////////////
+int giet_exec_application( char* name ) 
+{
+    return ( sys_call( SYSCALL_EXEC_APP,
+                       (unsigned int)name,
+                       0, 0, 0 ) );
+}
 
 //////////////////////////////////////////////////////////////////////////////
@@ -515,10 +556,12 @@
                     unsigned int bufsize ) 
 {
-    int           ret;
+    int           ret;                           // return value from syscalls
     unsigned char byte;
     unsigned int  index = 0;
+    unsigned int  string_cancel = 0x00082008;    // string containing BS/SPACE/BS
  
     while (index < (bufsize - 1)) 
     {
+        // get one character
         do 
         { 
@@ -526,5 +569,5 @@
                            (unsigned int)(&byte),
                            1,
-                           0xFFFFFFFF,
+                           0xFFFFFFFF,        // channel index from task context
                            0);
             if ( ret < 0 ) giet_exit("error in giet_tty_gets()");
@@ -532,20 +575,46 @@
         while (ret != 1);
 
-        if (byte == 0x0A)  /* LF */
+        // analyse character
+        if (byte == 0x0A)                          // LF  special character
         {
             break; 
         }
-        else if ((byte == 0x7F) && (index > 0))  /* DEL */
-        {
-            index--; 
-        }
-        else 
+        else if ( (byte == 0x7F) ||                // DEL special character
+                  (byte == 0x08) )                 // BS  special character
+        {
+            if ( index > 0 )     
+            {
+                index--; 
+
+                // cancel character
+                ret = sys_call( SYSCALL_TTY_WRITE,
+                                (unsigned int)(&string_cancel),
+                                3,
+                                0XFFFFFFFF,        // channel index from task context
+                                0 );
+                if ( ret < 0 ) giet_exit("error in giet_tty_gets()");
+            }
+        }
+        else if ( (byte < 0x20) || (byte > 0x7F) )  // non printable characters
+        {
+        }
+        else                                       // take all other characters
         {
             buf[index] = byte;
             index++;
+
+            // echo
+            ret = sys_call( SYSCALL_TTY_WRITE,
+                            (unsigned int)(&byte),
+                            1,
+                            0XFFFFFFFF,        // channel index from task context
+                            0 );
+            if ( ret < 0 ) giet_exit("error in giet_tty_gets()");
+     
         }
     }
     buf[index] = 0;
-}
+
+}   // end giet_tty_gets()
 
 ///////////////////////////////////////
@@ -561,5 +630,4 @@
     unsigned int  length = 0;
     unsigned int  i;
-    unsigned int  channel = 0xFFFFFFFF;
     int           ret;      // return value from syscalls
  
@@ -573,5 +641,5 @@
                             (unsigned int)(&string_byte),
                             1,
-                            channel, 
+                            0xFFFFFFFF,    // channel index from task context
                             0); 
             if ( ret < 0 ) giet_exit("error in giet_tty_getw()");
@@ -580,5 +648,5 @@
 
         // analyse character
-        if ((string_byte > 0x2F) && (string_byte < 0x3A))  /* decimal character */
+        if ((string_byte > 0x2F) && (string_byte < 0x3A))  // decimal character 
         {
             buf[length] = (unsigned char)string_byte;
@@ -589,14 +657,14 @@
                             (unsigned int)(&string_byte),
                             1, 
-                            channel, 
+                            0xFFFFFFFF,    // channel index from task context
                             0 );
-            if ( ret < 0 ) giet_exit("error in giet_tty_gets()");
-        }
-        else if (string_byte == 0x0A)                     /* LF character */
+            if ( ret < 0 ) giet_exit("error in giet_tty_getw()");
+        }
+        else if (string_byte == 0x0A)                     // LF character 
         {
             done = 1;
         }
-        else if ( (string_byte == 0x7F) ||                /* DEL character */
-                  (string_byte == 0x08) )                 /* BS  character */
+        else if ( (string_byte == 0x7F) ||                // DEL character
+                  (string_byte == 0x08) )                 // BS  character 
         {
             if ( length > 0 ) 
@@ -607,5 +675,5 @@
                                 (unsigned int)(&string_cancel),
                                 3, 
-                                channel, 
+                                0xFFFFFFFF,    // channel index from task context
                                 0 );
                 if ( ret < 0 ) giet_exit("error in giet_tty_getw()");
@@ -646,5 +714,5 @@
                             (unsigned int)(&string_cancel),
                             3, 
-                            channel, 
+                            0xFFFFFFFF,    // channel index from task context
                             0 );
             if ( ret < 0 ) giet_exit("error in giet_tty_getw()");
@@ -655,5 +723,5 @@
                         (unsigned int)(&string_byte),
                         1, 
-                        channel, 
+                        0xFFFFFFFF,    // channel index from task context
                         0 );
         if ( ret < 0 ) giet_exit("error in giet_tty_getw()");
@@ -662,5 +730,5 @@
         *val = 0;
     }
-}
+}   // end giet_tty_getw()
 
 
@@ -999,42 +1067,4 @@
 ///////////////////// Miscellaneous system calls /////////////////////////////////
 //////////////////////////////////////////////////////////////////////////////////
-
-//////////////////////////////
-void giet_exit( char* string ) 
-{
-    sys_call( SYSCALL_EXIT,
-              (unsigned int)string,
-              0, 0, 0 );
-}
-
-//////////////////////////////
-void giet_kill( char* name ) 
-{
-    sys_call( SYSCALL_KILL_APP,
-              (unsigned int)name,
-              0, 0, 0 );
-}
-
-//////////////////////////////
-void giet_exec( char* name ) 
-{
-    sys_call( SYSCALL_EXIT,
-              (unsigned int)name,
-              0, 0, 0 );
-}
-
-/////////////////////////////////////////
-void giet_assert( unsigned int condition,
-                  char*        string )
-{
-    if ( condition == 0 ) giet_exit( string );
-}
-
-//////////////////////////
-void giet_context_switch() 
-{
-    sys_call( SYSCALL_CTX_SWITCH,
-              0, 0, 0, 0 );
-}
 
 /////////////////////////////////////////////////
