|
a/upplay.cpp |
|
b/upplay.cpp |
|
... |
|
... |
41 |
static const char *thisprog;
|
41 |
static const char *thisprog;
|
42 |
|
42 |
|
43 |
static int op_flags;
|
43 |
static int op_flags;
|
44 |
#define OPT_h 0x4
|
44 |
#define OPT_h 0x4
|
45 |
#define OPT_c 0x20
|
45 |
#define OPT_c 0x20
|
|
|
46 |
#define OPT_v 0x40
|
46 |
|
47 |
|
47 |
static const char usage [] =
|
48 |
static const char usage [] =
|
48 |
"\n"
|
49 |
"upplay [-h] [-v] : options: get help and version\n"
|
49 |
;
|
50 |
;
|
|
|
51 |
|
|
|
52 |
static void
|
|
|
53 |
versionInfo(FILE *fp)
|
|
|
54 |
{
|
|
|
55 |
fprintf(fp, "Upplay %s %s\n",
|
|
|
56 |
UPPLAY_VERSION, LibUPnP::versionString().c_str());
|
|
|
57 |
}
|
|
|
58 |
|
50 |
static void
|
59 |
static void
|
51 |
Usage(void)
|
60 |
Usage(void)
|
52 |
{
|
61 |
{
|
53 |
FILE *fp = (op_flags & OPT_h) ? stdout : stderr;
|
62 |
FILE *fp = (op_flags & OPT_h) ? stdout : stderr;
|
54 |
fprintf(fp, "%s: Usage: %s", thisprog, usage);
|
63 |
fprintf(fp, "%s: Usage: %s", thisprog, usage);
|
|
|
64 |
versionInfo(fp);
|
55 |
exit((op_flags & OPT_h)==0);
|
65 |
exit((op_flags & OPT_h)==0);
|
56 |
}
|
66 |
}
|
57 |
|
67 |
|
58 |
|
68 |
|
59 |
int main(int argc, char **argv)
|
69 |
int main(int argc, char **argv)
|
60 |
{
|
70 |
{
|
61 |
QApplication app(argc, argv);
|
71 |
QApplication app(argc, argv);
|
62 |
|
72 |
|
63 |
QCoreApplication::setOrganizationName("Upmpd.org");
|
73 |
QCoreApplication::setOrganizationName("Upmpd.org");
|
64 |
QCoreApplication::setApplicationName("upplay");
|
74 |
QCoreApplication::setApplicationName("upplay");
|
65 |
|
|
|
66 |
string a_config;
|
|
|
67 |
|
75 |
|
68 |
QStringList params;
|
76 |
QStringList params;
|
69 |
for(int i = 1; i < argc; i++){
|
77 |
for(int i = 1; i < argc; i++){
|
70 |
QString param(argv[i]);
|
78 |
QString param(argv[i]);
|
71 |
params.push_back(param);
|
79 |
params.push_back(param);
|
|
... |
|
... |
78 |
(*argv)++;
|
86 |
(*argv)++;
|
79 |
if (!(**argv))
|
87 |
if (!(**argv))
|
80 |
Usage();
|
88 |
Usage();
|
81 |
while (**argv)
|
89 |
while (**argv)
|
82 |
switch (*(*argv)++) {
|
90 |
switch (*(*argv)++) {
|
83 |
case 'c': op_flags |= OPT_c; if (argc < 2) Usage();
|
91 |
case 'h': op_flags |= OPT_h; Usage(); break;
|
84 |
a_config = *(++argv);
|
92 |
case 'v': op_flags |= OPT_v; versionInfo(stdout); exit(0); break;
|
85 |
argc--; goto b1;
|
|
|
86 |
default: Usage();
|
93 |
default: Usage();
|
87 |
}
|
94 |
}
|
88 |
b1: argc--; argv++;
|
95 |
argc--; argv++;
|
89 |
}
|
96 |
}
|
90 |
|
97 |
|
91 |
if (argc > 0)
|
98 |
if (argc > 0)
|
92 |
Usage();
|
99 |
Usage();
|
93 |
|
100 |
|