Subversion Repositories svn1

Rev

Rev 386 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
171 david 1
/*************************************************************************
2
*           Copyright (C) 1992 Embedded Solutions.
3
*                       All rights reserved
4
*
5
* file:         mara.c
6
*
7
* purpose:      Main entry point
8
*               Marathon program  program
9
*
10
* functions:
11
*       main                    - Main entry point
12
*       usage                   - Display general usage message
13
*       ms_system               - Temp escape to DOS
14
*       test_legal_version      - Test program version
15
*
16
*
17
* programmer: David Purdie (DDP)
18
*
19
* revision  date        by      reason
20
*           13-May-91   DDP     Added a nasty.
21
*                               This program will produce funny results if
22
*                               the system date is after 1-Jan-92.
23
*
24
*           25-Oct-91   DDP     Version 2.01 will not produce funny results
25
*
26
*   00.0    6-Nov-92    DDP     Ansified existing code
27
*   00.0    27/01/95    DDP     Tidies up the program and formatted the file
28
*
29
**************************************************************************/
384 david 30
#include    <QApplication>
380 david 31
#include    <QMessageBox>
171 david 32
 
33
#include    <time.h>
34
#include    "consts.h"
35
#include    "structs.h"
36
#include    "proto.h"
37
 
38
#include    "qmconfteams.h"
39
#include    "mainwindow.h"
173 - 40
#include    "qmconfig.h"
177 - 41
#include    "qmteamdata.h"
171 david 42
 
43
#undef      DISPLAY_STRUCTURES
44
 
45
/*============================================================================
46
 *  Main entry point
47
 *
48
 *  Purpose:
49
 *      Main enrty point
50
 *      Load configuration file
51
 *      Locate data base
52
 *      Perform copyright stuff
53
 *      Process top level menu
54
 *
55
 *  Parameters:
56
 *      argc    - number of arguments
57
 *      argv    - pointer to first argument pointer
58
 *      
59
 *      
60
 *  Returns:
61
 *      program exit code
62
 *          0 - All is well
63
 *          1 -
64
 *          2 - 
65
 *
66
 *===========================================================================*/
67
 
68
int main( int argc, char *argv[] )
69
{
175 - 70
    QString       eventFile;
171 david 71
    QApplication a(argc, argv);
72
 
73
    /*
74
    **  Verify command arguments
75
    */
213 david 76
//    if( argc < 2 )
77
//        usage();
171 david 78
 
79
    /*
80
    **  Walk the user arguments and extract switches and file names
81
    */
82
    while( --argc )
83
    {
84
        argv++;
85
        if( argv[0][0] == '-' )
86
        {
87
            switch( argv[0][1] )
88
            {
388 david 89
            case 'h':
171 david 90
                /*
91
                **  Unknown switch
92
                */
93
              default:
94
                usage();
95
            }
96
        }
97
        else
98
        {
99
            /*
100
            **  Parameter without a switch
101
            **  Must be the input file name
102
            */
175 - 103
            if( !eventFile.isEmpty() )                   /* Already defined */
171 david 104
            {
105
                qWarning("Mutiple input files found");
106
            }
175 - 107
            eventFile = argv[0];
171 david 108
        }
109
    }
110
 
176 - 111
    config.load(eventFile);
177 - 112
    QmTeamData  teamDataReader;
113
    teamDataReader.initTeamData(NULL);
173 - 114
 
171 david 115
    MainWindow w;
116
    w.show();
117
 
118
    MainWindow::showMessage ("Mara Started", 5000);
119
    return a.exec();
120
  }
121
 
122
/*============================================================================
123
 *
124
 *  Display general usage message
125
 *
126
 *  Purpose:
127
 *      Display general usage message
128
 *      Used on command line syntax error
129
 *      
130
 *  Parameters:
131
 *      None
132
 *      
133
 *  Returns:
134
 *      exit code 3
135
 *      
136
 *===========================================================================*/
137
 
138
void usage(void)
139
{
388 david 140
    QMessageBox ( QMessageBox::Question,
141
                  "Usage",
142
                  "mara [options] config_file\n"
143
                  "Options are:\n"
144
                  " -h : This message\n"
145
                  "    No options yet"
146
                ).exec();
171 david 147
    exit( 3 );
148
}
149
 
150
 
151
 
152
/********************************* EOF ***********************************/
153