Re: [RFD] Combined fork-exec syscall.

From: Richard B. Johnson (root@chaos.analogic.com)
Date: Mon Apr 28 2003 - 08:57:08 EST


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/



This archive was generated by hypermail 2b29 : Wed Apr 30 2003 - 22:00:29 EST