Path: 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 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 =======================================================================