[fpc-pascal] set envirom variable with pascal in linux

mondrillo mondrillo at terra.es
Tue Aug 30 22:37:13 CEST 2005


Thanks, is the only think that I probe and runs ok!!!

****
program shell2;

uses baseunix, sysutils;
begin
    writeln('glx-config Version:',fpGetenv('SDL_VER'));
end.
****

export SDL_VER=`sdl-config --version`; ./shell2
glx-config Version:1.2.8

Note. I have put the clause EXPORT because I'm using bash.

I don't probe tu use the other method that other person has posted than
use a call to glibc, perhaps it's the largest walk. 

Another one, has mentioned than FreePascal(FP) gives an enviroment in
read-only, I have read that the environ is an array of list of var's
with values, and I'dont know why FP (I love it) cannot write in this
array, perhaps do not implement yet.

Thank's eveybody, and regards.



El mar, 30-08-2005 a las 14:53 +0200, Marc Santhoff escribió: 
> Am Dienstag, den 30.08.2005, 08:47 +0200 schrieb mondrillo:
> > Hello list, 
> > 
> > In Bach, Perl, can do set SDL_VER=`sdl-config --version`
> > and in enviroment has the variable SDL_VER=1.2.3 for example.
> > echo $SDL_VER
> > 1.2.3
> > But in Pascal non have the setenv() procedure as in C :(
> > 
> > Actualy I resolve this problem with sending the output to a file, and
> > then reading the file. But, can I pass from C this function?, or call
> > a libc (thinks is this lib that has setenv() ) from Pascal to execute
> > setenv().
> > 
> 
> If you're using a command line to execute a foreign program you can
> always tell the shell:
> 
> csh: "setenv VAR value; your-foreign-program"
> sh:  "VAR=value; your-foreign-program"
> 
> Not portable, ugly workaround, but it does do the job.
> 
> HTH,
> Marc
> 
> 
> 
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal




More information about the fpc-pascal mailing list