reworking the kluge

This commit is contained in:
2020-02-21 18:05:13 +01:00
parent e540df566a
commit cff083a21d
7 changed files with 151 additions and 3 deletions

View File

@@ -21,6 +21,7 @@
#include <lo/lo.h>
#include "functions/senders.h"
#include "functions/joyutils.h"
/* default values, can be changed on command line */
@@ -39,11 +40,12 @@ char *my_id = MY_TEXT_ID;
static void help(int k)
{
puts("\t * joystick -> osc "__DATE__" *");
puts("\t-D\tdump joystick datas");
puts("\t-r\tremote host ("REMOTE_HOST")");
puts("\t-p\tremote UDP port ("REMOTE_PORT")");
puts("\t-j\tjoystick device ("JOY_DEVICE")");
puts("\t-v\tincrease verbosity");
puts("\t-o\toffset added to button number");
printf("\t-o\toffset added to button number (%d)\n", button_offset);
puts("\t-I\tchange text id (\""MY_TEXT_ID"\")");
exit(0);
}
@@ -58,10 +60,12 @@ int opt;
char *remote_host = REMOTE_HOST;
char *remote_port = REMOTE_PORT;
char *joy_device = JOY_DEVICE;
int do_dump = 0;
/* parsing command line options */
while ((opt = getopt(argc, argv, "hp:r:vj:o:I:")) != -1) {
while ((opt = getopt(argc, argv, "Dhp:r:vj:o:I:")) != -1) {
switch (opt) {
case 'D': do_dump = 1; break;
case 'h': help(0); break;
case 'r': remote_host = optarg; break;
case 'p': remote_port = optarg; break;
@@ -74,6 +78,11 @@ while ((opt = getopt(argc, argv, "hp:r:vj:o:I:")) != -1) {
}
}
if (do_dump) {
fprintf(stderr, "dumping data from '%s'\n", joy_device);
dump_my_joystick(joy_device);
}
if (verbosity) {
fprintf(stderr, "%s is sending to %s:%s\n", argv[0],
remote_host, remote_port);