From owner-freebsd-questions@FreeBSD.ORG Mon Feb 21 01:18:03 2011 Return-Path: Delivered-To: freebsd-questions@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 89E52106564A for ; Mon, 21 Feb 2011 01:18:03 +0000 (UTC) (envelope-from kline@thought.org) Received: from thought.org (plato.thought.org [209.180.213.209]) by mx1.freebsd.org (Postfix) with ESMTP id 6216A8FC13 for ; Mon, 21 Feb 2011 01:18:02 +0000 (UTC) Received: by thought.org (Postfix, from userid 1001) id 31DCBE8070A; Sun, 20 Feb 2011 17:18:02 -0800 (PST) Date: Sun, 20 Feb 2011 17:18:02 -0800 From: Gary Kline To: FreeBSD Mailing List Message-ID: <20110221011755.GA16912@thought.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Organization: Thought Unlimited. Public service Unix since 1986. X-Of_Interest: With 24 years of service to the Unix community. User-Agent: Mutt/1.5.20 (2009-06-14) Cc: Subject: revised pager..... X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Feb 2011 01:18:03 -0000 THis is to the entire list, mostly to Chip. It is o8.rb, my very slightly tweaked version of what you ma/// rather, what i found and began messing with a couple, three hours ago. I searched++ and could not find the C equivalent of "if counter % N == 0" in ruby. For some reason, use of parens in ruby seems to be discouraged. Anyway, I would have coded that ruby line as if ( counter % 15) == 0 but didn't want to risk it since i don't know ruby. Anyway, o8.rb included. This version, using the "[][][][][]" to emulate a bar, makes reading a reasonably-sized bunch of text much easier. Thanks again for your help. -- Gary Kline kline@thought.org http://www.thought.org Public Service Unix %%%% ruby script appended. #!/usr/bin/env ruby require 'optparse' pagesize = 15 count = 0 optparse = OptionParser.new do |opts| opts.banner = 'usage: npg [-n pagesize] file...' opts.on('-n', '--numlines pagesize', 'Specify page size in number of lines') do |n| pagesize = n.to_i end end begin optparse.parse! rescue OptionParser::InvalidOption, OptionParser::MissingArgument => e puts e puts optparse exit 1 end loop do if count == 0 puts("\n[][][][][][][][][][][][][][][][][][][][][][][]") count += 1 end pagesize.times do if line = gets puts line if count % 15 == 0 puts("===") count = 0 end else exit end end puts("\n[][][][][][][][][][][][][][][][][][][][][][][]\n\n") print "More..." system "stty raw" STDIN.getc system "stty -raw" end