From owner-freebsd-chat@FreeBSD.ORG Thu Dec 30 02:03:26 2004 Return-Path: Delivered-To: freebsd-chat@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 56A7616A4CE for ; Thu, 30 Dec 2004 02:03:26 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.202]) by mx1.FreeBSD.org (Postfix) with ESMTP id F10DB43D2D for ; Thu, 30 Dec 2004 02:03:25 +0000 (GMT) (envelope-from joshua.lokken@gmail.com) Received: by wproxy.gmail.com with SMTP id 55so34256wri for ; Wed, 29 Dec 2004 18:03:25 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=YgHvxC3qp0cTUPlK5fQWaW0mXJiVvFBRBm89KgEMr/SBKm3xElNyyVvFo5zxTnonTRDGkK/nWuOJBmfvNOCCJ8z8Em8GFrnSyEEPMjR6psULYA78cqIYsOSJx0wdwBuVkGdLBT0fjkCzajbFjS1DWh21GfRwCZThcCw64hNXdsE= Received: by 10.54.28.19 with SMTP id b19mr252213wrb; Wed, 29 Dec 2004 18:03:25 -0800 (PST) Received: by 10.54.11.33 with HTTP; Wed, 29 Dec 2004 18:03:25 -0800 (PST) Message-ID: Date: Wed, 29 Dec 2004 20:03:25 -0600 From: Joshua Lokken To: Chuck Swiger In-Reply-To: <41D35547.5070105@mac.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <41D35547.5070105@mac.com> cc: freebsd-chat@freebsd.org Subject: Re: less -f X-BeenThere: freebsd-chat@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Joshua Lokken List-Id: Non technical items related to the community List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Dec 2004 02:03:26 -0000 On Wed, 29 Dec 2004 20:09:27 -0500, Chuck Swiger wrote: > Joshua Lokken wrote: > [ ... ] > > So, I did man less(1), and found this: > > > > -f or --force > > Forces non-regular files to be opened. (A non-regular file is a > > directory or a device special file.) Also suppresses the warn- > > ing message when a binary file is opened. By default, less will > > refuse to open non-regular files. > > > > However,: > [ ... ] > >less -f ~netmin/mydir > > /home/netmin/mydir is a directory > > > > Can someone explain this behavior to me? I admit that I may > > not understand the -f flag wholly, however, this seems in direct > > contradiction with the man page. > > You're right, the manpage says and what the program actually does contradict > each other. Consider the following change to /usr/src/contrib/less: > > --- filename.c~ Thu Jun 29 21:03:08 2000 > +++ filename.c Wed Dec 29 20:04:06 2004 > @@ -954,10 +954,14 @@ > { > static char is_dir[] = " is a directory"; > > - m = (char *) ecalloc(strlen(filename) + sizeof(is_dir), > - sizeof(char)); > - strcpy(m, filename); > - strcat(m, is_dir); > + if (force_open) { > + m = NULL; > + } else { > + m = (char *) ecalloc(strlen(filename) + sizeof(is_dir), > + sizeof(char)); > + strcpy(m, filename); > + strcat(m, is_dir); > + } > } else > { > Is this something that warrants a send-pr? I've never used the tool, and don't want to generate needless problem reports. What's the best way to handle it? Thanks for any advice. -- Joshua Lokken Open Source Advocate