/usr/include/winpr2/winpr/cmdline.h is in libwinpr2-dev 2.0.0~git20170725.1.1648deb+dfsg1-7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | /**
* WinPR: Windows Portable Runtime
* Command-Line Utils
*
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef WINPR_CMDLINE_H
#define WINPR_CMDLINE_H
#include <winpr/winpr.h>
#include <winpr/wtypes.h>
/* Command-Line Argument Flags */
#define COMMAND_LINE_INPUT_FLAG_MASK 0x0000FFFF
#define COMMAND_LINE_OUTPUT_FLAG_MASK 0xFFFF0000
/* Command-Line Argument Input Flags */
#define COMMAND_LINE_VALUE_FLAG 0x00000001
#define COMMAND_LINE_VALUE_REQUIRED 0x00000002
#define COMMAND_LINE_VALUE_OPTIONAL 0x00000004
#define COMMAND_LINE_VALUE_BOOL 0x00000008
#define COMMAND_LINE_ADVANCED 0x00000100
#define COMMAND_LINE_PRINT 0x00000200
#define COMMAND_LINE_PRINT_HELP 0x00000400
#define COMMAND_LINE_PRINT_VERSION 0x00000800
#define COMMAND_LINE_PRINT_BUILDCONFIG 0x00001000
/* Command-Line Argument Output Flags */
#define COMMAND_LINE_ARGUMENT_PRESENT 0x80000000
#define COMMAND_LINE_VALUE_PRESENT 0x40000000
/* Command-Line Parsing Flags */
#define COMMAND_LINE_SIGIL_NONE 0x00000001
#define COMMAND_LINE_SIGIL_SLASH 0x00000002
#define COMMAND_LINE_SIGIL_DASH 0x00000004
#define COMMAND_LINE_SIGIL_DOUBLE_DASH 0x00000008
#define COMMAND_LINE_SIGIL_PLUS_MINUS 0x00000010
#define COMMAND_LINE_SIGIL_ENABLE_DISABLE 0x00000020
#define COMMAND_LINE_SIGIL_NOT_ESCAPED 0x00000040
#define COMMAND_LINE_SEPARATOR_COLON 0x00000100
#define COMMAND_LINE_SEPARATOR_EQUAL 0x00000200
#define COMMAND_LINE_SEPARATOR_SPACE 0x00000400
/* Supress COMMAND_LINE_ERROR_NO_KEYWORD return. */
#define COMMAND_LINE_IGN_UNKNOWN_KEYWORD 0x00001000
/* Command-Line Parsing Error Codes */
#define COMMAND_LINE_ERROR -1000
#define COMMAND_LINE_ERROR_NO_KEYWORD -1001
#define COMMAND_LINE_ERROR_UNEXPECTED_VALUE -1002
#define COMMAND_LINE_ERROR_MISSING_VALUE -1003
#define COMMAND_LINE_ERROR_MISSING_ARGUMENT -1004
#define COMMAND_LINE_ERROR_UNEXPECTED_SIGIL -1005
#define COMMAND_LINE_ERROR_MEMORY -1006
#define COMMAND_LINE_ERROR_LAST -1999
/* Command-Line Parsing Status Codes */
#define COMMAND_LINE_STATUS_PRINT -2001
#define COMMAND_LINE_STATUS_PRINT_HELP -2002
#define COMMAND_LINE_STATUS_PRINT_VERSION -2003
#define COMMAND_LINE_STATUS_PRINT_BUILDCONFIG -2004
/* Command-Line Macros */
#define CommandLineSwitchStart(_arg) if (0) { }
#define CommandLineSwitchCase(_arg, _name) else if (strcmp(_arg->Name, _name) == 0)
#define CommandLineSwitchDefault(_arg) else
#define CommandLineSwitchEnd(_arg)
#define BoolValueTrue ((LPSTR) 1)
#define BoolValueFalse ((LPSTR) 0)
typedef struct _COMMAND_LINE_ARGUMENT_A COMMAND_LINE_ARGUMENT_A;
typedef struct _COMMAND_LINE_ARGUMENT_W COMMAND_LINE_ARGUMENT_W;
struct _COMMAND_LINE_ARGUMENT_A
{
LPCSTR Name;
DWORD Flags;
LPCSTR Format;
LPCSTR Default;
LPSTR Value;
LONG Index;
LPCSTR Alias;
LPCSTR Text;
};
struct _COMMAND_LINE_ARGUMENT_W
{
LPCWSTR Name;
DWORD Flags;
LPCSTR Format;
LPWSTR Default;
LPWSTR Value;
LONG Index;
LPCWSTR Alias;
LPCWSTR Text;
};
#ifdef UNICODE
#define COMMAND_LINE_ARGUMENT COMMAND_LINE_ARGUMENT_W
#else
#define COMMAND_LINE_ARGUMENT COMMAND_LINE_ARGUMENT_A
#endif
typedef int (*COMMAND_LINE_PRE_FILTER_FN_A)(void* context, int index, int argc, LPCSTR* argv);
typedef int (*COMMAND_LINE_PRE_FILTER_FN_W)(void* context, int index, int argc, LPCWSTR* argv);
typedef int (*COMMAND_LINE_POST_FILTER_FN_A)(void* context, COMMAND_LINE_ARGUMENT_A* arg);
typedef int (*COMMAND_LINE_POST_FILTER_FN_W)(void* context, COMMAND_LINE_ARGUMENT_W* arg);
#ifdef __cplusplus
extern "C" {
#endif
WINPR_API int CommandLineClearArgumentsA(COMMAND_LINE_ARGUMENT_A* options);
WINPR_API int CommandLineClearArgumentsW(COMMAND_LINE_ARGUMENT_W* options);
WINPR_API int CommandLineParseArgumentsA(int argc, LPCSTR* argv, COMMAND_LINE_ARGUMENT_A* options, DWORD flags,
void* context, COMMAND_LINE_PRE_FILTER_FN_A preFilter, COMMAND_LINE_POST_FILTER_FN_A postFilter);
WINPR_API int CommandLineParseArgumentsW(int argc, LPCWSTR* argv, COMMAND_LINE_ARGUMENT_W* options, DWORD flags,
void* context, COMMAND_LINE_PRE_FILTER_FN_W preFilter, COMMAND_LINE_POST_FILTER_FN_W postFilter);
WINPR_API COMMAND_LINE_ARGUMENT_A* CommandLineFindArgumentA(COMMAND_LINE_ARGUMENT_A* options, LPCSTR Name);
WINPR_API COMMAND_LINE_ARGUMENT_W* CommandLineFindArgumentW(COMMAND_LINE_ARGUMENT_W* options, LPCWSTR Name);
WINPR_API COMMAND_LINE_ARGUMENT_A* CommandLineFindNextArgumentA(COMMAND_LINE_ARGUMENT_A* argument);
#ifdef __cplusplus
}
#endif
#ifdef UNICODE
#define CommandLineClearArguments CommandLineClearArgumentsW
#define CommandLineParseArguments CommandLineParseArgumentsW
#define CommandLineFindArgument CommandLineFindArgumentW
#else
#define CommandLineClearArguments CommandLineClearArgumentsA
#define CommandLineParseArguments CommandLineParseArgumentsA
#define CommandLineFindArgument CommandLineFindArgumentA
#endif
#endif /* WINPR_CMDLINE_H */
|