
Running C program in specific UNIX environment
Quote:
>We have a application running on a UNIX server that provides many APIs to
>integrate with this application. In order to access the APIs, the
>environment must be set up with certain lookup data, and system-dependent
>variables and profiles. This application comes with a couple of profile
>files that are sourced at login time to set up individual users with the
>correct environment.
>The problem I have is running a C program that calls some of these APIs.
>The program runs successfully when I run it from the UNIX command line,
>either in the foreground or background (because my environment is always
>properly setup at login). When I try to execute the program from a UNIX C
>shell script, the API calls don't work because the environment is
>undefined. I even tried to source the profile files from the shell script
>before running the program, but the program seems to get spawned off to
>another shell that is not set up with the needed environmental variables.
>Is there a way to make sure the program is run in the desired environment?
>--
>Bill Jones e-mail addresses:
>(860) 437-5650
Hi, Bill
Certainly, there is. Certainly unix user group help you better.
As far as I know you should export your variables and they have to be
visible for any underlying (below that one) shells.
Another problem may be with permissions. Again it is not C issue, but
Unix.
Best regards
Alexander
Nobody is perfect