Function

GLib-2.0GLibshell_parse_argv

  • Parses a command line into an argument vector, in much the same way the shell would, but without many of the expansions the shell would perform (variable expansion, globs, operators, filename expansion, etc. are not supported).

    The results are defined to be the same as those you would get from a UNIX98 /bin/sh, as long as the input contains none of the unsupported shell expansions. If the input does contain such expansions, they are passed through literally.

    Possible errors are those from the G_SHELL_ERROR domain.

    In particular, if command_line is an empty string (or a string containing only whitespace), GLib.ShellError.EMPTY_STRING will be returned. It’s guaranteed that argvp will be a non-empty array if this function returns successfully.

    Free the returned vector with g_strfreev().

    Parameters

    • command_line: string

      command line to parse

    Returns [boolean, string[]]

    true on success, false if error set