mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-13 10:33:51 -05:00

In the Windows API, there are two places you can get a command line in the form of a single unsplit string. One is via the command-line parameter to WinMain(); the other is by calling GetCommandLine(). But the two have different semantics: the WinMain command line string is only the part after the program name, whereas GetCommandLine() returns the full command line _including_ the program name. PuTTY has never yet had to parse the full output of GetCommandLine, but I have plans that will involve it beginning to do so. So I need to make sure the utility function split_into_argv() can handle it. This is not trivial because the quoting convention is different for the program name than for everything else. In the program's normal arguments, parsed by the C library startup code, the convention is that backslashes are special when they appear before a double quote, because that's how you write a literal double quote. But in the program name, backslashes are _never_ special, because that's how CreateProcess parses the program name at the start of the command line, and the C library must follow suit in order to correctly identify where the program name ends and the arguments begin. In particular, consider a command line such as this: "C:\Program Files\Foo\"foo.exe "hello \"world\"" The \" in the middle of the program name must be treated as a literal backslash, followed by a non-literal double quote which matches the one at the start of the string and causes the space in 'Program Files' to be treated as part of the pathname. But the same \" when it appears in the subsequent argument is treated as an escaped double quote, and turns into a literal " in the argument string. This commit adds support for this special initial-word handling in split_into_argv(), via an extra boolean argument indicating whether to turn that mode on. However, all existing call sites set the flag to false, because the new mode isn't needed _yet_. So there should be no functional change.
This is the README for PuTTY, a free Windows and Unix Telnet and SSH client. PuTTY is built using CMake <https://cmake.org/>. To compile in the simplest way (on any of Linux, Windows or Mac), run these commands in the source directory: cmake . cmake --build . Then, to install in the simplest way on Linux or Mac: cmake --build . --target install On Unix, pterm would like to be setuid or setgid, as appropriate, to permit it to write records of user logins to /var/run/utmp and /var/log/wtmp. (Of course it will not use this privilege for anything else, and in particular it will drop all privileges before starting up complex subsystems like GTK.) The cmake install step doesn't attempt to add these privileges, so if you want user login recording to work, you should manually ch{own,grp} and chmod the pterm binary yourself after installation. If you don't do this, pterm will still work, but not update the user login databases. Documentation (in various formats including Windows Help and Unix `man' pages) is built from the Halibut (`.but') files in the `doc' subdirectory. If you aren't using one of our source snapshots, you'll need to do this yourself. Halibut can be found at <https://www.chiark.greenend.org.uk/~sgtatham/halibut/>. The PuTTY home web site is https://www.chiark.greenend.org.uk/~sgtatham/putty/ If you want to send bug reports or feature requests, please read the Feedback section of the web site before doing so. Sending one-line reports saying `it doesn't work' will waste your time as much as ours. See the file LICENCE for the licence conditions.
Description
Languages
C
89.7%
Python
8%
Perl
0.9%
CMake
0.8%
Shell
0.4%
Other
0.1%