[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



Hi Vlad,

Please see a small comment inline.

Thanks,

-- Felipe

    Subject: [Minios-devel] [UNIKRAFT PATCH 1/1] lib/vfscore: Add backspace 
    support to the stdio
    Date: Thu, 29 Aug 2019 17:05:09 +0000
    From: Vlad-Andrei BĂDOIU (78692) <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
    To: minios-devel@xxxxxxxxxxxxx <minios-devel@xxxxxxxxxxxxx>
    CC: simon.kuenzer@xxxxxxxxx <simon.kuenzer@xxxxxxxxx>, Vlad-Andrei 
    BĂDOIU (78692) <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>, 
    costin.lupu@xxxxxxxxx <costin.lupu@xxxxxxxxx>
    
    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') {

Could you please add a small comment to explain why you're using the 177 code?

    +                   /* 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
    

_______________________________________________
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®.