Ejemplo n.º 1
0
void CommandLineBuilder::AppendArguments(const Argv& argv)
{
  if (argv.GetArgc() > 0)
  {
    AppendArguments(argv.GetArgc() - 1, argv.GetArgv() + 1);
  }
}
Ejemplo n.º 2
0
FILE *
SessionImpl::InitiateProcessPipe (/*[in]*/ const char *		lpszCommand,
        /*[in]*/ FileAccess		access,
        /*[in,out]*/ FileMode &	mode)
{
    Argv argv;
    argv.Build ("", lpszCommand);
    int argc = argv.GetArgc();
    if (argc == 0)
    {
        FATAL_MIKTEX_ERROR ("SessionImpl::InitiateProcessPipe",
                            T_("Invalid command."),
                            lpszCommand);
    }
    string verb = argv[1];
    if (verb == "zcat"
            && argc == 3
            && access.Get() == FileAccess::Read)
    {
        mode = FileMode::Open;
        return (OpenGZipFile(argv[2]));
    }
    else if (verb == "bzcat"
             && argc == 3 &&
             access.Get() == FileAccess::Read)
    {
        mode = FileMode::Open;
        return (OpenBZip2File(argv[2]));
    }
    else
    {
        return (POpen(lpszCommand,
                      access.Get() == FileAccess::Read ? "r" : "w"));
    }
}