Unix Technical Forum

RE: Less (more) environment COLUMNS conflict

This is a discussion on RE: Less (more) environment COLUMNS conflict within the Sco Unix forums, part of the Unix Operating Systems category; --> I have attempted to use less from Skunkware on a 5.0.5 system as a file viewing utility for a ...


Go Back   Unix Technical Forum > Unix Operating Systems > Sco Unix

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-15-2008, 12:20 PM
Steve M. Fabac, Jr.
 
Posts: n/a
Default RE: Less (more) environment COLUMNS conflict

I have attempted to use less from Skunkware on a 5.0.5 system as a
file viewing utility for a client.

Problem: The client's application changes the screen to 132 column mode
prior to sending the output.

I have set the following in the users global environmental configuration
file for
the application startup:

LESS="--chop-long-lines --shift 8"; export LESS
COLUMNS=132; export COLUMNS

This works as intended as the application changes the screen to 132
column
by sending "ESC[?3h", pipes the output through less and after the user
closes
the less window, resets the screen to 80 column mode.

The problem is that the client's application also respects the
COLUMNS=132
setting and popup windows are crowded to the right edge of the 80 column
screen
and in some cases wrap the right edge of the screen.

Eliminating the COLUMNS=132 environment variable fixes the application
display but
then Less does not display properly when the application switches to 132
column mode.

setting LESS="--chop-long-lines --shift 8 --columns=132"; export LESS

does not work. In fact, with the above, less aborts with:
columns=132 is an ambiguous abbreviation ("more --help" for help)
but untill you correct the offending abbreviation, less --help will
abort with the same message. (Note to Less programmer: fix error
handling to
accept the case --help)

and LESSCOLUMNS=132 does not work.

My options look to be to obtain the source for LESS and modify it to
respect
LESSCOLUMNS=132.

Where can I download the less source code? Or is there already an
undocumented
--lss-command that will allow me to set 132 column from the command
line?

JP: Any other options, or suggestions?

I have tried LESSOPEN and LESSCLOSE and find nothing I do causes the
shell command
file listed in LESSCLOSE to run when quitting from LESS. The shell
command file
listed in LESSOPEN does run but all attempts to have the client's
application run
the shell command in place of less has failed.

Note: less supplied as standard for 5.0.6 behaves the same as the
version from
Skunkware 2000.

--

Steve Fabac
S.M. Fabac & Associates
816/765-1670
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-15-2008, 12:21 PM
Jean-Pierre Radley
 
Posts: n/a
Default Re: Less (more) environment COLUMNS conflict

Steve M. Fabac, Jr. typed (on Thu, Nov 20, 2003 at 05:05:23PM +0000):
| I have attempted to use less from Skunkware on a 5.0.5 system as a
| file viewing utility for a client.
|
| Problem: The client's application changes the screen to 132 column mode
| prior to sending the output.
|
| I have set the following in the users global environmental configuration
| file for
| the application startup:
|
| LESS="--chop-long-lines --shift 8"; export LESS
| COLUMNS=132; export COLUMNS
|
| This works as intended as the application changes the screen to 132
| column
| by sending "ESC[?3h", pipes the output through less and after the user
| closes
| the less window, resets the screen to 80 column mode.
|
| The problem is that the client's application also respects the
| COLUMNS=132
| setting and popup windows are crowded to the right edge of the 80 column
| screen
| and in some cases wrap the right edge of the screen.
|
| Eliminating the COLUMNS=132 environment variable fixes the application
| display but
| then Less does not display properly when the application switches to 132
| column mode.
|
| setting LESS="--chop-long-lines --shift 8 --columns=132"; export LESS
|
| does not work. In fact, with the above, less aborts with:
| columns=132 is an ambiguous abbreviation ("more --help" for help)
| but untill you correct the offending abbreviation, less --help will
| abort with the same message. (Note to Less programmer: fix error
| handling to
| accept the case --help)
|
| and LESSCOLUMNS=132 does not work.
|
| My options look to be to obtain the source for LESS and modify it to
| respect
| LESSCOLUMNS=132.
|
| Where can I download the less source code? Or is there already an
| undocumented
| --lss-command that will allow me to set 132 column from the command
| line?

I've got the source code on ftp.jpr.com.

| JP: Any other options, or suggestions?

man lesskey

| I have tried LESSOPEN and LESSCLOSE and find nothing I do causes the
| shell command
| file listed in LESSCLOSE to run when quitting from LESS. The shell
| command file
| listed in LESSOPEN does run but all attempts to have the client's
| application run
| the shell command in place of less has failed.
|
| Note: less supplied as standard for 5.0.6 behaves the same as the
| version from
| Skunkware 2000.
|
| --
|
| Steve Fabac
| S.M. Fabac & Associates
| 816/765-1670

--
JP
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-15-2008, 12:21 PM
Bela Lubkin
 
Posts: n/a
Default Re: Less (more) environment COLUMNS conflict

Steve M. Fabac, Jr. wrote:

> I have attempted to use less from Skunkware on a 5.0.5 system as a
> file viewing utility for a client.
>
> Problem: The client's application changes the screen to 132 column mode
> prior to sending the output.
>
> I have set the following in the users global environmental configuration
> file for
> the application startup:
>
> LESS="--chop-long-lines --shift 8"; export LESS
> COLUMNS=132; export COLUMNS
>
> This works as intended as the application changes the screen to 132
> column
> by sending "ESC[?3h", pipes the output through less and after the user
> closes
> the less window, resets the screen to 80 column mode.
>
> The problem is that the client's application also respects the
> COLUMNS=132
> setting and popup windows are crowded to the right edge of the 80 column
> screen
> and in some cases wrap the right edge of the screen.
>
> Eliminating the COLUMNS=132 environment variable fixes the application
> display but
> then Less does not display properly when the application switches to 132
> column mode.
>
> setting LESS="--chop-long-lines --shift 8 --columns=132"; export LESS
>
> does not work. In fact, with the above, less aborts with:
> columns=132 is an ambiguous abbreviation ("more --help" for help)
> but untill you correct the offending abbreviation, less --help will
> abort with the same message. (Note to Less programmer: fix error
> handling to
> accept the case --help)
>
> and LESSCOLUMNS=132 does not work.


Tell the application to run /wherever/less132 instead of /wherever/less.
/wherever/less132 says:

#!/bin/sh
COLUMNS=132 exec /wherever/less --chop-long-lines --shift 8 "$@"

Speaking of 132-column lines, wrapping and all that jazz, please slap
Mozilla upside the head until it figures out how to post news correctly.

>Bela<

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-15-2008, 12:22 PM
Steve M. Fabac, Jr.
 
Posts: n/a
Default Re: Less (more) environment COLUMNS conflict



Bela Lubkin wrote:
>
> Steve M. Fabac, Jr. wrote:
>
> > I have attempted to use less from Skunkware on a 5.0.5 system as a
> > file viewing utility for a client.
> >
> > Problem: The client's application changes the screen to 132 column mode
> > prior to sending the output.
> >
> > I have set the following in the users global environmental configuration
> > file for the application startup:
> >
> > LESS="--chop-long-lines --shift 8"; export LESS
> > COLUMNS=132; export COLUMNS
> >
> > This works as intended as the application changes the screen to 132
> > column by sending "ESC[?3h", pipes the output through less and after the user
> > closes the less window, resets the screen to 80 column mode.
> >
> > The problem is that the client's application also respects the
> > COLUMNS=132 setting and popup windows are crowded to the right edge of the
> > 80 column screen and in some cases wrap the right edge of the screen.
> >
> > Eliminating the COLUMNS=132 environment variable fixes the application
> > display but then Less does not display properly when the application
> > switches to 132 column mode.
> >
> > setting LESS="--chop-long-lines --shift 8 --columns=132"; export LESS
> >
> > does not work. In fact, with the above, less aborts with:
> > columns=132 is an ambiguous abbreviation ("more --help" for help)
> > but untill you correct the offending abbreviation, less --help will
> > abort with the same message. (Note to Less programmer: fix error
> > handling to accept the case --help)
> >
> > and LESSCOLUMNS=132 does not work.

>
> Tell the application to run /wherever/less132 instead of /wherever/less.
> /wherever/less132 says:
>
> #!/bin/sh
> COLUMNS=132 exec /wherever/less --chop-long-lines --shift 8 "$@"
>
> Speaking of 132-column lines, wrapping and all that jazz, please slap
> Mozilla upside the head until it figures out how to post news correctly.


Changed from 72 to 92, hope that works. Normally, I try to remember to
uncheck "wrap long lines" prior to sending but missed it on this one.

>
> >Bela<


Thanks Bela, that did the trick. less132 that worked is:

#!/bin/sh
COLUMNS=132; export COLUMNS
exec /usr/local/bin/less --chop-long-lines --shift 8 "%@"

--

Steve Fabac
S.M. Fabac & Associates
816/765-1670
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:43 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com