home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
yacl-012.zip
/
ui
/
mainprog.cxx
< prev
next >
Wrap
C/C++ Source or Header
|
1995-04-04
|
2KB
|
91 lines
/*
*
* Copyright (C) 1994, M. A. Sridhar
*
*
* This software is Copyright M. A. Sridhar, 1994. You are free
* to copy, modify or distribute this software as you see fit,
* and to use it for any purpose, provided this copyright
* notice and the following disclaimer are included with all
* copies.
*
* DISCLAIMER
*
* The author makes no warranties, either expressed or implied,
* with respect to this software, its quality, performance,
* merchantability, or fitness for any particular purpose. This
* software is distributed AS IS. The user of this software
* assumes all risks as to its quality and performance. In no
* event shall the author be liable for any direct, indirect or
* consequential damages, even if the author has been advised
* as to the possibility of such damages.
*
*/
#if defined(__GNUC__)
#pragma implementation
#endif
// A default main program included with YACL's user interface library
#if defined(__MS_WINDOWS__)
#include <string.h>
#include <windows.h>
#endif
#include "base/string.h"
#include "ui/applic.h"
#if defined(__MS_WINDOWS__)
int PASCAL WinMain(HANDLE hInstance, HANDLE hPrevInstance,
LPSTR lpCmdLn, int nCmdShow)
#elif defined(__X_MOTIF__) || defined(__OS2__)
int main (int argc, char* argv[])
#endif
{
bool ownApp = FALSE;
UI_Application* theApp = _TheApplication;
if (!theApp) {
theApp = new UI_Application;
ownApp = TRUE;
}
#if defined(__MS_WINDOWS__)
CL_String fld[20];
short argc = CL_String (lpCmdLn).Split (fld, 20);
char** argv = new char* [argc+1];
for (short i = 0; i < argc; i++) {
argv[i] = new char [fld[i].Size() + 1];
strcpy (argv[i], (const char*) fld[i]);
}
argv[argc] = 0;
theApp->Initialize (hInstance, hPrevInstance, lpCmdLn, nCmdShow);
#elif defined(__X_MOTIF__) || defined(__OS2__)
theApp->Initialize (argc, argv);
#endif
int returnVal = theApp->Main (argc, argv);
#if defined(__MS_WINDOWS__)
for (i = 0; i < argc; i++) {
delete [] argv[i];
}
delete [] argv;
#endif
if (ownApp)
delete theApp;
return returnVal;
}