From owner-freebsd-questions@FreeBSD.ORG Thu Dec 30 01:08:19 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0A3D016A4CE for ; Thu, 30 Dec 2004 01:08:19 +0000 (GMT) Received: from pi.codefab.com (pi.codefab.com [199.103.21.227]) by mx1.FreeBSD.org (Postfix) with ESMTP id 790CF43D49 for ; Thu, 30 Dec 2004 01:08:18 +0000 (GMT) (envelope-from cswiger@mac.com) Received: from [192.168.1.3] (pool-68-160-208-232.ny325.east.verizon.net [68.160.208.232]) by pi.codefab.com (8.12.11/8.12.11) with ESMTP id iBU18CpR097704 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 29 Dec 2004 20:08:14 -0500 (EST) Message-ID: <41D35547.5070105@mac.com> Date: Wed, 29 Dec 2004 20:09:27 -0500 From: Chuck Swiger Organization: The Courts of Chaos User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.3) Gecko/20040910 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Joshua Lokken References: In-Reply-To: X-Enigmail-Version: 0.89.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=1.8 required=5.5 tests=RCVD_IN_NJABL_DUL, RCVD_IN_SORBS_DUL autolearn=disabled version=3.0.1 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.0.1 (2004-10-22) on pi.codefab.com cc: Questions Subject: Re: less -f X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Dec 2004 01:08:19 -0000 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 { -- -Chuck