/[diana_filewatcher]/branches/smhi/src/main.cc
ViewVC logotype

Diff of /branches/smhi/src/main.cc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 6 by Yngve.Einarsson@smhi.se, Wed Sep 23 12:34:41 2009 UTC revision 7 by stefan.fagerstrom@smhi.se, Thu Dec 31 10:04:51 2009 UTC
# Line 13  Line 13 
13    
14  #define _DEBUG  #define _DEBUG
15    
16    int main(int argc, char *argv[])
17    {
18    #ifdef _DEBUG
19      cerr << "FileWatcher main program called" << endl;
20    #endif
21      QApplication app(argc, argv);
22    
23    #ifdef _DEBUG
24      cerr << "argc: " << argc << endl;
25    
26      for(int i=0;i<argc;i++) {
27        cerr << "argv: " << miString(argv[i]) << endl;
28      }
29    #endif
30    
 int main(int argc, char *argv[])  
 {  
         #ifdef _DEBUG  
                 cerr << "FileWatcher main program called" << endl;  
         #endif  
   
         QApplication app(argc, argv);  
   
         #ifdef _DEBUG  
                 cerr << "argc: " << argc << endl;  
   
                 for(int i=0;i<argc;i++) {  
                         cerr << "argv: " << miString(argv[i]) << endl;  
                 }  
         #endif  
   
31    // parsing commandline-arguments    // parsing commandline-arguments
32    vector<miCommandLine::option> opt(7);    vector<miCommandLine::option> opt(7);
33    miString logfile;    miutil::miString logfile;
34    
35    opt[0].flag = 'd';    opt[0].flag = 'd';
36    opt[0].alias = "dynamic";    opt[0].alias = "dynamic";
# Line 61  int main(int argc, char *argv[]) Line 57  int main(int argc, char *argv[])
57    opt[5].hasArg = true;    opt[5].hasArg = true;
58    
59    miCommandLine cl(opt, qApp->argc(), qApp->argv());    miCommandLine cl(opt, qApp->argc(), qApp->argv());
60    
61    quint16 port;    quint16 port;
62    quint16 fileport;    quint16 fileport;
63    
64    if (cl.hasFlag('p')) {    if (cl.hasFlag('p')) {
65          cerr << "P flag sent" << endl;          cerr << "P flag sent" << endl;
66      //istringstream os((cl.arg('p'))[0]);      //istringstream os((cl.arg('p'))[0]);
67      //os >> port;      //os >> port;
68    
69          if (cl.arg('p').size() >= 0) {          if (cl.arg('p').size() >= 0) {
70                  port = miString(cl.arg('p')[0]).toInt(0);                  port = miutil::miString(cl.arg('p')[0]).toInt(0);
71          } else {          } else {
72                  #ifdef _DEBUG                  #ifdef _DEBUG
73                          cerr << "cl.arg('p').size() == 0" << cl.arg('p').size() << endl;                          cerr << "cl.arg('p').size() == 0" << cl.arg('p').size() << endl;
# Line 84  int main(int argc, char *argv[]) Line 80  int main(int argc, char *argv[])
80    //} else if (portFromRange == false) {    //} else if (portFromRange == false) {
81     */     */
82    } else {    } else {
83          #ifdef _DEBUG  #ifdef _DEBUG
84            cerr << "Flag p not set!!!"  << endl;      cerr << "Flag p not set!!!"  << endl;
85          #endif  #endif
86      port = qmstrings::port;      port = qmstrings::port;
87    }    }
88    if (cl.arg('L').size() > 0) {    if (cl.arg('L').size() > 0) {
# Line 94  int main(int argc, char *argv[]) Line 90  int main(int argc, char *argv[])
90    } else {    } else {
91            logfile = "";            logfile = "";
92    }    }
93    miString dir = "";    miutil::miString dir = "";
94    if (cl.hasFlag('w'))    if (cl.hasFlag('w'))
95    {    {
96          if (cl.arg('w').size() > 0)          if (cl.arg('w').size() > 0)
97            dir = cl.arg('w')[0];            dir = cl.arg('w')[0];
98    }    }
99    
100  #ifdef _DEBUG  #ifdef _DEBUG
101    cerr << "Port is really set to: " << port << endl;    cerr << "Port is really set to: " << port << endl;
102  #endif  #endif

Legend:
Removed from v.6  
changed lines
  Added in v.7

svn@met.no
ViewVC Help
Powered by ViewVC 1.1.5