Liste des Groupes | Revenir à col misc |
The Natural Philosopher <tnp@invalid.invalid> writes:But surely that is the point. Its an 'array of strings'On 02/05/2025 17:41, Richard Kettlewell wrote:Not really. As far as C is concerned, it’s just an array of strings; howThe Natural Philosopher <tnp@invalid.invalid> writes:>I LOVE spaces in filenames.Quite. It’s only shell that has a problem with spaces, so it seems
I guess if you use the command line a lot and parse file arguments
using spaces, its a bit irritating.
>
But if you uses a GUI its no issue at all
like it’s not the spaces that are the problem, but the language.
To be fair its built in to the C language as well in the sense that
that's how argc and argv[] are created.
it’s created is someone else’s problem. Who the ‘someone else’ is
depends on the platform...
In Unix, the space-based splitting is part of the shell.No, its part of the runtime of the C language
What you passBut making it an 'array of strings' is *already* parsing and formatting it!
to execve() is an array of strings, so if you can keep the shell out of
the picture, you get to specify exactly what appear in the child
program’s argv without any extra parsing or formatting being involved.
In Windows, the splitting is instead part of the language runtime, since--
CreateProcess() takes a single command line string. The child process’s
runtime does the splitting (according to rules complicated enough to
result in vulnerabilities) - or not, if WinMain() is used.
Les messages affichés proviennent d'usenet.