Ticket #2707: 2707-0001-extfs-u7z-make-the-code-more-readable.patch

File 2707-0001-extfs-u7z-make-the-code-more-readable.patch, 2.2 KB (added by mooffie, 8 years ago)
  • src/vfs/extfs/helpers/u7z

    From 6e49741528ff56e9e722a3ea6afd6c708ecef5ff Mon Sep 17 00:00:00 2001
    From: Mooffie <mooffie@gmail.com>
    Date: Mon, 19 Dec 2016 02:04:10 +0200
    Subject: [PATCH 1/6] Ticket #2707: extfs: u7z: make the code more readable.
    
    ---
     src/vfs/extfs/helpers/u7z | 18 ++++++++++++++----
     1 file changed, 14 insertions(+), 4 deletions(-)
    
    diff --git a/src/vfs/extfs/helpers/u7z b/src/vfs/extfs/helpers/u7z
    index 22e9f27..8270a20 100755
    a b mcu7zip_list () 
    2323{ 
    2424        # Symlinks are not shown - no idea how to distinguish them 
    2525        # Read-only files are not shown as such - it's rarely useful 
     26 
    2627        ugid="`id -nu` `id -ng`" 
     28 
    2729        date_re='^\(....\)-\(..\)-\(..\) \(..:..:..\)' 
    2830        date_mc='\2-\3-\1 \4' 
    2931        size_re='............' 
     32 
    3033        # archive entries can have no datetime info, 7z will use archive file datetime 
    3134        date_archive=`stat -c %y "$1" 2>/dev/null | sed -n "s/${date_re}.*/${date_mc}/p" 2>/dev/null` 
    3235        [ "${date_archive}"x = x ] && date_archive=`ls -lan "$1" 2>/dev/null | awk '{print $6,"",$7,"",$8}' 2>/dev/null` 
    3336        [ "${date_archive}"x = x ] && date_archive="01-01-1970 00:00:00" 
    34         $P7ZIP l "$1" | sed -n "s/$date_re D.... $size_re $size_re\(.*\)/drwxr-xr-x 1 $ugid 0 $date_mc \5/p;\ 
    35                                 s/$date_re \..... \($size_re\) $size_re\(.*\)/-rw-r--r-- 1 $ugid \5 $date_mc \6/p;\ 
    36                                 s/^\s*D.... $size_re $size_re\(.*\)/drwxr-xr-x 1 $ugid 0 $date_archive \1/p;\ 
    37                                 s/^\s*\..... \($size_re\) $size_re\(.*\)/-rw-r--r-- 1 $ugid \1 $date_archive \2/p" 
     37 
     38        $P7ZIP l "$1" | sed -n " 
     39 
     40                  # Handle directories. 
     41                  s/$date_re D.... $size_re $size_re\(.*\)/drwxr-xr-x 1 $ugid 0 $date_mc \5/p 
     42                       s/^\s*D.... $size_re $size_re\(.*\)/drwxr-xr-x 1 $ugid 0 $date_archive \1/p 
     43 
     44                  # Handle normal files. 
     45                  s/$date_re \..... \($size_re\) $size_re\(.*\)/-rw-r--r-- 1 $ugid \5 $date_mc \6/p 
     46                       s/^\s*\..... \($size_re\) $size_re\(.*\)/-rw-r--r-- 1 $ugid \1 $date_archive \2/p 
     47        " 
    3848} 
    3949 
    4050mcu7zip_copyout ()