Sponsored Content
Top Forums Programming executing a program within a program Post 14790 by bangieff on Wednesday 6th of February 2002 12:38:21 PM
Old 02-06-2002
sample source

char **arguments;
int result,status;
....

if (!fork()) {
execvp(arguments[0],arguments);
exit(-1);
} else {
result=wait(&status);
...
}
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

executing the su command from a java program.

Say in unix (AIX) m/c, I am logged in with s1 user and want to start process p1 with user credentials of s2. I can do manually in this way: #su - s2 #enter password for s2> somePassword $ p1 But all this I have to do through a java program. How to pass the password through program. One... (1 Reply)
Discussion started by: shailendrat
1 Replies

2. Programming

Executing an .ec program in different informix versions

Hi all, I tried writing an .ec program connecting to informix database from solaris platform Sun 5.7 informix version that i had to used when i compiled the program was 9.21.UC3 the binary when i ported solaris box with informix version 9.40.UC5 i am unable to run that i am encountering... (0 Replies)
Discussion started by: matrixmadhan
0 Replies

3. Programming

after executing execvp()... program hangs up

Hi , I m actually trying to implement pipes program,but after executing the execvp(),my program is getting hanged up :mad: Actaully i m getting the desired output expected from execvp()...but once results are displayed on the output screen ,program is getting hanged up values of... (3 Replies)
Discussion started by: Crab
3 Replies

4. Programming

Trubble in executing the cpp program...

I wrote a code like this....... #include <iostream> #include <stdio.h> #include <mysql.h> #include <string.h> #include <stdlib.h> using namespace std; #include "Connection.h" int main() { char *Host = (char *)"localhost"; char *Database =(char *)"sachin"; char... (3 Replies)
Discussion started by: ps_sach
3 Replies

5. Solaris

How to know the size of the program currently executing in memory

hey everybody, i am currently working on solaris 10 os on a m5000 server. my problem is when i want the exact size of a program in execution, i am unable to do it. earlier i thought the RSS field of prstat but because of its large size it cant be the size. pmap -x shows some output but it includes... (2 Replies)
Discussion started by: aryansheikh
2 Replies

6. Shell Programming and Scripting

Executing a Java Program

I am entirely new to shell scripting and would like to create a script to execute a java program called Main. I've already compiled it and placed the .java and .class files at /root/javaTest. Next I made a shell script that simply contained: java /root/javaTest/Main . I made the script... (2 Replies)
Discussion started by: hypnotic_meat
2 Replies

7. Shell Programming and Scripting

Executing WIN32OLE program

Hello, Please help me out to execute this perl program: #!/usr/bin/perl -w use strict; use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Excel'; $Win32::OLE::Warn = 3; # die on errors... # get already active Excel application or open new my... (6 Replies)
Discussion started by: suvenduperl
6 Replies

8. UNIX for Dummies Questions & Answers

executing a different program

What system calls or commands do I need to use in order to execute a different program from an already running process? (1 Reply)
Discussion started by: justOne21
1 Replies

9. Shell Programming and Scripting

AWK Program Not Executing On Linux with KSH

Overview: I have an AWK program that parses thru a database backup server log file and outputs ths following parameters SRNO DATE : TIME SIZE IN(KB) DATABASE NAME DUMP TYPE 1 May 16 2012: 13:30:00 6874 TestDB database 2 May 16 2012: 13:30:44 11462 master database Problem: This program has... (5 Replies)
Discussion started by: JolietJake
5 Replies

10. Programming

Error in executing the C program

Hello Friends, I have written a code for the unisex bathroom which makes a policy that when a woman is in the bathroom only other women may enter, but not men, and vice versa. This program consists of four functions which a user defines but these functions are not properly working while... (4 Replies)
Discussion started by: Ravi Tej
4 Replies
stcall(3)						    ShapeTools Toolkit Library							 stcall(3)

NAME
stCallEditor, stCallCmd, stCallCmdErrno, stFindProgram - call command processor with command string SYNOPSIS
#include <config.h> #include <sttk.h.h> int stCallEditor (char *editor, char *file, char *contents, char **newcontents); int stCallCmd (char *commandProcessor, char *commandString); int stCallCmdErrno; char*stFindProgram (char *fileName) DESCRIPTION
stCallEditor calls editor editor with file file and returns its contents after the editor session in newcontents. Return value is the length of the new text. On failure, 0 is returned to indicate the error. Newcontents is not updated and points to nowhere. On error the file will be removed. If contents points to a valid text, this text is put (not appended) into the temporary file before editor starts. Contents must be NULL terminated, otherwise strange things will happen. stCallCmd invokes commandProcessor as a child process and writes commandString to its standard input. The current process waits for termi- nation of the child process. stCallCmd returns the exit status of the child process reported by wait(2). The commandProcessor string may contain command line arguments to the command processor, separated by whitespace. (This is necessary for some programs to make them read commands from standard input.) The command processor program is searched for in the directories given in the environment variable PATH. If commandString does not end with a newline, a newline is added. stFindProgram returns the full pathname of programName if program is found and executable. Otherwise NULL. ENVIRONMENT
PATH List of colon-separated directoriy names where execvp(3) searches for the program to execute (default /bin:/usr/bin:/usr/ucb). SEE ALSO
wait(2) DIAGNOSTICS
On a successful call stCallCmd returns the exit status of the child process. If an error occured, stCallCmd returns a negative number as defined in sttk.h: CMDPROC_EMPTY An empty or NULL string has been supplied for commandProcessor. NO_MORE_CORE A call to malloc(3) or calloc(3) returned a NULL pointer. FORK_FAILED fork(2) could not create a child process. PIPE_FAILED A call to pipe(2) failed. WAIT_ERROR A call to wait(2) failed. EXEC_FAILED execvp(3) could not execute commandProcessor. CHILD_KILLED The child process was killed by an uncaught signal. WRITE_FAILED write(2) could not write commandString to the pipe. This usually happens when commandProcessor does not read its standard input and terminates before commandString is written. NO_PROGRAM commandProcessor could not be found. For the most error conditions the integer variable stCallCmdErrno (declared in sttk.h) contains additional information about the error con- dition, usually the contents of errno(3) after a failed system call. In the case of CHILD_KILLED, stCallCmdErrno contains the statBus of the child process as reported by wait(2). BUGS
On systems where no usable vfork(2) is available, the value of stCallCmdErrno does not make sense in case of EXEC_FAILED. Under IRIX stCallCmd sometimes (or always?) returns WAIT_ERROR where it should be EXEC_FAILED, NO_PROGRAM, or WRITE_FAILED. AUTHORS
Jurgen Nickelsen <nickel@cs.tu-berlin.de> and Andreas.Lampen@cs.tu-berlin.de sttk-1.7 Thu Jun 24 17:43:29 1993 stcall(3)
All times are GMT -4. The time now is 11:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy