8 static void set_default_options(struct plotter_options *opts)
10 bzero(opts, sizeof(*opts));
12 opts->baud_rate = 128000;
13 opts->device_path = "/dev/ttyUSB0";
16 int read_args(int argc, char *argv[], struct plotter_options *opts)
18 int option_index = 0, c;
19 static struct option long_options[] = {
20 { .val = 'd', .name = "device", .has_arg = 1, },
21 { .val = 'o', .name = "output", .has_arg = 1 },
22 { .val = 'o', .name = "baud", .has_arg = 1 },
24 char short_options[] = "d:o:b:";
26 set_default_options(opts);
29 c = getopt_long(argc, argv, short_options, long_options,
37 opts->device_path = optarg;
40 opts->output_path = optarg;
43 opts->baud_rate = atoi(optarg);
50 while (optind < argc) {
51 /* The rest of the options, ignored */