[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH 1/1] lib/vfscore: Add backspace support to the stdio


  • To: "minios-devel@xxxxxxxxxxxxx" <minios-devel@xxxxxxxxxxxxx>
  • From: Vlad-Andrei BĂDOIU (78692) <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
  • Date: Thu, 29 Aug 2019 17:05:09 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=stud.acs.upb.ro; dmarc=pass action=none header.from=stud.acs.upb.ro; dkim=pass header.d=stud.acs.upb.ro; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UW7yWHGraLOhSrlYjeIUj6OOKZ/yPFBgwXAutYCsLpI=; b=C7gA+8mECSyq72G3AQl9KY7j9lKloq443LK/IK4Xw1CCIlVzRplT59GQSM/KZBeAQfoJt8YgUue3sZlKgax6ohY59LoegxG29mIUO7csNMcD0r60KClUQQZPPIx2VZZQh4kjgAb3bS/9JtVg+8mGUHCvw3OBqenUP9Mf5195qshncJmst/UcJAqz9nOjYNwwJu0O+uqp0V3Oq1q0akH4caxQfsJZjkQJx8VNU6eDOlbPi6eHY+cL1gSIrQ21xdxDKaOrivX1BJyVa8I/bYF7uBhoxkuX+REWJAkhk0Cv6kMiyDPfc0/jnouO0xFFn9e3gwFBRVkPbsDm2r4KeBtGDg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gkCS1HQV9C/5LP/uscQU4Id6xjk4npM3sloYYpp2isYb/XbC8vj/NSoAVUoVGcoybCbVRZInzq38KYlIEUHByjTZPgjO3fIJnhbpNfJM3jn4ocTd4EB2iUXNDMu+lVjgEhQTGHPrJ/q3ImT/KlieCpSdHq4ItTHZedrSBE0G88tOSTpnInz1M3Ccg42PHAJj4jmNcCnGfBugq/aNBxQJ66tmIbLAtRMWMJRMPYYBhyw2ri05lxGKaYFY0B4NOlRpTdnk0JfwtJvm9afsJer1IiADH2UMrJcG2KpCm7Jnz/3WD3F6J+HO7ElLd74NFZUBHiYZkuKP49kyVVRYL+oLmw==
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=vlad_andrei.badoiu@xxxxxxxxxxxxxxx;
  • Cc: "simon.kuenzer@xxxxxxxxx" <simon.kuenzer@xxxxxxxxx>, Vlad-Andrei BĂDOIU (78692) <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>, "costin.lupu@xxxxxxxxx" <costin.lupu@xxxxxxxxx>
  • Delivery-date: Thu, 29 Aug 2019 17:05:16 +0000
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>
  • Thread-index: AQHVXovpRdrvzirv+U+UF/UbJLutBQ==
  • Thread-topic: [UNIKRAFT PATCH 1/1] lib/vfscore: Add backspace support to the stdio

This patch adds basic backspace support to the stdio. This patch does
not handle the cursor differently for the \t. Removing the last
character is done by outputing \b \b to the console.

Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
---
 lib/vfscore/stdio.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/lib/vfscore/stdio.c b/lib/vfscore/stdio.c
index 08335367..f23401ff 100644
--- a/lib/vfscore/stdio.c
+++ b/lib/vfscore/stdio.c
@@ -85,9 +85,19 @@ static int __read_fn(void *dst, void *src __unused, size_t 
*cnt)
                *(buf - 1) = *(buf - 1) == '\r' ?
                                        '\n' : *(buf - 1);
 
-               /* Echo the input */
-               ukplat_coutk(buf - bytes_read, bytes_read);
-               bytes_total += bytes_read;
+               if (*(buf - 1) == '\177') {
+                       /* If this is not the first byte */
+                       if (buf - 1 != dst) {
+                               ukplat_coutk("\b \b", 3);
+                               buf -= 1;
+                               bytes_total -= 1;
+                       }
+                       buf -= 1;
+               } else {
+                       /* Echo the input */
+                       ukplat_coutk(buf - bytes_read, bytes_read);
+                       bytes_total += bytes_read;
+               }
 
        } while (bytes_total < count && *(buf - 1) != '\n'
                        && *(buf - 1) != VEOF);
-- 
2.20.1


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.