[sclug] less not cooperating

Bob Dunlop bob.dunlop at xyzzy.org.uk
Thu Jul 26 21:22:58 UTC 2007


Hi,

On Thu, Jul 26 at 08:00, Will Dickson wrote:
...
> Since this particular piece of code knows that it's running in Linux, 
> the obvious answer seemed to be, call out to /usr/bin/less and get it to 
> do the work.
...

The code fragment where you envoke less might have yielded some
interesting clues.  Otherwise as a first guess I'd go along with others
in that you're somehow confusing less into thinking it's not attached
to a terminal.

The following C program x.c simply calls less and works as expected.

  main ()
  {
    sleep ( 5 );
    system ("less /etc/passwd");
    sleep ( 5 );
    exit ( 0 );
  }

However simply disconnecting it's output from the terminal by running
it through cat as in  ./x | cat  is enough to stop less from paging.


-- 
        Bob Dunlop



More information about the Sclug mailing list