1 /*******************************************************************************
2  * Copyright (c) 2000, 2010 IBM Corporation and others.
3  *
4  * This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License 2.0
6  * which accompanies this distribution, and is available at
7  * https://www.eclipse.org/legal/epl-2.0/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *     IBM Corporation - initial API and implementation
13  *******************************************************************************/
14 
15 #ifndef ECLIPSE_CONFIG_H
16 #define ECLIPSE_CONFIG_H
17 
18 /* Configuration file reading utilities */
19 
20 /**
21  * Reads a configuration file for the corresponding
22  * program argument.
23  * e.g if the program argument contains "c:/folder/eclipse.exe"
24  * then the config file "c:/folder/eclipse.ini" will be parsed.
25  * On a Unix like platform, for a program argument "/usr/eclipse/eclipse"
26  * should correspond a configuration file "/usr/eclipse/eclipse.ini"
27  *
28  * This method will call readConfigFile to read the actual ini file
29  *
30  * This method will use getIniFile with a value for consoleLauncher that
31  * is determined at compile time.  Clients who are not the actual
32  * win32 console executable should instead use getIniFile and readConfigFile.
33  *
34  * Returns 0 if success.
35  */
36 extern int readIniFile(_TCHAR* program, int *argc, _TCHAR ***argv);
37 
38 /**
39  * Return the path to the launcher ini file for the corresponding program
40  * argument. On win32, an "eclipsec.exe' console launcher can use the "eclipse.ini"
41  * ini file.
42  * consoleLauncher : whether or not we are using the win32 "eclipsec" console launcher
43  *                   has no affect on other platforms
44  */
45 extern _TCHAR* getIniFile(_TCHAR* program, int consoleLauncher);
46 
47 /**
48  * Reads the given configuration file
49  * The argument argv refers to a newly allocated array of strings.
50  * The first entry is the program name to mimic the expectations
51  * from a typical argv list.
52  * The last entry of that array is NULL.
53  * Each non NULL entry in that array must be freed by the caller
54  * as well as the array itself, using freeConfig().
55  * The argument argc contains the number of string allocated.
56  *
57  * Returns 0 if success.
58  */
59 extern int readConfigFile( _TCHAR * config_file, int *argc, _TCHAR ***argv );
60 /**
61  * Free the memory allocated by readConfigFile().
62  */
63 extern void freeConfig(_TCHAR **args);
64 
65 #endif /* ECLIPSE_CONFIG_H */
66