Running C program in specific UNIX environment 
Author Message
 Running C program in specific UNIX environment

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



Mon, 03 May 1999 03:00:00 GMT  
 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



Tue, 04 May 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Resources for learning to program C/C++ (especially in a UNIX environment)

2. Resources for learning to program C/C++ (especially in a UNIX environment)

3. c programming in unix environment

4. Programming in Graphics using C under Unix Environment

5. Running unix command is C program

6. cygwin to unix, run my program differently, pls help ;(

7. to run a C program on unix

8. How to RUN a program in Unix?

9. debugging run-time Unix C programs

10. PROBLEMS RUNNING A C PROGRAM 3 TIMES on unix

11. Will a program using WinInet run under UNIX???

12. Using Visual C++ to compile C++ programs to be run on UNIX

 

 
Powered by phpBB® Forum Software