summaryrefslogtreecommitdiff
path: root/sample/less.rb
diff options
context:
space:
mode:
Diffstat (limited to 'sample/less.rb')
-rwxr-xr-xsample/less.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/sample/less.rb b/sample/less.rb
new file mode 100755
index 0000000..e818e7a
--- /dev/null
+++ b/sample/less.rb
@@ -0,0 +1,30 @@
+#! /mp/free/bin/ruby -- -*- ruby -*-
+#
+# less -
+# $Release Version: $
+# $Revision: 1.1 $
+# $Date: 90/09/29 15:17:59 $
+# by Yasuo OHBA(STAFS Development Room)
+#
+# --
+#
+#
+#
+
+$RCS_ID="$Header: less,v 1.1 90/09/29 15:17:59 ohba Locked $"
+
+ZCAT = "/usr/local/bin/zcat"
+LESS = "/usr/local/bin/less"
+
+FILE = $ARGV.pop
+OPTION = (if $ARGV.length == 0; "" else $ARGV.join(" "); end)
+
+if FILE =~ /\.(Z|gz)$/
+ exec(format("%s %s | %s %s", ZCAT, FILE, LESS, OPTION))
+elsif FILE == nil
+ exec(format("%s %s", LESS, OPTION))
+else
+ print(format("%s %s %s", LESS, OPTION, FILE), "\n")
+ exec(format("%s %s %s", LESS, OPTION, FILE))
+end
+exit()