46 typedef enum {
47 LT_CMDOPT_INTERVAL,
48 LT_CMDOPT_LOG_FILE,
49 LT_CMDOPT_LOG_LEVEL,
50 LT_CMDOPT_LOG_INTERVAL,
51 LT_CMDOPT_CONFIG_FILE,
52 LT_CMDOPT_F_FILTER,
53 LT_CMDOPT_F_SCHED,
54 LT_CMDOPT_F_SOBJ,
55 LT_CMDOPT_F_LOW,
56 LT_CMDOPT_SELECT,
57 LT_CMDOPT__LAST /* Must be the last one */
58 } lt_cmd_option_id_t;
59
60 /*
61 * Check for duplicate command line options.
62 * Returns TRUE if duplicate options with different values are found,
63 * returns FALSE otherwise.
64 */
65 static int
66 check_opt_dup(lt_cmd_option_id_t id, uint64_t value) {
67
68 static int opt_set[(int)LT_CMDOPT__LAST];
69 static uint64_t opt_val[(int)LT_CMDOPT__LAST];
70
71 const char *errmsg[] = {
72 "-t is set more than once with different values.",
73 "-o is set more than once.",
74 "-k is set more than once with different values.",
75 "-l is set more than once with different values.",
76 "-c is set more than once.",
77 "-f [no]filter is set more than once with different values.",
78 "-f [no]sched is set more than once with different values.",
79 "-f [no]sobj is set more than once with different values.",
80 "-f [no]low is set more than once with different values.",
81 "-s is set more than once with different values."
82 };
83
84 g_assert(sizeof (errmsg)/sizeof (errmsg[0]) == (int)LT_CMDOPT__LAST);
85
86 if (!opt_set[(int)id]) {
|
46 typedef enum {
47 LT_CMDOPT_INTERVAL,
48 LT_CMDOPT_LOG_FILE,
49 LT_CMDOPT_LOG_LEVEL,
50 LT_CMDOPT_LOG_INTERVAL,
51 LT_CMDOPT_CONFIG_FILE,
52 LT_CMDOPT_F_FILTER,
53 LT_CMDOPT_F_SCHED,
54 LT_CMDOPT_F_SOBJ,
55 LT_CMDOPT_F_LOW,
56 LT_CMDOPT_SELECT,
57 LT_CMDOPT__LAST /* Must be the last one */
58 } lt_cmd_option_id_t;
59
60 /*
61 * Check for duplicate command line options.
62 * Returns TRUE if duplicate options with different values are found,
63 * returns FALSE otherwise.
64 */
65 static int
66 check_opt_dup(lt_cmd_option_id_t id, uint64_t value)
67 {
68
69 static int opt_set[(int)LT_CMDOPT__LAST];
70 static uint64_t opt_val[(int)LT_CMDOPT__LAST];
71
72 const char *errmsg[] = {
73 "-t is set more than once with different values.",
74 "-o is set more than once.",
75 "-k is set more than once with different values.",
76 "-l is set more than once with different values.",
77 "-c is set more than once.",
78 "-f [no]filter is set more than once with different values.",
79 "-f [no]sched is set more than once with different values.",
80 "-f [no]sobj is set more than once with different values.",
81 "-f [no]low is set more than once with different values.",
82 "-s is set more than once with different values."
83 };
84
85 g_assert(sizeof (errmsg)/sizeof (errmsg[0]) == (int)LT_CMDOPT__LAST);
86
87 if (!opt_set[(int)id]) {
|