execv lauches a process using "/bin/sh -c"

Inside the C program, when execv(cPath, argv) is called, it launches new process image using "/bin/sh -c" option even if it is getting launched from C-shell. Is there a way to make execv to use "/bin/csh " or "/bin/sh"(without -c option)..

You are confused. system() performs the shell driven execution. man execve (which is the core function for the C exec() functions) is what you need to read. exec will only execute the shell when the first line contains the bang #!$(shell here) token. Thus you can exec any shell script in any shell using the exec functions.

You are confusing the system function with the execv function, don't you? I mean, the execv function will replace the current process image with a new one. According to the execv man page (extracted from a Solaris box):

while the system function will execute the command string by calling the system's shell:

For my case of execv(cPath, argv),

Current process image, argv[0] is "/finder/95s/ed/bin/or_run_report"
and new process image, cPath is "/users/sch83995/test/sbin/or_run_report".

Please look at the below output where current process image is not getting terminated..and new process image is launched.

Reva% ps -ef | grep report
shafi 26624 26078 0 11:42:37 pts/43 0:00 grep report
shafi 26586 1 0 11:42:07 pts/43 0:00 /bin/csh -f /finder/95s/ed/sbin/reports_run_launcher SPIDER
shafi 25413 24346 0 11:10:41 pts/32 0:00 vi or_run_report.csh
shafi 26597 26589 0 11:42:18 pts/43 0:00 /bin/sh -c /finder/95s/ed/bin/or_run_report 'INSTALL/install@fnd9i' SPIDER /use
shafi 26598 26597 0 11:42:18 pts/43 0:00 /bin/csh -f /users/sch83995/test/sbin/or_run_report SPIDER /users/sch83995/12
Reva%
Reva%

Which shell is chosen to execute a script depends only on the format of the shebang line in your script. It has nothing to do with the shell that you are currently interacting with. If your script does not contain the shebang line and you want to pick the shell for your script's execution use the execl() system call.

I used "/bin/ksh -c" instead "/bin/sh -c" .. It resolved my problem..I hope this will not affect ? I am using Korn-Shell to execute the binary executable(C-programme) ?