51
53
for (i=(*start); i<argc; i++) {
52
54
end = parse_option_end(argv[i]);
53
if (!strncasecmp (argv[i], "Set", 3)) {
56
command_len=strlen(argv[i]);
59
if(argv[i][end] == '=') {
60
option = (int)argv[i][end-1];
65
if (!strncasecmp (argv[i], "Set", MAX(command_len, 3))) {
56
} else if(!end && !strncasecmp(argv[i], "where", 5)) {
68
} else if(!end && !strncasecmp(argv[i], "where",
69
MAX(command_len, 5))) {
58
} else if(!end || !strncasecmp (argv[i], "Names", 1)
59
|| !strncasecmp (argv[i], "Clusters", 1)) {
71
} else if(!end || !strncasecmp (argv[i], "Names",
73
|| !strncasecmp (argv[i], "Clusters",
74
MAX(command_len, 1))) {
61
76
if(slurm_addto_char_list(cluster_list,
65
} else if (!strncasecmp (argv[i], "Format", 1)) {
80
} else if (!strncasecmp (argv[i], "Format",
81
MAX(command_len, 1))) {
67
83
slurm_addto_char_list(format_list, argv[i]+end);
87
103
List qos_list = NULL;
89
107
for (i=(*start); i<argc; i++) {
90
108
end = parse_option_end(argv[i]);
91
if (!strncasecmp (argv[i], "Where", 5)) {
110
command_len=strlen(argv[i]);
113
if(argv[i][end] == '=') {
114
option = (int)argv[i][end-1];
119
if (!strncasecmp (argv[i], "Where", MAX(command_len, 5))) {
94
} else if(!end && !strncasecmp(argv[i], "set", 3)) {
122
} else if(!end && !strncasecmp(argv[i], "set",
123
MAX(command_len, 3))) {
97
|| !strncasecmp (argv[i], "Names", 1)
98
|| !strncasecmp (argv[i], "Clusters", 1)) {
126
|| !strncasecmp (argv[i], "Names",
128
|| !strncasecmp (argv[i], "Clusters",
129
MAX(command_len, 1))) {
100
131
slurm_addto_char_list(name_list, argv[i]+end);
101
} else if (!strncasecmp (argv[i], "FairShare", 1)) {
132
} else if (!strncasecmp (argv[i], "FairShare",
133
MAX(command_len, 1))) {
102
134
if (get_uint(argv[i]+end, &assoc->fairshare,
103
135
"FairShare") == SLURM_SUCCESS)
105
} else if (!strncasecmp (argv[i], "GrpCPUMins", 7)) {
137
} else if (!strncasecmp (argv[i], "GrpCPUMins",
138
MAX(command_len, 7))) {
106
139
if (get_uint64(argv[i]+end,
107
140
&assoc->grp_cpu_mins,
108
141
"GrpCPUMins") == SLURM_SUCCESS)
110
} else if (!strncasecmp (argv[i], "GrpCpus", 7)) {
143
} else if (!strncasecmp (argv[i], "GrpCpus",
144
MAX(command_len, 7))) {
111
145
if (get_uint(argv[i]+end, &assoc->grp_cpus,
112
146
"GrpCpus") == SLURM_SUCCESS)
114
} else if (!strncasecmp (argv[i], "GrpJobs", 4)) {
148
} else if (!strncasecmp (argv[i], "GrpJobs",
149
MAX(command_len, 4))) {
115
150
if (get_uint(argv[i]+end, &assoc->grp_jobs,
116
151
"GrpJobs") == SLURM_SUCCESS)
118
} else if (!strncasecmp (argv[i], "GrpNodes", 4)) {
153
} else if (!strncasecmp (argv[i], "GrpNodes",
154
MAX(command_len, 4))) {
119
155
if (get_uint(argv[i]+end, &assoc->grp_nodes,
120
156
"GrpNodes") == SLURM_SUCCESS)
122
} else if (!strncasecmp (argv[i], "GrpSubmitJobs", 4)) {
158
} else if (!strncasecmp (argv[i], "GrpSubmitJobs",
159
MAX(command_len, 4))) {
123
160
if (get_uint(argv[i]+end, &assoc->grp_submit_jobs,
124
161
"GrpSubmitJobs") == SLURM_SUCCESS)
126
} else if (!strncasecmp (argv[i], "GrpWall", 4)) {
163
} else if (!strncasecmp (argv[i], "GrpWall",
164
MAX(command_len, 4))) {
127
165
mins = time_str2mins(argv[i]+end);
128
166
if (mins != NO_VAL) {
129
167
assoc->grp_wall = (uint32_t) mins;
134
172
" Bad GrpWall time format: %s\n",
137
} else if (!strncasecmp (argv[i], "MaxCPUMins", 7)) {
175
} else if (!strncasecmp (argv[i], "MaxCPUMins",
176
MAX(command_len, 7))) {
138
177
if (get_uint64(argv[i]+end,
139
178
&assoc->max_cpu_mins_pj,
140
179
"MaxCPUMins") == SLURM_SUCCESS)
142
} else if (!strncasecmp (argv[i], "MaxCpus", 7)) {
181
} else if (!strncasecmp (argv[i], "MaxCpus",
182
MAX(command_len, 7))) {
143
183
if (get_uint(argv[i]+end, &assoc->max_cpus_pj,
144
184
"MaxCpus") == SLURM_SUCCESS)
146
} else if (!strncasecmp (argv[i], "MaxJobs", 4)) {
186
} else if (!strncasecmp (argv[i], "MaxJobs",
187
MAX(command_len, 4))) {
147
188
if (get_uint(argv[i]+end, &assoc->max_jobs,
148
189
"MaxJobs") == SLURM_SUCCESS)
150
} else if (!strncasecmp (argv[i], "MaxNodes", 4)) {
191
} else if (!strncasecmp (argv[i], "MaxNodes",
192
MAX(command_len, 4))) {
151
193
if (get_uint(argv[i]+end,
152
194
&assoc->max_nodes_pj,
153
195
"MaxNodes") == SLURM_SUCCESS)
155
} else if (!strncasecmp (argv[i], "MaxSubmitJobs", 4)) {
197
} else if (!strncasecmp (argv[i], "MaxSubmitJobs",
198
MAX(command_len, 4))) {
156
199
if (get_uint(argv[i]+end, &assoc->max_submit_jobs,
157
200
"MaxSubmitJobs") == SLURM_SUCCESS)
159
} else if (!strncasecmp (argv[i], "MaxWall", 4)) {
202
} else if (!strncasecmp (argv[i], "MaxWall",
203
MAX(command_len, 4))) {
160
204
mins = time_str2mins(argv[i]+end);
161
205
if (mins != NO_VAL) {
162
206
assoc->max_wall_pj = (uint32_t) mins;
404
443
itr = list_iterator_create(format_list);
405
444
while((object = list_next(itr))) {
406
445
char *tmp_char = NULL;
446
int command_len = strlen(object);
407
448
field = xmalloc(sizeof(print_field_t));
408
if(!strncasecmp("Cluster", object, 2)
409
|| !strncasecmp("Name", object, 2)) {
449
if(!strncasecmp("Cluster", object, MAX(command_len, 2))
450
|| !strncasecmp("Name", object, MAX(command_len, 2))) {
410
451
field->type = PRINT_CLUSTER;
411
452
field->name = xstrdup("Cluster");
413
454
field->print_routine = print_fields_str;
414
} else if(!strncasecmp("ControlHost", object, 8)) {
455
} else if(!strncasecmp("ControlHost", object,
456
MAX(command_len, 8))) {
415
457
field->type = PRINT_CHOST;
416
458
field->name = xstrdup("Control Host");
418
460
field->print_routine = print_fields_str;
419
} else if(!strncasecmp("ControlPort", object, 8)) {
461
} else if(!strncasecmp("ControlPort", object,
462
MAX(command_len, 8))) {
420
463
field->type = PRINT_CPORT;
421
464
field->name = xstrdup("Control Port");
423
466
field->print_routine = print_fields_uint;
424
} else if(!strncasecmp("FairShare", object, 1)) {
467
} else if(!strncasecmp("FairShare", object,
468
MAX(command_len, 1))) {
425
469
field->type = PRINT_FAIRSHARE;
426
470
field->name = xstrdup("FairShare");
428
472
field->print_routine = print_fields_uint;
429
} else if(!strncasecmp("GrpCPUMins", object, 8)) {
473
} else if(!strncasecmp("GrpCPUMins", object,
474
MAX(command_len, 8))) {
430
475
field->type = PRINT_GRPCM;
431
476
field->name = xstrdup("GrpCPUMins");
433
478
field->print_routine = print_fields_uint64;
434
} else if(!strncasecmp("GrpCPUs", object, 8)) {
479
} else if(!strncasecmp("GrpCPUs", object,
480
MAX(command_len, 8))) {
435
481
field->type = PRINT_GRPC;
436
482
field->name = xstrdup("GrpCPUs");
438
484
field->print_routine = print_fields_uint;
439
} else if(!strncasecmp("GrpJobs", object, 4)) {
485
} else if(!strncasecmp("GrpJobs", object,
486
MAX(command_len, 4))) {
440
487
field->type = PRINT_GRPJ;
441
488
field->name = xstrdup("GrpJobs");
443
490
field->print_routine = print_fields_uint;
444
} else if(!strncasecmp("GrpNodes", object, 4)) {
491
} else if(!strncasecmp("GrpNodes", object,
492
MAX(command_len, 4))) {
445
493
field->type = PRINT_GRPN;
446
494
field->name = xstrdup("GrpNodes");
448
496
field->print_routine = print_fields_uint;
449
} else if(!strncasecmp("GrpSubmitJobs", object, 4)) {
497
} else if(!strncasecmp("GrpSubmitJobs", object,
498
MAX(command_len, 4))) {
450
499
field->type = PRINT_GRPS;
451
500
field->name = xstrdup("GrpSubmit");
453
502
field->print_routine = print_fields_uint;
454
} else if(!strncasecmp("GrpWall", object, 4)) {
503
} else if(!strncasecmp("GrpWall", object,
504
MAX(command_len, 4))) {
455
505
field->type = PRINT_GRPW;
456
506
field->name = xstrdup("GrpWall");
458
508
field->print_routine = print_fields_time;
459
} else if(!strncasecmp("MaxCPUMins", object, 7)) {
509
} else if(!strncasecmp("MaxCPUMins", object,
510
MAX(command_len, 7))) {
460
511
field->type = PRINT_MAXCM;
461
512
field->name = xstrdup("MaxCPUMins");
463
514
field->print_routine = print_fields_uint64;
464
} else if(!strncasecmp("MaxCPUs", object, 7)) {
515
} else if(!strncasecmp("MaxCPUs", object,
516
MAX(command_len, 7))) {
465
517
field->type = PRINT_MAXC;
466
518
field->name = xstrdup("MaxCPUs");
468
520
field->print_routine = print_fields_uint;
469
} else if(!strncasecmp("MaxJobs", object, 4)) {
521
} else if(!strncasecmp("MaxJobs", object,
522
MAX(command_len, 4))) {
470
523
field->type = PRINT_MAXJ;
471
524
field->name = xstrdup("MaxJobs");
473
526
field->print_routine = print_fields_uint;
474
} else if(!strncasecmp("MaxNodes", object, 4)) {
527
} else if(!strncasecmp("MaxNodes", object,
528
MAX(command_len, 4))) {
475
529
field->type = PRINT_MAXN;
476
530
field->name = xstrdup("MaxNodes");
478
532
field->print_routine = print_fields_uint;
479
} else if(!strncasecmp("MaxSubmitJobs", object, 4)) {
533
} else if(!strncasecmp("MaxSubmitJobs", object,
534
MAX(command_len, 4))) {
480
535
field->type = PRINT_MAXS;
481
536
field->name = xstrdup("MaxSubmit");
483
538
field->print_routine = print_fields_uint;
484
} else if(!strncasecmp("MaxWall", object, 4)) {
539
} else if(!strncasecmp("MaxWall", object,
540
MAX(command_len, 4))) {
485
541
field->type = PRINT_MAXW;
486
542
field->name = xstrdup("MaxWall");
488
544
field->print_routine = print_fields_time;
489
} else if(!strncasecmp("QOSRAW", object, 4)) {
545
} else if(!strncasecmp("QOSRAWLevel", object,
546
MAX(command_len, 4))) {
490
547
field->type = PRINT_QOS_RAW;
491
548
field->name = xstrdup("QOS_RAW");
493
550
field->print_routine = print_fields_char_list;
494
} else if(!strncasecmp("QOS", object, 1)) {
551
} else if(!strncasecmp("QOSLevel", object,
552
MAX(command_len, 1))) {
495
553
field->type = PRINT_QOS;
496
554
field->name = xstrdup("QOS");
498
556
field->print_routine = sacctmgr_print_qos_list;
499
} else if(!strncasecmp("RPC", object, 1)) {
557
} else if(!strncasecmp("RPC", object, MAX(command_len, 1))) {
500
558
field->type = PRINT_RPC_VERSION;
501
559
field->name = xstrdup("RPC");