option.h (1078B)
1 /* 2 * MySmartUSB MK3 Interface 3 * 4 * @copyright: Copyright (c) 2012, Dominik Schmidt 5 * @author: Dominik Schmidt <das1993@hotmail.com> 6 * @version: 0.0.0 7 * @license: CC-BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0/) 8 * 9 */ 10 #pragma once 11 #include <common.h> 12 #include <cmd.h> 13 #include <termios.h> 14 #include <stdio.h> 15 16 extern struct conf configuration; 17 struct conf{ 18 char *filename; 19 char *device; 20 struct { 21 struct command_exec **data; 22 struct array arr; 23 } cmdlist; 24 unsigned short int need_mymode; 25 struct{ 26 char mode; 27 speed_t baud; 28 } oldmode; 29 unsigned short int print_usage; 30 int log_level; 31 unsigned short int color; 32 }; 33 34 35 struct option{ 36 char *long_option; 37 char *short_option; 38 unsigned short int arg_length; 39 char *usage; 40 char *description; 41 }; 42 enum GLOPT_TYPE{ 43 GLOPT_INCR, 44 GLOPT_DECR, 45 GLOPT_SET, 46 GLOPT_COUNT 47 }; 48 struct global_option{ 49 struct option opt; 50 unsigned int type; 51 void *data; 52 }; 53 extern struct global_option global_options[]; 54 extern void print_usage(FILE *stream); 55 extern int parseArguments(int argc, char **argv, struct conf *config);