Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / ACE / apps / JAWS / clients / Blobby / Options.cpp
blobd80d01d58d7b78e82a5f16d46199bdcb9622873d
1 #include "ace/Get_Opt.h"
2 #include "ace/ARGV.h"
3 #include "Blob.h"
4 #include "Blob_Handler.h"
5 #include "Options.h"
7 Options *Options::instance_ = 0;
9 Options *
10 Options::instance ()
12 if (Options::instance_ == 0)
13 Options::instance_ = new Options;
15 return Options::instance_;
18 void
19 Options::parse_args (int argc, ACE_TCHAR *argv[])
21 ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("rwh:p:f:l:o:d"));
23 int c;
25 while ((c = get_opt ()) != -1)
26 switch (c)
28 case 'd':
29 this->debug_ = 1;
30 break;
31 case 'r':
32 this->operation_ = 'r';
33 break;
34 case 'w':
35 this->operation_ = 'w';
36 break;
37 case 'h':
38 this->hostname_ = get_opt.opt_arg ();
39 break;
40 case 'p':
41 this->port_ = ACE_OS::atoi (get_opt.opt_arg ());
42 break;
43 case 'f':
44 this->filename_ = get_opt.opt_arg ();
45 break;
46 case 'l':
47 this->length_ = ACE_OS::atoi (get_opt.opt_arg ());
48 break;
49 case 'o':
50 this->offset_ = ACE_OS::atoi (get_opt.opt_arg ());
51 break;
52 default:
53 ACE_DEBUG ((LM_DEBUG, "%s -h hostname -f filename -[r/w] [-p port] [-l length] [-o offset] [-d]\n", argv[0]));
54 ACE_OS::exit (1);
56 if (this->hostname_ == 0 || this->filename_ == 0)
58 ACE_DEBUG ((LM_DEBUG,
59 "%s -h hostname -f filename -[r/w] [-p port] [-l length] [-o offset] [-d]\n",
60 argv[0]));
62 ACE_OS::exit (1);
67 Options::Options ()
68 : hostname_ (0),
69 port_ (ACE_DEFAULT_HTTP_SERVER_PORT),
70 filename_ (0),
71 length_ (0),
72 offset_ (0),
73 operation_ ('r'),
74 debug_ (0)