vitunes
 All Data Structures
ecmd.h
1 /*
2  * Copyright (c) 2010, 2011, 2012 Ryan Flannery <ryan.flannery@gmail.com>
3  * Copyright (c) 2013 Tiago Cunha <tcunha@gmx.com>
4  *
5  * Permission to use, copy, modify, and distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  */
17 
18 #ifndef ECMD_H
19 #define ECMD_H
20 
21 #include <err.h>
22 #include <stdio.h>
23 #include <string.h>
24 #include <unistd.h>
25 
26 #include "../vitunes.h"
27 
28 struct ecmd {
29  const char *name;
30  const char *alias; /* may be NULL */
31  const char *usage; /* may be NULL */
32  int args_lower; /* minimum number of arguments */
33  int args_upper; /* negative number means no limit */
34  int (*parse)(int argc, char **argv); /* may be NULL */
35  int (*check)(void); /* may be NULL */
36  void (*exec)(int argc, char **argv);
37 };
38 
39 extern const struct ecmd ecmd_add;
40 extern const struct ecmd ecmd_addurl;
41 extern const struct ecmd ecmd_check;
42 extern const struct ecmd ecmd_flush;
43 extern const struct ecmd ecmd_help;
44 extern const struct ecmd ecmd_init;
45 extern const struct ecmd ecmd_rmfile;
46 extern const struct ecmd ecmd_tag;
47 extern const struct ecmd ecmd_update;
48 
49 int ecmd_exec(const char *ecmd, int argc, char **argv);
50 
51 #endif