getopt.cpp revision bd8e360cd1db83dcb2694ea9122ce3bc5bae678a
ba8183e1a0c699f5b5131a03e157fc7e39ed3009vboxsync * innotek Portable Runtime - Command Line Parsing
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync * Copyright (C) 2007 innotek GmbH
ba8183e1a0c699f5b5131a03e157fc7e39ed3009vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
ba8183e1a0c699f5b5131a03e157fc7e39ed3009vboxsync * available from http://www.virtualbox.org. This file is free software;
ba8183e1a0c699f5b5131a03e157fc7e39ed3009vboxsync * you can redistribute it and/or modify it under the terms of the GNU
ba8183e1a0c699f5b5131a03e157fc7e39ed3009vboxsync * General Public License (GPL) as published by the Free Software
ba8183e1a0c699f5b5131a03e157fc7e39ed3009vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
ba8183e1a0c699f5b5131a03e157fc7e39ed3009vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
ba8183e1a0c699f5b5131a03e157fc7e39ed3009vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
ba8183e1a0c699f5b5131a03e157fc7e39ed3009vboxsync * The contents of this file may alternatively be used under the terms
ba8183e1a0c699f5b5131a03e157fc7e39ed3009vboxsync * of the Common Development and Distribution License Version 1.0
ba8183e1a0c699f5b5131a03e157fc7e39ed3009vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
ba8183e1a0c699f5b5131a03e157fc7e39ed3009vboxsync * VirtualBox OSE distribution, in which case the provisions of the
ba8183e1a0c699f5b5131a03e157fc7e39ed3009vboxsync * CDDL are applicable instead of those of the GPL.
ba8183e1a0c699f5b5131a03e157fc7e39ed3009vboxsync * You may elect to license modified versions of this file under the
ba8183e1a0c699f5b5131a03e157fc7e39ed3009vboxsync * terms and conditions of either the GPL or the CDDL or both.
ba8183e1a0c699f5b5131a03e157fc7e39ed3009vboxsync/*******************************************************************************
ba8183e1a0c699f5b5131a03e157fc7e39ed3009vboxsync* Header Files *
ba8183e1a0c699f5b5131a03e157fc7e39ed3009vboxsync*******************************************************************************/
ba8183e1a0c699f5b5131a03e157fc7e39ed3009vboxsyncRTDECL(int) RTGetOpt(int argc, char *argv[], PCRTOPTIONDEF paOptions, size_t cOptions, int *piThis, PRTOPTIONUNION pValueUnion)
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync bool fShort = false;
ba8183e1a0c699f5b5131a03e157fc7e39ed3009vboxsync || ( (fShort = (pszArgThis[1] == paOptions[i].iShort))
ba8183e1a0c699f5b5131a03e157fc7e39ed3009vboxsync Assert(!(paOptions[i].fFlags & ~RTGETOPT_REQ_MASK));
ba8183e1a0c699f5b5131a03e157fc7e39ed3009vboxsync if ((paOptions[i].fFlags & RTGETOPT_REQ_MASK) != RTGETOPT_REQ_NOTHING)
ba8183e1a0c699f5b5131a03e157fc7e39ed3009vboxsync AssertMsgFailed(("i=%d f=%#x\n", i, paOptions[i].fFlags));
9e66213005c4dba14a83d8467a93f5f51b504c97vboxsync /** @todo Sort options and arguments (i.e. stuff that doesn't start with '-'), stop when
5d69af51557e9e9db029ecd243e820383af49b18vboxsync * encountering the first argument. */