diff options
author | Andrew Niefer | 2010-08-12 20:49:34 +0000 |
---|---|---|
committer | Andrew Niefer | 2010-08-12 20:49:34 +0000 |
commit | 67a27df7f4e3927c6360476f790ac72360d9457a (patch) | |
tree | 44e42391fe46adb1bc00b03349035639307bf590 /bundles/org.eclipse.equinox.executable/library/eclipseUtil.c | |
parent | 3eda7983ef723579cf2d4b5b3d4574c7c9c8fba9 (diff) | |
download | rt.equinox.framework-67a27df7f4e3927c6360476f790ac72360d9457a.tar.gz rt.equinox.framework-67a27df7f4e3927c6360476f790ac72360d9457a.tar.xz rt.equinox.framework-67a27df7f4e3927c6360476f790ac72360d9457a.zip |
bug 149994 - --launcher.appendVmargs
Diffstat (limited to 'bundles/org.eclipse.equinox.executable/library/eclipseUtil.c')
-rw-r--r-- | bundles/org.eclipse.equinox.executable/library/eclipseUtil.c | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/bundles/org.eclipse.equinox.executable/library/eclipseUtil.c b/bundles/org.eclipse.equinox.executable/library/eclipseUtil.c index 9ed7b68b2..09eb9fd8b 100644 --- a/bundles/org.eclipse.equinox.executable/library/eclipseUtil.c +++ b/bundles/org.eclipse.equinox.executable/library/eclipseUtil.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. + * Copyright (c) 2000, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,6 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation * Kevin Cornell (Rational Software Corporation) + * Martin Oberhuber (Wind River) - [149994] Add --launcher.appendVmargs *******************************************************************************/ /* Eclipse Launcher Utility Methods */ @@ -159,6 +160,48 @@ _TCHAR * concatPaths(_TCHAR** strs, _TCHAR separator) { } /* + * Concatenates two NULL-terminated arrays of Strings, + * returning a new NULL-terminated array. + * The returned array must be freed with the regular free(). + */ +_TCHAR** concatArgs(_TCHAR** l1, _TCHAR** l2) { + _TCHAR** newArray = NULL; + int size1 = 0; + int size2 = 0; + + if (l1 != NULL) + while (l1[size1] != NULL) size1++; + if (l2 != NULL) + while (l2[size2] != NULL) size2++; + + newArray = (_TCHAR **) malloc((size1 + size2 + 1) * sizeof(_TCHAR *)); + if (size1 > 0) { + memcpy(newArray, l1, size1 * sizeof(_TCHAR *)); + } + if (size2 > 0) { + memcpy(newArray + size1, l2, size2 * sizeof(_TCHAR *)); + } + newArray[size1 + size2] = NULL; + return newArray; +} + +/* + * returns the relative position of arg in the NULL-terminated list of args, + * or -1 if args does not contain arg. + */ +int indexOf(_TCHAR *arg, _TCHAR **args) { + int i = -1; + if (arg != NULL && args != NULL) { + while (args[++i] != NULL) { + if (_tcsicmp(arg, args[i]) == 0) { + return i; + } + } + } + return -1; +} + +/* * buffer contains a pathSeparator separated list of paths, check * that it contains all the paths given. Each path is expected to be * terminated with a pathSeparator character. |