source: trunk/Lucide/SOURCE/gui/lcd.c @ 138

Last change on this file since 138 was 138, checked in by Eugene Romanenko, 15 years ago

Better solution for #78, move GUI to DLL, executor sets BeginLibPath? and loads GUI DLL (closes #78)

File size: 2.6 KB
Line 
1/* ***** BEGIN LICENSE BLOCK *****
2 * Version: CDDL 1.0/LGPL 2.1
3 *
4 * The contents of this file are subject to the COMMON DEVELOPMENT AND
5 * DISTRIBUTION LICENSE (CDDL) Version 1.0 (the "License"); you may not use
6 * this file except in compliance with the License. You may obtain a copy of
7 * the License at http://www.sun.com/cddl/
8 *
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
12 * License.
13 *
14 * The Initial Developer of the Original Code is
15 * Eugene Romanenko, netlabs.org.
16 * Portions created by the Initial Developer are Copyright (C) 2006
17 * the Initial Developer. All Rights Reserved.
18 *
19 * Contributor(s):
20 *
21 * Alternatively, the contents of this file may be used under the terms of
22 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
23 * in which case the provisions of the LGPL are applicable instead of those
24 * above. If you wish to allow use of your version of this file only under the
25 * terms of the LGPL, and not to allow others to use your version of this file
26 * under the terms of the CDDL, indicate your decision by deleting the
27 * provisions above and replace them with the notice and other provisions
28 * required by the LGPL. If you do not delete the provisions above, a recipient
29 * may use your version of this file under the terms of any one of the CDDL
30 * or the LGPL.
31 *
32 * ***** END LICENSE BLOCK ***** */
33
34
35#define INCL_DOS
36#include <os2.h>
37
38#include <string.h>
39#include <process.h>
40
41//
42// Lcd.exe sets BEGINLIBPATH to directory where Lucide resides
43// and executes Lucide.exe
44//
45
46char lucideDir[ CCHMAXPATH ] = "";
47
48typedef APIRET (APIENTRY *LMain)(int argc, char **argv);
49
50int main( int argc, char *argv[] )
51{
52    int result = 1;
53    char *last_slash;
54    HMODULE hmod = NULLHANDLE;
55
56#ifdef __TEST__
57    PPIB pib;
58    PTIB tib;
59    DosGetInfoBlocks(&tib, &pib);
60    pib->pib_ultype = 3;
61#endif
62
63    // fill lucide dir
64    strcpy( lucideDir, argv[0] );
65    if ( ( last_slash = strrchr( lucideDir, '\\' ) ) == NULL ) {
66        return 1;
67    }
68    else {
69        *last_slash = 0;
70    }
71
72    // set beginlibpath
73    DosSetExtLIBPATH( lucideDir, BEGIN_LIBPATH );
74
75    if ( DosLoadModule( NULL, 0, "Lucide", &hmod ) == 0 )
76    {
77        PFN pfn = NULL;
78        if ( DosQueryProcAddr( hmod, 0, "LucideMain", &pfn ) == 0 )
79        {
80            LMain LucideMain = (LMain)pfn;
81            result = LucideMain( argc, argv );
82        }
83        DosFreeModule (hmod);
84    }
85
86    return result;
87}
88
Note: See TracBrowser for help on using the repository browser.