separate_arguments.rst 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. separate_arguments
  2. ------------------
  3. Parse space-separated arguments into a semicolon-separated list.
  4. ::
  5. separate_arguments(<var> <NATIVE|UNIX|WINDOWS>_COMMAND "<args>")
  6. Parses a UNIX- or Windows-style command-line string "<args>" and
  7. stores a semicolon-separated list of the arguments in ``<var>``. The
  8. entire command line must be given in one "<args>" argument.
  9. The ``UNIX_COMMAND`` mode separates arguments by unquoted whitespace. It
  10. recognizes both single-quote and double-quote pairs. A backslash
  11. escapes the next literal character (``\"`` is ``"``); there are no special
  12. escapes (``\n`` is just ``n``).
  13. The ``WINDOWS_COMMAND`` mode parses a Windows command-line using the same
  14. syntax the runtime library uses to construct argv at startup. It
  15. separates arguments by whitespace that is not double-quoted.
  16. Backslashes are literal unless they precede double-quotes. See the
  17. MSDN article `Parsing C Command-Line Arguments`_ for details.
  18. The ``NATIVE_COMMAND`` mode parses a Windows command-line if the host
  19. system is Windows, and a UNIX command-line otherwise.
  20. .. _`Parsing C Command-Line Arguments`: https://msdn.microsoft.com/library/a1y7w461.aspx
  21. ::
  22. separate_arguments(<var>)
  23. Convert the value of ``<var>`` to a semi-colon separated list. All
  24. spaces are replaced with ';'. This helps with generating command
  25. lines.