/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/ #include <stdlib.h> #include <string.h> #include <osl/process.h>
#include"args.h"
/* do we start -env: */ staticint
is_env_arg (rtl_uString const *str)
{ return !rtl_ustr_ascii_compare_WithLength (str->buffer, 5, "-env:");
}
/* Do not send --help/--version over the pipe, as their output shall go to the calling process's stdout (ideally, this would also happen in the presence of unknown options); also prevent splash/pagein/javaldx overhead
(as these options will be processed early in soffice_main): */
{ "version", 1, 1, 1, 1, NULL },
{ "help", 1, 1, 1, 1, NULL },
{ "h", 1, 1, 1, 1, NULL },
{ "?", 1, 1, 1, 1, NULL },
};
Args *args_parse (void)
{
Args *args;
sal_uInt32 nArgs, i, j;
/* sort the -env: args to the front */ for ( i = 0; i < nArgs; ++i )
{
rtl_uString *pTmp = NULL;
osl_getCommandArg( i, &pTmp ); if (is_env_arg (pTmp))
args->ppArgs[j++] = pTmp; else
rtl_uString_release (pTmp);
}
args->nArgsEnv = j;
/* Then the other args */ for ( i = 0; i < nArgs; ++i )
{
rtl_uString *pTmp = NULL;
osl_getCommandArg( i, &pTmp ); if (!is_env_arg (pTmp))
args->ppArgs[j++] = pTmp; else
rtl_uString_release (pTmp);
}
for ( i = args->nArgsEnv; i < args->nArgsTotal; i++ )
{ const sal_Unicode *arg = args->ppArgs[i]->buffer;
sal_Int32 length = args->ppArgs[i]->length;
/* grok only parameters */ if (arg[0] != '-') continue;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.