[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] XaAES: bug(s) in shel_write()



Am 09.02.2016, 12:48 Uhr, schrieb Thorsten Otto:

I still would like to see it being fixed. In my case i can only do that

Yes - me too!

Using ARGV should not produce any white-space-problems (I added them to the arguments in the caller).
It does not matter what method is used. The arguments are passed to tw-call, which writes them to a shared memory area, then tells toswin to fetch them. It is toswin which is building a new commandline from this to execute the actual program, and there the arguments are not quoted when they fit in the 126 byte limit.

That's right: a short command-line will be split by white-space by toswin, even when ARGV= is present. I don't know why toswin does that.

I guess it happens in environ.c:

  len = strlen(arg);
  if (len > 124)
  {
    put_env(new, ARGVprefix, "");

...

  else
  {
    for (k = 0; k < len; k++)
      if (arg[k] == '\n')
        arg[k] = ' ';
  }

The \n is added by tw-call:

        for (i = 3; i < argc; i++)
        {
strcat(blk->arg, "\n"); /* LF als Trenner, damit ' ' nicht geklammert werden m<81>ssen!


I can't say I like this and don't know any clean solution without changing toswin. I don't want to even think of trying to quote cmdlin, and leave ARGV= unquoted, or similar. That would suck IMHO.

toswin should always use ARGV when it's in the environment.
Is there a reason to not do that?

-Helmut