[Lunar-commits] <lunar> view_file(): Added default fallback for simple cat, fix for bug #353

Stefan Wold ratler at lunar-linux.org
Sun Nov 8 13:26:28 CET 2009


commit 286322f141bbc0bde9d8539a8fe32e2e3f0d5bf2
Author: Stefan Wold <ratler at lunar-linux.org>
Date:   Sun Nov 8 13:26:28 2009 +0100

    view_file(): Added default fallback for simple cat, fix for bug #353
    
    Instead of handling every case we know about I added a default fallback option.
    If we find other cases it's better to add an exception for them.
---
 var/lib/lunar/functions/view.lunar |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/var/lib/lunar/functions/view.lunar b/var/lib/lunar/functions/view.lunar
index e96a26b..0191297 100644
--- a/var/lib/lunar/functions/view.lunar
+++ b/var/lib/lunar/functions/view.lunar
@@ -13,15 +13,15 @@ view_file()  {
   if [ -n "$1" ] ; then
     # show a file $1
     case $(file -b $1 | cut -d' ' -f1) in
-      ASCII) cat $1         | ${PAGER:-less} ;;
-      UTF-8) cat $1         | ${PAGER:-less} ;;
-      bzip2) cat $1 | bzcat | ${PAGER:-less} ;;
-       gzip) cat $1 | zcat  | ${PAGER:-less} ;;
-       data) cat $1         | ${PAGER:-less} ;;
+      bzip2) bzcat $1 | ${PAGER:-less} ;;
+       gzip) zcat $1  | ${PAGER:-less} ;;
+          *)
+             # default fallback
+             verbose_msg "view_file using fallback for ($1}"
+             cat $1   | ${PAGER:-less} ;;
     esac
   else
     cat | ${PAGER:-less}
   fi
 }
 
-


More information about the Lunar-commits mailing list