lkml.org 
[lkml]   [2003]   [Apr]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFD] Combined fork-exec syscall.
On Mon, 28 Apr 2003, Andreas Schwab wrote:

> "Richard B. Johnson" <root@chaos.analogic.com> writes:
>
> |> The following is a "simple popem()', about as minimal as
> |> you can get and have it work.
>
> Except it doesn't.
>
> |> i = 0;
> |> args[i++] = "/bin/sh";
> |> args[i++] = "-c";
> |> args[i++] = strtok((char *)command, " ");
> |> for(; i< NR_ARGS; i++)
> |> if((args[i] = strtok(NULL, " ")) == NULL)
> |> break;

Yes it does.

>
> The command line must be a single argument for -c.
>

That is "implementation dependent", and not a rule. 'sh' may
take additional parameters after '-c'. In the case of Linux
which uses `bash` for `sh` this can be helpful since when
bash is envoked with ths '-c' argument, $0 becomes the next
parameter, instead if the file-name, and $1 becomes the second, etc.

Cheers,
Dick Johnson
Penguin : Linux version 2.4.20 on an i686 machine (797.90 BogoMips).
Why is the government concerned about the lunatic fringe? Think about it.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:35    [W:0.113 / U:3.304 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site