eb2868be23f1ba333645f3e819c4812a93646677
2 * opts.c -- GTK+ 2 omnplay
3 * Copyright (C) 2011 Maksym Veremeyenko <verem@m1stereo.tv>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software Foundation,
17 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 #include <gdk/gdkkeysyms.h>
33 static const char short_options
[] = "h";
34 static const struct option long_options
[] =
36 { "directory", required_argument
, NULL
, '0'},
37 { "player", required_argument
, NULL
, '1'},
38 { "library", required_argument
, NULL
, '2'},
39 { "whois", required_argument
, NULL
, '3'},
40 { "help", no_argument
, NULL
, 'h'},
46 int omnplay_opt(int argc
, char** argv
, omnplay_instance_t
* app
)
52 optind
= 0; opterr
= 0; optopt
= 0;
54 /* program arguments processing */
57 c
= getopt_long (argc
, argv
, short_options
, long_options
, &index
);
67 strncpy(app
->players
.path
, optarg
, PATH_MAX
);
72 p
= strchr(optarg
, '@');
76 strncpy(app
->players
.item
[app
->players
.count
].name
, optarg
, PATH_MAX
);
77 strncpy(app
->players
.item
[app
->players
.count
].host
, p
+ 1, PATH_MAX
);
78 app
->players
.item
[app
->players
.count
].idx
= app
->players
.count
;
79 app
->players
.item
[app
->players
.count
].app
= app
;
86 strncpy(app
->library
.filename
, optarg
, PATH_MAX
);
91 strncpy(app
->library
.whois
, optarg
, PATH_MAX
);
95 fprintf(stderr
, "ERROR: Incorrect argument!\n");
104 void omnplay_usage(void)
110 "\t--directory=<PATH> Directory to override default\n"
111 "\t--player=<STRING> Player to use in a form <player_name>@<mediadirector host>\n"