public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ruiyu Ni <ruiyu.ni@intel.com>
To: edk2-devel@lists.01.org
Cc: Jaben Carsey <jaben.carsey@intel.com>
Subject: [PATCH 5/6] ShellPkg/ls: Fix to support "ls fs0:File.txt"
Date: Mon,  8 Aug 2016 18:28:33 +0800	[thread overview]
Message-ID: <20160808102834.129372-6-ruiyu.ni@intel.com> (raw)
In-Reply-To: <20160808102834.129372-1-ruiyu.ni@intel.com>

“ls fs0:\File.txt" can list the file correctly but
when the backslash is removed from colon, the file cannot
be listed.
The patch fixes this issue.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
---
 ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
index 25bf8ca..6d3cc95 100644
--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
@@ -2,7 +2,7 @@
   Main file for ls shell level 2 function.
 
   (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.<BR>
-  Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
   which accompanies this distribution.  The full text of the license may be found at
@@ -707,10 +707,9 @@ ShellCommandRunLs (
               //
               // must split off the search part that applies to files from the end of the directory part
               //
-              for (StrnCatGrow(&SearchString, NULL, PathName, 0)
-                ; SearchString != NULL && StrStr(SearchString, L"\\") != NULL
-                ; CopyMem(SearchString, StrStr(SearchString, L"\\") + 1, 1 + StrSize(StrStr(SearchString, L"\\") + 1))) ;
-              FullPath[StrLen(FullPath) - StrLen(SearchString)] = CHAR_NULL;
+              StrnCatGrow(&SearchString, NULL, FullPath, 0);
+              PathRemoveLastItem (FullPath);
+              CopyMem (SearchString, SearchString + StrLen (FullPath), StrSize (SearchString + StrLen (FullPath)));
             }
           }
         }
-- 
2.9.0.windows.1



  parent reply	other threads:[~2016-08-08 10:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-08 10:28 [PATCH 0/6] Fix shell TAB completion issue and bugs in LS command Ruiyu Ni
2016-08-08 10:28 ` [PATCH 1/6] ShellPkg: TAB logic incorrectly chops out fs0: when typing fs0:<TAB> Ruiyu Ni
2016-08-08 10:28 ` [PATCH 2/6] ShellPkg: TAB logic incorrectly shows files in CWD when typing \<TAB> Ruiyu Ni
2016-08-08 10:28 ` [PATCH 3/6] ShellPkg: Fix FindFiles() to handle "fsx:EFI\BOOT" path Ruiyu Ni
2016-08-08 10:28 ` [PATCH 4/6] MdePkg: Enhance PathRemoveLastItem() to support "FS0:File.txt" Ruiyu Ni
2016-08-08 10:28 ` Ruiyu Ni [this message]
2016-08-08 10:28 ` [PATCH 6/6] ShellPkg/ls: Display the correct directory path Ruiyu Ni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160808102834.129372-6-ruiyu.ni@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox