50
52
for (i=(*start); i<argc; i++) {
51
53
end = parse_option_end(argv[i]);
52
if(!end && !strncasecmp(argv[i], "where", 5)) {
55
command_len=strlen(argv[i]);
58
if(argv[i][end] == '=') {
59
option = (int)argv[i][end-1];
64
if(!end && !strncasecmp(argv[i], "where",
65
MAX(command_len, 5))) {
54
} if(!end && !strncasecmp(argv[i], "withassocinfo", 5)) {
67
} if(!end && !strncasecmp(argv[i], "withassocinfo",
68
MAX(command_len, 5))) {
55
69
txn_cond->with_assoc_info = 1;
58
|| (!strncasecmp (argv[i], "Id", 1))
59
|| (!strncasecmp (argv[i], "Txn", 1))) {
72
|| (!strncasecmp (argv[i], "Id",
74
|| (!strncasecmp (argv[i], "Txn",
75
MAX(command_len, 1)))) {
76
ListIterator itr = NULL;
60
80
if(!txn_cond->id_list)
61
81
txn_cond->id_list =
62
82
list_create(slurm_destroy_char);
64
84
if(slurm_addto_char_list(txn_cond->id_list,
67
} else if (!strncasecmp (argv[i], "Accounts", 3)) {
88
/* check to make sure user gave ints here */
89
itr = list_iterator_create(txn_cond->id_list);
90
while ((temp = list_next(itr))) {
91
if (get_uint(temp, &id, "Transaction ID")
94
list_delete_item(itr);
97
list_iterator_destroy(itr);
98
} else if (!strncasecmp (argv[i], "Accounts",
99
MAX(command_len, 3))) {
68
100
if(!txn_cond->acct_list)
69
101
txn_cond->acct_list =
70
102
list_create(slurm_destroy_char);
71
103
if(slurm_addto_char_list(txn_cond->acct_list,
74
} else if (!strncasecmp (argv[i], "Action", 4)) {
106
} else if (!strncasecmp (argv[i], "Action",
107
MAX(command_len, 4))) {
75
108
if(!txn_cond->action_list)
76
109
txn_cond->action_list =
77
110
list_create(slurm_destroy_char);
84
} else if (!strncasecmp (argv[i], "Actors", 4)) {
117
} else if (!strncasecmp (argv[i], "Actors",
118
MAX(command_len, 4))) {
85
119
if(!txn_cond->actor_list)
86
120
txn_cond->actor_list =
87
121
list_create(slurm_destroy_char);
88
122
if(slurm_addto_char_list(txn_cond->actor_list,
91
} else if (!strncasecmp (argv[i], "Clusters", 3)) {
125
} else if (!strncasecmp (argv[i], "Clusters",
126
MAX(command_len, 3))) {
92
127
if(!txn_cond->cluster_list)
93
128
txn_cond->cluster_list =
94
129
list_create(slurm_destroy_char);
95
130
if(slurm_addto_char_list(txn_cond->cluster_list,
98
} else if (!strncasecmp (argv[i], "End", 1)) {
133
} else if (!strncasecmp (argv[i], "End", MAX(command_len, 1))) {
99
134
txn_cond->time_end = parse_time(argv[i]+end, 1);
101
} else if (!strncasecmp (argv[i], "Format", 1)) {
136
} else if (!strncasecmp (argv[i], "Format",
137
MAX(command_len, 1))) {
103
139
slurm_addto_char_list(format_list, argv[i]+end);
104
} else if (!strncasecmp (argv[i], "Start", 1)) {
140
} else if (!strncasecmp (argv[i], "Start",
141
MAX(command_len, 1))) {
105
142
txn_cond->time_start = parse_time(argv[i]+end, 1);
107
} else if (!strncasecmp (argv[i], "User", 1)) {
144
} else if (!strncasecmp (argv[i], "User",
145
MAX(command_len, 1))) {
108
146
if(!txn_cond->user_list)
109
147
txn_cond->user_list =
110
148
list_create(slurm_destroy_char);
171
209
itr = list_iterator_create(format_list);
172
210
while((object = list_next(itr))) {
173
211
char *tmp_char = NULL;
212
int command_len = strlen(object);
174
214
field = xmalloc(sizeof(print_field_t));
175
if(!strncasecmp("Accounts", object, 3)) {
215
if(!strncasecmp("Accounts", object, MAX(command_len, 3))) {
176
216
field->type = PRINT_ACCT;
177
217
field->name = xstrdup("Accounts");
179
219
field->print_routine = print_fields_str;
180
} else if(!strncasecmp("Action", object, 4)) {
220
} else if(!strncasecmp("Action", object, MAX(command_len, 4))) {
181
221
field->type = PRINT_ACTION;
182
222
field->name = xstrdup("Action");
184
224
field->print_routine = print_fields_str;
185
} else if(!strncasecmp("Actor", object, 4)) {
225
} else if(!strncasecmp("Actor", object,
226
MAX(command_len, 4))) {
186
227
field->type = PRINT_ACTOR;
187
228
field->name = xstrdup("Actor");
189
230
field->print_routine = print_fields_str;
190
} else if(!strncasecmp("Clusters", object, 4)) {
231
} else if(!strncasecmp("Clusters", object,
232
MAX(command_len, 4))) {
191
233
field->type = PRINT_CLUSTER;
192
234
field->name = xstrdup("Clusters");
194
236
field->print_routine = print_fields_str;
195
} else if(!strncasecmp("ID", object, 2)) {
237
} else if(!strncasecmp("ID", object, MAX(command_len, 2))) {
196
238
field->type = PRINT_ID;
197
239
field->name = xstrdup("ID");
199
241
field->print_routine = print_fields_uint;
200
} else if(!strncasecmp("Info", object, 2)) {
242
} else if(!strncasecmp("Info", object, MAX(command_len, 2))) {
201
243
field->type = PRINT_INFO;
202
244
field->name = xstrdup("Info");
204
246
field->print_routine = print_fields_str;
205
} else if(!strncasecmp("TimeStamp", object, 1)) {
247
} else if(!strncasecmp("TimeStamp", object,
248
MAX(command_len, 1))) {
206
249
field->type = PRINT_TS;
207
250
field->name = xstrdup("Time");
209
252
field->print_routine = print_fields_date;
210
} else if(!strncasecmp("Users", object, 4)) {
253
} else if(!strncasecmp("Users", object, MAX(command_len, 4))) {
211
254
field->type = PRINT_USER;
212
255
field->name = xstrdup("Users");
214
257
field->print_routine = print_fields_str;
215
} else if(!strncasecmp("Where", object, 1)) {
258
} else if(!strncasecmp("Where", object, MAX(command_len, 1))) {
216
259
field->type = PRINT_WHERE;
217
260
field->name = xstrdup("Where");