On Mon, 8 Jul 2002 20:48:02 +0200, "Andreas Scherer"
>Hi all!
>I want (have to) pass the envvar $LINES & $COLUMNS to a called
>program. The vars are only available in interactive shells, so
>getenv()
>does not work.
A couple of choices...
a) Run your program in a shell
For instance...
#!/bin/bash
export LINES=32
export COLUMNS=99
/path/to/myprogram
b) Write a wrapper program that exec[l|v]e's your program, and set the
environment vars as part of the exec[l|v]e call
With either of these, getenv() will work.
Quote:>One way to do so, is to call the app with appname $LINES $COLUMNS
>but this is not the way I like to do it.
>Do anybody know a way to determine the number of lines and
>columns
>inside a c-program?
Use argc/argv, of course (or the getargs() package if you don't like
handparsing argc/argv).
/path/to/myprogram -lines 32 -columns 99
of course, you still have to populate the values, so you might be back to
envvars. If so, then your best bet is the wrapper shell script or wrapper
exec[l|v]e program.
Lew Pitcher, Information Technology Consultant, Toronto Dominion Bank Financial Group
(Opinions expressed are my own, not my employer's.)