Article View: comp.unix.programmer
Article #1258How to provide Shell Escape from a C program?
From: Rudrakshala Purushotham
Date: Mon, 19 Nov 1990 13:30
Date: Mon, 19 Nov 1990 13:30
40 lines
1459 bytes
1459 bytes
I want to provide shell escape feature from a C program. But I am having
some problems with the following code:
shell_escape (command);
char *command;
{
...
char *args [MAX_ARGS];
args [0] = "/bin/sh";
args [1] = "-c";
for (i = 2; i < MAX_ARGS && (s = strtok (command, " \t")); i++)
args [i] = strsave (s);
args [i] = NULL;
if (fork () > 0) {
execv ("/bin/sh", args);
perror ("execv");
_exit (1);
}
wait (&status);
...
I am using C shell and System V. I tried `/bin/ls -l -R' as input to
shell_escape (), my .login file gets executed here and /bin/ls is executed
(without -l -R) options.
Can some body help me with this problem?
Thanks
-- Purushotham
--
R. Purushotham Email: rudrak@saphir.cl.bull.fr
F7 1 D5 BULL SA Tel Off: 34627000 ext 3928
78340 Les Clayes sous Bois FRANCE Tel Res: 34604752
=======================================================================
Technical Details
Message-ID:
<349@clbull.cl.bull.fr>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!inria!bull.bull.fr!clbull.cl.bull.fr!rudrakShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!inria!bull.bull.fr!clbull.cl.bull.fr!rudrak From: rudrak@saphir.cl.bull.fr (Rudrakshala Purushotham) Newsgroups: comp.unix.programmer Subject: How to provide Shell Escape from a C program? Message-ID: <349@clbull.cl.bull.fr> Date: 19 Nov 90 13:30:36 GMT Sender: news@clbull.cl.bull.fr Organization: BULL Les Clayes, FRANCE Lines: 40 Originator: rudrak@saphir