mirror of
https://github.com/onyx-and-iris/vmrcli.git
synced 2024-11-15 17:40:56 +00:00
add help()
This commit is contained in:
parent
73b6a1d7b6
commit
9046d50446
27
src/vmrcli.c
27
src/vmrcli.c
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#define MAX_LINE 1024
|
#define MAX_LINE 1024
|
||||||
|
|
||||||
|
void help(char *progname);
|
||||||
int set_kind(char *kval);
|
int set_kind(char *kval);
|
||||||
int init_voicemeeter(T_VBVMR_INTERFACE *vmr, int kind);
|
int init_voicemeeter(T_VBVMR_INTERFACE *vmr, int kind);
|
||||||
void interactive(T_VBVMR_INTERFACE *vmr);
|
void interactive(T_VBVMR_INTERFACE *vmr);
|
||||||
@ -14,21 +15,23 @@ void interactive(T_VBVMR_INTERFACE *vmr);
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
bool iflag = false;
|
bool iflag = false;
|
||||||
int c;
|
int opt;
|
||||||
char *kvalue;
|
char *kvalue = "";
|
||||||
int kind = BANANA;
|
int kind = BANANA;
|
||||||
|
|
||||||
while ((c = getopt(argc, argv, "k:i")) != -1)
|
while ((opt = getopt(argc, argv, "k:ih")) != -1)
|
||||||
{
|
{
|
||||||
switch (c)
|
switch (opt)
|
||||||
{
|
{
|
||||||
case 'i':
|
case 'i':
|
||||||
iflag = true;
|
iflag = true;
|
||||||
break;
|
break;
|
||||||
case 'k':
|
case 'k':
|
||||||
kvalue = optarg;
|
kvalue = optarg;
|
||||||
kind = set_kind(kvalue);
|
|
||||||
break;
|
break;
|
||||||
|
case 'h':
|
||||||
|
help(argv[0]);
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
default:
|
default:
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
@ -36,6 +39,10 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
static T_VBVMR_INTERFACE iVMR;
|
static T_VBVMR_INTERFACE iVMR;
|
||||||
T_VBVMR_INTERFACE *vmr = &iVMR;
|
T_VBVMR_INTERFACE *vmr = &iVMR;
|
||||||
|
if (kvalue && kvalue[0] != '\0')
|
||||||
|
{
|
||||||
|
kind = set_kind(kvalue);
|
||||||
|
}
|
||||||
|
|
||||||
int rep = init_voicemeeter(vmr, kind);
|
int rep = init_voicemeeter(vmr, kind);
|
||||||
if (rep != 0)
|
if (rep != 0)
|
||||||
@ -68,6 +75,16 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void help(char *progname)
|
||||||
|
{
|
||||||
|
printf(
|
||||||
|
"Usage: ./%s [-i] [-k] <api commands>\n"
|
||||||
|
"Where: \n"
|
||||||
|
"\ti: Enable interactive mode\n"
|
||||||
|
"\tk: The kind of Voicemeeter (basic, banana, potato)\n",
|
||||||
|
progname);
|
||||||
|
}
|
||||||
|
|
||||||
int set_kind(char *kval)
|
int set_kind(char *kval)
|
||||||
{
|
{
|
||||||
if (strcmp(kval, "basic") == 0)
|
if (strcmp(kval, "basic") == 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user