Date: Wed, 29 Dec 2004 20:03:25 -0600 From: Joshua Lokken <joshua.lokken@gmail.com> To: Chuck Swiger <cswiger@mac.com> Cc: freebsd-chat@freebsd.org Subject: Re: less -f Message-ID: <bc5b63850412291803491bc14e@mail.gmail.com> In-Reply-To: <41D35547.5070105@mac.com> References: <bc5b638504122913577a3faec1@mail.gmail.com> <41D35547.5070105@mac.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 29 Dec 2004 20:09:27 -0500, Chuck Swiger <cswiger@mac.com> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bc5b63850412291803491bc14e>