diff --git a/src/common/print_fields.c b/src/common/print_fields.c index 36cf885daef7e19146b8fa47ee600ff0a16f9db9..f5971f3a529a43b0d5f8cc11b621df0bff6d67f4 100644 --- a/src/common/print_fields.c +++ b/src/common/print_fields.c @@ -54,245 +54,150 @@ extern void destroy_print_field(void *object) extern void print_fields_header(List print_fields_list) { ListIterator itr = NULL; - print_field_t *object = NULL; + print_field_t *field = NULL; if(!print_fields_list || !print_fields_have_header) return; itr = list_iterator_create(print_fields_list); - while((object = list_next(itr))) { - (object->print_routine)(SLURM_PRINT_HEADLINE, object, 0); + while((field = list_next(itr))) { + if(print_fields_parsable_print) + printf("%s|", field->name); + else + printf("%-*.*s ", field->len, field->len, field->name); } list_iterator_reset(itr); printf("\n"); if(print_fields_parsable_print) return; - while((object = list_next(itr))) { - (object->print_routine)(SLURM_PRINT_UNDERSCORE, object, 0); + while((field = list_next(itr))) { + printf("%-*.*s ", field->len, field->len, + "-----------------------------------------------------"); } list_iterator_destroy(itr); printf("\n"); } -extern void print_fields_date(void) +extern void print_fields_date(print_field_t *field, time_t value) { - time_t now; - - now = time(NULL); - printf("%s", ctime(&now)); + char temp_char[field->len]; + time_t now = value; + if(!now) + now = time(NULL); + slurm_make_time_str(&value, (char *)temp_char, field->len); + if(print_fields_parsable_print) + printf("%s|", temp_char); + else + printf("%-*.*s ", field->len, field->len, temp_char); } -extern void print_fields_str(type_t type, print_field_t *field, char *value) +extern void print_fields_str(print_field_t *field, char *value) { char temp_char[field->len]; char *print_this = NULL; - switch(type) { - case SLURM_PRINT_HEADLINE: + if(!value) { if(print_fields_parsable_print) - printf("%s|", field->name); + print_this = ""; else - printf("%-*.*s ", field->len, field->len, field->name); - break; - case SLURM_PRINT_UNDERSCORE: - if(!print_fields_parsable_print) - printf("%-*.*s ", field->len, field->len, - "---------------------------------------"); - break; - case SLURM_PRINT_VALUE: - if(!value) { - if(print_fields_parsable_print) - print_this = ""; - else - print_this = " "; - } - - if(print_fields_parsable_print) - printf("%s|", value); - else { - memcpy(temp_char, value, field->len); - + print_this = " "; + } + + if(print_fields_parsable_print) + printf("%s|", value); + else { + if(!print_this) { + memcpy(&temp_char, value, field->len); + if(strlen(value) > field->len) temp_char[field->len-1] = '+'; print_this = temp_char; - printf("%-*.*s ", field->len, field->len, print_this); } - break; - default: - if(print_fields_parsable_print) - printf("%s|", "n/a"); - else - printf("%-*s ", field->len, "n/a"); - break; + printf("%-*.*s ", field->len, field->len, print_this); } } -extern void print_fields_uint32(type_t type, print_field_t *field, - uint32_t value) +extern void print_fields_uint32(print_field_t *field, uint32_t value) { - switch(type) { - case SLURM_PRINT_HEADLINE: + /* (value == unset) || (value == cleared) */ + if((value == NO_VAL) || (value == INFINITE)) { if(print_fields_parsable_print) - printf("%s|", field->name); - else - printf("%*.*s ", field->len, field->len, field->name); - break; - case SLURM_PRINT_UNDERSCORE: - if(!print_fields_parsable_print) - printf("%*.*s ", field->len, field->len, - "---------------------------------------"); - break; - case SLURM_PRINT_VALUE: - /* (value == unset) || (value == cleared) */ - if((value == NO_VAL) || (value == INFINITE)) { - if(print_fields_parsable_print) - printf("|"); - else - printf("%*s ", field->len, " "); - } else { - if(print_fields_parsable_print) - printf("%u|", value); - else - printf("%*u ", field->len, value); - } - break; - default: + printf("|"); + else + printf("%*s ", field->len, " "); + } else { if(print_fields_parsable_print) - printf("%s|", "n/a"); + printf("%u|", value); else - printf("%*.*s ", field->len, field->len, "n/a"); - break; + printf("%*u ", field->len, value); } } -extern void print_fields_uint64(type_t type, print_field_t *field, - uint64_t value) +extern void print_fields_uint64(print_field_t *field, uint64_t value) { - switch(type) { - case SLURM_PRINT_HEADLINE: + /* (value == unset) || (value == cleared) */ + if((value == NO_VAL) || (value == INFINITE)) { if(print_fields_parsable_print) - printf("%s|", field->name); - else - printf("%*.*s ", field->len, field->len, field->name); - break; - case SLURM_PRINT_UNDERSCORE: - if(!print_fields_parsable_print) - printf("%*.*s ", field->len, field->len, - "---------------------------------------"); - break; - case SLURM_PRINT_VALUE: - /* (value == unset) || (value == cleared) */ - if((value == NO_VAL) || (value == INFINITE)) { - if(print_fields_parsable_print) - printf("|"); - else - printf("%*s ", field->len, " "); - } else { - if(print_fields_parsable_print) - printf("%llu|", (long long unsigned) value); - else - printf("%*llu ", field->len, - (long long unsigned) value); - } - break; - default: + printf("|"); + else + printf("%*s ", field->len, " "); + } else { if(print_fields_parsable_print) - printf("%s|", "n/a"); + printf("%llu|", (long long unsigned) value); else - printf("%*.*s ", field->len, field->len, "n/a"); - break; + printf("%*llu ", field->len, + (long long unsigned) value); } } -extern void print_fields_time(type_t type, print_field_t *field, uint32_t value) +extern void print_fields_time(print_field_t *field, uint32_t value) { - switch(type) { - case SLURM_PRINT_HEADLINE: + /* (value == unset) || (value == cleared) */ + if((value == NO_VAL) || (value == INFINITE)) { if(print_fields_parsable_print) - printf("%s|", field->name); + printf("|"); else - printf("%*.*s ", field->len, field->len, field->name); - break; - case SLURM_PRINT_UNDERSCORE: - if(!print_fields_parsable_print) - printf("%*.*s ", field->len, field->len, - "---------------------------------------"); - break; - case SLURM_PRINT_VALUE: - /* (value == unset) || (value == cleared) */ - if((value == NO_VAL) || (value == INFINITE)) { - if(print_fields_parsable_print) - printf("|"); - else - printf("%*s ", field->len, " "); - } else { - char time_buf[32]; - mins2time_str((time_t) value, - time_buf, sizeof(time_buf)); - if(print_fields_parsable_print) - printf("%s|", time_buf); - else - printf("%*s ", field->len, time_buf); - } - break; - default: - printf("%*.*s ", field->len, field->len, "n/a"); - break; + printf("%*s ", field->len, " "); + } else { + char time_buf[32]; + mins2time_str((time_t) value, time_buf, sizeof(time_buf)); + if(print_fields_parsable_print) + printf("%s|", time_buf); + else + printf("%*s ", field->len, time_buf); } } -extern void print_fields_char_list(type_t type, print_field_t *field, - List value) +extern void print_fields_char_list(print_field_t *field, List value) { ListIterator itr = NULL; char *print_this = NULL; char *object = NULL; - switch(type) { - case SLURM_PRINT_HEADLINE: + if(!value || !list_count(value)) { if(print_fields_parsable_print) - printf("%s|", field->name); + print_this = xstrdup(""); else - printf("%-*.*s ", field->len, field->len, field->name); - break; - case SLURM_PRINT_UNDERSCORE: - if(!print_fields_parsable_print) - printf("%-*.*s ", field->len, field->len, - "---------------------------------------"); - break; - case SLURM_PRINT_VALUE: - if(!value || !list_count(value)) { - if(print_fields_parsable_print) - print_this = xstrdup(""); - else - print_this = xstrdup(" "); - } else { - itr = list_iterator_create(value); - while((object = list_next(itr))) { - if(print_this) - xstrfmtcat(print_this, ",%s", object); - else - print_this = xstrdup(object); - } - list_iterator_destroy(itr); - } - - if(print_fields_parsable_print) - printf("%s|", print_this); - else { - if(strlen(print_this) > field->len) - print_this[field->len-1] = '+'; - - printf("%-*.*s ", field->len, field->len, print_this); + print_this = xstrdup(" "); + } else { + itr = list_iterator_create(value); + while((object = list_next(itr))) { + if(print_this) + xstrfmtcat(print_this, ",%s", object); + else + print_this = xstrdup(object); } - xfree(print_this); - break; - default: - if(print_fields_parsable_print) - printf("%s|", "n/a"); - else - printf("%-*s ", field->len, "n/a"); - break; + list_iterator_destroy(itr); + } + + if(print_fields_parsable_print) + printf("%s|", print_this); + else { + if(strlen(print_this) > field->len) + print_this[field->len-1] = '+'; + + printf("%-*.*s ", field->len, field->len, print_this); } + xfree(print_this); } diff --git a/src/common/print_fields.h b/src/common/print_fields.h index 9264970a6de7e45e94694af725607d669d0f0a82..37ade380f5e27b6327168cacc60d5ef60ec30bc3 100644 --- a/src/common/print_fields.h +++ b/src/common/print_fields.h @@ -67,12 +67,6 @@ #include "src/common/xstring.h" #include "src/common/list.h" -typedef enum { - SLURM_PRINT_HEADLINE, - SLURM_PRINT_UNDERSCORE, - SLURM_PRINT_VALUE -} type_t; - typedef struct { uint16_t len; /* what is the width of the print */ char *name; /* name to be printed in header */ @@ -85,16 +79,12 @@ extern int print_fields_have_header; extern void destroy_print_field(void *object); extern void print_fields_header(List print_fields_list); -extern void print_fields_date(void); -extern void print_fields_str(type_t type, print_field_t *field, char *value); -extern void print_fields_uint32(type_t type, print_field_t *field, - uint32_t value); -extern void print_fields_uint64(type_t type, print_field_t *field, - uint64_t value); -extern void print_fields_time(type_t type, print_field_t *field, - uint32_t value); -extern void print_fields_char_list(type_t type, print_field_t *field, - List value); +extern void print_fields_date(print_field_t *field, time_t value); +extern void print_fields_str(print_field_t *field, char *value); +extern void print_fields_uint32(print_field_t *field, uint32_t value); +extern void print_fields_uint64(print_field_t *field, uint64_t value); +extern void print_fields_time(print_field_t *field, uint32_t value); +extern void print_fields_char_list(print_field_t *field, List value); #define print_fields_uint print_fields_uint32 #endif diff --git a/src/sacct/Makefile.am b/src/sacct/Makefile.am index 4b25bcca7f72021aded7dfbdacc15504a90165a1..5ee84316f911f91470a547932c392cbb89451c2e 100644 --- a/src/sacct/Makefile.am +++ b/src/sacct/Makefile.am @@ -1,6 +1,7 @@ # Makefile for sacct AUTOMAKE_OPTIONS = foreign +CLEANFILES = core.* INCLUDES = -I$(top_srcdir) diff --git a/src/sacct/Makefile.in b/src/sacct/Makefile.in index c3a7b5a9bf0ee3e8cbd978b3cfad78e880a935f5..38bf96eef01d45263919ea6f578e9112bc54999a 100644 --- a/src/sacct/Makefile.in +++ b/src/sacct/Makefile.in @@ -266,6 +266,7 @@ target_vendor = @target_vendor@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = foreign +CLEANFILES = core.* INCLUDES = -I$(top_srcdir) sacct_LDADD = $(top_builddir)/src/common/libcommon.o -ldl \ $(top_builddir)/src/api/libslurmhelper.la @@ -474,6 +475,7 @@ install-strip: mostlyclean-generic: clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) diff --git a/src/sacctmgr/Makefile.am b/src/sacctmgr/Makefile.am index 0ead4174e0c4855b1a2b93f47535d41e1a869279..d39d0bbb1ef2739dc425bd6c7c8f3ae58e471b67 100644 --- a/src/sacctmgr/Makefile.am +++ b/src/sacctmgr/Makefile.am @@ -1,6 +1,7 @@ # Makefile for sacctmgr AUTOMAKE_OPTIONS = foreign +CLEANFILES = core.* INCLUDES = -I$(top_srcdir) @@ -17,8 +18,8 @@ sacctmgr_SOURCES = \ user_functions.c sacctmgr_LDADD = \ - $(top_builddir)/src/common/libcommon.o -ldl \ $(top_builddir)/src/api/libslurmhelper.la \ + $(top_builddir)/src/common/libcommon.o -ldl \ $(READLINE_LIBS) sacctmgr_LDFLAGS = -export-dynamic $(CMD_LDFLAGS) diff --git a/src/sacctmgr/Makefile.in b/src/sacctmgr/Makefile.in index dbe27f63728c1db9d857fcdbefbb530d1897125f..3959fd99387f28b73d7574ccfc4c6a1def1ad72d 100644 --- a/src/sacctmgr/Makefile.in +++ b/src/sacctmgr/Makefile.in @@ -76,9 +76,8 @@ am_sacctmgr_OBJECTS = account_functions.$(OBJEXT) \ txn_functions.$(OBJEXT) user_functions.$(OBJEXT) sacctmgr_OBJECTS = $(am_sacctmgr_OBJECTS) am__DEPENDENCIES_1 = -sacctmgr_DEPENDENCIES = $(top_builddir)/src/common/libcommon.o \ - $(top_builddir)/src/api/libslurmhelper.la \ - $(am__DEPENDENCIES_1) +sacctmgr_DEPENDENCIES = $(top_builddir)/src/api/libslurmhelper.la \ + $(top_builddir)/src/common/libcommon.o $(am__DEPENDENCIES_1) sacctmgr_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(sacctmgr_LDFLAGS) \ $(LDFLAGS) -o $@ @@ -267,6 +266,7 @@ target_vendor = @target_vendor@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = foreign +CLEANFILES = core.* INCLUDES = -I$(top_srcdir) sacctmgr_SOURCES = \ account_functions.c \ @@ -279,8 +279,8 @@ sacctmgr_SOURCES = \ user_functions.c sacctmgr_LDADD = \ - $(top_builddir)/src/common/libcommon.o -ldl \ $(top_builddir)/src/api/libslurmhelper.la \ + $(top_builddir)/src/common/libcommon.o -ldl \ $(READLINE_LIBS) sacctmgr_LDFLAGS = -export-dynamic $(CMD_LDFLAGS) @@ -488,6 +488,7 @@ install-strip: mostlyclean-generic: clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) diff --git a/src/sacctmgr/account_functions.c b/src/sacctmgr/account_functions.c index 43df7c633d120743e6488820b7f726e3a047d2ea..723582e3de331bba44f6ee0c0e5177289145de74 100644 --- a/src/sacctmgr/account_functions.c +++ b/src/sacctmgr/account_functions.c @@ -49,12 +49,12 @@ static int _set_cond(int *start, int argc, char *argv[], for (i=(*start); i<argc; i++) { end = parse_option_end(argv[i]); - if (strncasecmp (argv[i], "Set", 3) == 0) { + if (!strncasecmp (argv[i], "Set", 3)) { i--; break; - } else if (strncasecmp (argv[i], "WithAssoc", 5) == 0) { + } else if (!strncasecmp (argv[i], "WithAssoc", 5)) { acct_cond->with_assocs = 1; - } else if (strncasecmp (argv[i], "WithCoordinators", 5) == 0) { + } else if (!strncasecmp (argv[i], "WithCoordinators", 5)) { acct_cond->with_coords = 1; } else if(!end && !strncasecmp(argv[i], "where", 5)) { continue; @@ -63,32 +63,32 @@ static int _set_cond(int *start, int argc, char *argv[], addto_char_list(acct_cond->assoc_cond->acct_list, argv[i]); u_set = 1; - } else if (strncasecmp (argv[i], "Clusters", 1) == 0) { + } else if (!strncasecmp (argv[i], "Clusters", 1)) { addto_char_list(acct_cond->assoc_cond->cluster_list, argv[i]+end); a_set = 1; - } else if (strncasecmp (argv[i], "Descriptions", 1) == 0) { + } else if (!strncasecmp (argv[i], "Descriptions", 1)) { addto_char_list(acct_cond->description_list, argv[i]+end); u_set = 1; - } else if (strncasecmp (argv[i], "Format", 1) == 0) { + } else if (!strncasecmp (argv[i], "Format", 1)) { if(format_list) addto_char_list(format_list, argv[i]+end); - } else if (strncasecmp (argv[i], "Names", 1) == 0 - || strncasecmp (argv[i], "Accouts", 1) == 0) { + } else if (!strncasecmp (argv[i], "Names", 1) + || !strncasecmp (argv[i], "Accouts", 1)) { addto_char_list(acct_cond->acct_list, argv[i]+end); addto_char_list(acct_cond->assoc_cond->acct_list, argv[i]); u_set = 1; - } else if (strncasecmp (argv[i], "Organizations", 1) == 0) { + } else if (!strncasecmp (argv[i], "Organizations", 1)) { addto_char_list(acct_cond->organization_list, argv[i]+end); u_set = 1; - } else if (strncasecmp (argv[i], "Parent", 1) == 0) { + } else if (!strncasecmp (argv[i], "Parent", 1)) { acct_cond->assoc_cond->parent_acct = strip_quotes(argv[i]+end, NULL); a_set = 1; - } else if (strncasecmp (argv[i], "QosLevel", 1) == 0) { + } else if (!strncasecmp (argv[i], "QosLevel", 1)) { acct_cond->qos = str_2_acct_qos(argv[i]+end); u_set = 1; } else { @@ -118,7 +118,7 @@ static int _set_rec(int *start, int argc, char *argv[], for (i=(*start); i<argc; i++) { end = parse_option_end(argv[i]); - if (strncasecmp (argv[i], "Where", 5) == 0) { + if (!strncasecmp (argv[i], "Where", 5)) { i--; break; } else if(!end && !strncasecmp(argv[i], "set", 3)) { @@ -126,26 +126,26 @@ static int _set_rec(int *start, int argc, char *argv[], } else if(!end) { printf(" Bad format on %s: End your option with " "an '=' sign\n", argv[i]); - } else if (strncasecmp (argv[i], "Description", 1) == 0) { + } else if (!strncasecmp (argv[i], "Description", 1)) { acct->description = strip_quotes(argv[i]+end, NULL); u_set = 1; - } else if (strncasecmp (argv[i], "FairShare", 1) == 0) { + } else if (!strncasecmp (argv[i], "FairShare", 1)) { if (get_uint(argv[i]+end, &assoc->fairshare, "FairShare") == SLURM_SUCCESS) a_set = 1; - } else if (strncasecmp (argv[i], "MaxCPUSec", 4) == 0) { + } else if (!strncasecmp (argv[i], "MaxCPUSec", 4)) { if (get_uint(argv[i]+end, &assoc->max_cpu_secs_per_job, "MaxCPUSec") == SLURM_SUCCESS) a_set = 1; - } else if (strncasecmp (argv[i], "MaxJobs", 4) == 0) { + } else if (!strncasecmp (argv[i], "MaxJobs", 4)) { if (get_uint(argv[i]+end, &assoc->max_jobs, "MaxJobs") == SLURM_SUCCESS) a_set = 1; - } else if (strncasecmp (argv[i], "MaxNodes", 4) == 0) { + } else if (!strncasecmp (argv[i], "MaxNodes", 4)) { if (get_uint(argv[i]+end, &assoc->max_nodes_per_job, "MaxNodes") == SLURM_SUCCESS) a_set = 1; - } else if (strncasecmp (argv[i], "MaxWall", 4) == 0) { + } else if (!strncasecmp (argv[i], "MaxWall", 4)) { mins = time_str2mins(argv[i]+end); if (mins != NO_VAL) { assoc->max_wall_duration_per_job @@ -155,13 +155,13 @@ static int _set_rec(int *start, int argc, char *argv[], printf(" Bad MaxWall time format: %s\n", argv[i]); } - } else if (strncasecmp (argv[i], "Organization", 1) == 0) { + } else if (!strncasecmp (argv[i], "Organization", 1)) { acct->organization = strip_quotes(argv[i]+end, NULL); u_set = 1; - } else if (strncasecmp (argv[i], "Parent", 1) == 0) { + } else if (!strncasecmp (argv[i], "Parent", 1)) { assoc->parent_acct = strip_quotes(argv[i]+end, NULL); a_set = 1; - } else if (strncasecmp (argv[i], "QosLevel=", 1) == 0) { + } else if (!strncasecmp (argv[i], "QosLevel=", 1)) { acct->qos = str_2_acct_qos(argv[i]+end); u_set = 1; } else { @@ -214,27 +214,27 @@ extern int sacctmgr_add_account(int argc, char *argv[]) int end = parse_option_end(argv[i]); if(!end) { addto_char_list(name_list, argv[i]+end); - } else if (strncasecmp (argv[i], "Cluster", 1) == 0) { + } else if (!strncasecmp (argv[i], "Cluster", 1)) { addto_char_list(cluster_list, argv[i]+end); - } else if (strncasecmp (argv[i], "Description", 1) == 0) { + } else if (!strncasecmp (argv[i], "Description", 1)) { description = strip_quotes(argv[i]+end, NULL); - } else if (strncasecmp (argv[i], "FairShare", 1) == 0) { + } else if (!strncasecmp (argv[i], "FairShare", 1)) { if (get_uint(argv[i]+end, &fairshare, "FairShare") == SLURM_SUCCESS) limit_set = 1; - } else if (strncasecmp (argv[i], "MaxCPUSecs", 4) == 0) { + } else if (!strncasecmp (argv[i], "MaxCPUSecs", 4)) { if (get_uint(argv[i]+end, &max_cpu_secs_per_job, "MaxCPUSecs") == SLURM_SUCCESS) limit_set = 1; - } else if (strncasecmp (argv[i], "MaxJobs", 4) == 0) { + } else if (!strncasecmp (argv[i], "MaxJobs", 4)) { if (get_uint(argv[i]+end, &max_jobs, "MaxJobs") == SLURM_SUCCESS) limit_set = 1; - } else if (strncasecmp (argv[i], "MaxNodes", 4) == 0) { + } else if (!strncasecmp (argv[i], "MaxNodes", 4)) { if (get_uint(argv[i]+end, &max_nodes_per_job, "MaxNodes") == SLURM_SUCCESS) limit_set = 1; - } else if (strncasecmp (argv[i], "MaxWall", 4) == 0) { + } else if (!strncasecmp (argv[i], "MaxWall", 4)) { mins = time_str2mins(argv[i]+end); if (mins != NO_VAL) { max_wall_duration_per_job = (uint32_t) mins; @@ -243,13 +243,13 @@ extern int sacctmgr_add_account(int argc, char *argv[]) printf(" Bad MaxWall time format: %s\n", argv[i]); } - } else if (strncasecmp (argv[i], "Names", 1) == 0) { + } else if (!strncasecmp (argv[i], "Names", 1)) { addto_char_list(name_list, argv[i]+end); - } else if (strncasecmp (argv[i], "Organization", 1) == 0) { + } else if (!strncasecmp (argv[i], "Organization", 1)) { organization = strip_quotes(argv[i]+end, NULL); - } else if (strncasecmp (argv[i], "Parent", 1) == 0) { + } else if (!strncasecmp (argv[i], "Parent", 1)) { parent = strip_quotes(argv[i]+end, NULL); - } else if (strncasecmp (argv[i], "QosLevel", 1) == 0) { + } else if (!strncasecmp (argv[i], "QosLevel", 1)) { qos = str_2_acct_qos(argv[i]+end); } else { printf(" Unknown option: %s\n", argv[i]); @@ -752,107 +752,89 @@ extern int sacctmgr_list_account(int argc, char *argv[]) switch(field->type) { case PRINT_ACCOUNT: field->print_routine( - SLURM_PRINT_VALUE, field, acct->name); break; case PRINT_CLUSTER: field->print_routine( - SLURM_PRINT_VALUE, field, assoc->cluster); break; case PRINT_COORDS: field->print_routine( - SLURM_PRINT_VALUE, field, acct->coordinators); break; case PRINT_DESC: field->print_routine( - SLURM_PRINT_VALUE, field, acct->description); break; case PRINT_FAIRSHARE: field->print_routine( - SLURM_PRINT_VALUE, field, assoc->fairshare); break; case PRINT_ID: field->print_routine( - SLURM_PRINT_VALUE, field, assoc->id); break; case PRINT_MAXC: field->print_routine( - SLURM_PRINT_VALUE, field, assoc-> max_cpu_secs_per_job); break; case PRINT_MAXJ: field->print_routine( - SLURM_PRINT_VALUE, field, assoc->max_jobs); break; case PRINT_MAXN: field->print_routine( - SLURM_PRINT_VALUE, field, assoc-> max_nodes_per_job); break; case PRINT_MAXW: field->print_routine( - SLURM_PRINT_VALUE, field, assoc-> max_wall_duration_per_job); break; case PRINT_ORG: field->print_routine( - SLURM_PRINT_VALUE, field, acct->organization); break; case PRINT_QOS: field->print_routine( - SLURM_PRINT_VALUE, field, acct_qos_str( acct->qos)); break; case PRINT_QOS_GOLD: field->print_routine( - SLURM_PRINT_VALUE, field, acct->qos-1); break; case PRINT_QOS_RAW: field->print_routine( - SLURM_PRINT_VALUE, field, acct->qos); break; case PRINT_PID: field->print_routine( - SLURM_PRINT_VALUE, field, assoc->parent_id); break; case PRINT_PNAME: field->print_routine( - SLURM_PRINT_VALUE, field, assoc->parent_acct); break; case PRINT_PART: field->print_routine( - SLURM_PRINT_VALUE, field, assoc->partition); break; case PRINT_USER: field->print_routine( - SLURM_PRINT_VALUE, field, assoc->user); break; default: @@ -868,93 +850,77 @@ extern int sacctmgr_list_account(int argc, char *argv[]) switch(field->type) { case PRINT_ACCOUNT: field->print_routine( - SLURM_PRINT_VALUE, field, acct->name); break; case PRINT_CLUSTER: field->print_routine( - SLURM_PRINT_VALUE, field, NULL); break; case PRINT_COORDS: field->print_routine( - SLURM_PRINT_VALUE, field, acct->coordinators); break; case PRINT_DESC: field->print_routine( - SLURM_PRINT_VALUE, field, acct->description); break; case PRINT_FAIRSHARE: field->print_routine( - SLURM_PRINT_VALUE, field, NULL); break; case PRINT_ID: field->print_routine( - SLURM_PRINT_VALUE, field, NULL); break; case PRINT_MAXC: field->print_routine( - SLURM_PRINT_VALUE, field, NULL); break; case PRINT_MAXJ: field->print_routine( - SLURM_PRINT_VALUE, field, NULL); break; case PRINT_MAXN: field->print_routine( - SLURM_PRINT_VALUE, field, NULL); break; case PRINT_MAXW: field->print_routine( - SLURM_PRINT_VALUE, field, NULL); break; case PRINT_ORG: field->print_routine( - SLURM_PRINT_VALUE, field, acct->organization); break; case PRINT_QOS: field->print_routine( - SLURM_PRINT_VALUE, field, acct_qos_str(acct->qos)); break; case PRINT_QOS_GOLD: field->print_routine( - SLURM_PRINT_VALUE, field, + field, acct->qos-1); break; case PRINT_QOS_RAW: field->print_routine( - SLURM_PRINT_VALUE, field, + field, acct->qos); break; case PRINT_PID: field->print_routine( - SLURM_PRINT_VALUE, field, NULL); break; case PRINT_PNAME: field->print_routine( - SLURM_PRINT_VALUE, field, NULL); break; case PRINT_PART: field->print_routine( - SLURM_PRINT_VALUE, field, NULL); break; case PRINT_USER: field->print_routine( - SLURM_PRINT_VALUE, field, NULL); break; default: @@ -1006,10 +972,10 @@ extern int sacctmgr_modify_account(int argc, char *argv[]) assoc->max_wall_duration_per_job = NO_VAL; for (i=0; i<argc; i++) { - if (strncasecmp (argv[i], "Where", 5) == 0) { + if (!strncasecmp (argv[i], "Where", 5)) { i++; cond_set = _set_cond(&i, argc, argv, acct_cond, NULL); - } else if (strncasecmp (argv[i], "Set", 3) == 0) { + } else if (!strncasecmp (argv[i], "Set", 3)) { i++; rec_set = _set_rec(&i, argc, argv, acct, assoc); } else { diff --git a/src/sacctmgr/association_functions.c b/src/sacctmgr/association_functions.c index 9a754fdefdff2d679e196ec4b4abf0899b64b6b7..5b1b4431eb9b3e2168b839357f185646b1e78d23 100644 --- a/src/sacctmgr/association_functions.c +++ b/src/sacctmgr/association_functions.c @@ -123,39 +123,39 @@ static int _set_cond(int *start, int argc, char *argv[], for (i=(*start); i<argc; i++) { end = parse_option_end(argv[i]); - if (!end && strncasecmp (argv[i], "Tree", 4) == 0) { + if (!end && !strncasecmp (argv[i], "Tree", 4)) { tree_display = 1; } else if(!end && !strncasecmp(argv[i], "where", 5)) { continue; } else if(!end) { addto_char_list(association_cond->id_list, argv[i]); set = 1; - } else if (strncasecmp (argv[i], "Id", 1) == 0) { + } else if (!strncasecmp (argv[i], "Id", 1)) { addto_char_list(association_cond->id_list, argv[i]+end); set = 1; - } else if (strncasecmp (argv[i], "Associations", 2) == 0) { + } else if (!strncasecmp (argv[i], "Associations", 2)) { addto_char_list(association_cond->id_list, argv[i]+end); set = 1; - } else if (strncasecmp (argv[i], "Users", 1) == 0) { + } else if (!strncasecmp (argv[i], "Users", 1)) { addto_char_list(association_cond->user_list, argv[i]+end); set = 1; - } else if (strncasecmp (argv[i], "Accounts", 2) == 0) { + } else if (!strncasecmp (argv[i], "Accounts", 2)) { addto_char_list(association_cond->acct_list, argv[i]+end); set = 1; - } else if (strncasecmp (argv[i], "Clusters", 1) == 0) { + } else if (!strncasecmp (argv[i], "Clusters", 1)) { addto_char_list(association_cond->cluster_list, argv[i]+end); set = 1; - } else if (strncasecmp (argv[i], "Format", 1) == 0) { + } else if (!strncasecmp (argv[i], "Format", 1)) { if(format_list) addto_char_list(format_list, argv[i]+end); - } else if (strncasecmp (argv[i], "Partitions", 4) == 0) { + } else if (!strncasecmp (argv[i], "Partitions", 4)) { addto_char_list(association_cond->partition_list, argv[i]+end); set = 1; - } else if (strncasecmp (argv[i], "Parent", 4) == 0) { + } else if (!strncasecmp (argv[i], "Parent", 4)) { association_cond->parent_acct = strip_quotes(argv[i]+end, NULL); set = 1; @@ -477,53 +477,53 @@ extern int sacctmgr_list_association(int argc, char *argv[]) } else { print_acct = assoc->acct; } - field->print_routine(SLURM_PRINT_VALUE, field, + field->print_routine(field, print_acct); break; case PRINT_CLUSTER: - field->print_routine(SLURM_PRINT_VALUE, field, + field->print_routine(field, assoc->cluster); break; case PRINT_FAIRSHARE: - field->print_routine(SLURM_PRINT_VALUE, field, + field->print_routine(field, assoc->fairshare); break; case PRINT_ID: - field->print_routine(SLURM_PRINT_VALUE, field, + field->print_routine(field, assoc->id); break; case PRINT_MAXC: field->print_routine( - SLURM_PRINT_VALUE, field, + field, assoc->max_cpu_secs_per_job); break; case PRINT_MAXJ: - field->print_routine(SLURM_PRINT_VALUE, field, + field->print_routine(field, assoc->max_jobs); break; case PRINT_MAXN: - field->print_routine(SLURM_PRINT_VALUE, field, + field->print_routine(field, assoc->max_nodes_per_job); break; case PRINT_MAXW: field->print_routine( - SLURM_PRINT_VALUE, field, + field, assoc->max_wall_duration_per_job); break; case PRINT_PID: - field->print_routine(SLURM_PRINT_VALUE, field, + field->print_routine(field, assoc->parent_id); break; case PRINT_PNAME: - field->print_routine(SLURM_PRINT_VALUE, field, + field->print_routine(field, assoc->parent_acct); break; case PRINT_PART: - field->print_routine(SLURM_PRINT_VALUE, field, + field->print_routine(field, assoc->partition); break; case PRINT_USER: - field->print_routine(SLURM_PRINT_VALUE, field, + field->print_routine(field, assoc->user); break; default: diff --git a/src/sacctmgr/cluster_functions.c b/src/sacctmgr/cluster_functions.c index 2c0ac1653ba115fd781da37c8e798336c1e274c1..8de1a11d09564870af89ec111d0668dc656adb37 100644 --- a/src/sacctmgr/cluster_functions.c +++ b/src/sacctmgr/cluster_functions.c @@ -49,7 +49,7 @@ static int _set_cond(int *start, int argc, char *argv[], for (i=(*start); i<argc; i++) { end = parse_option_end(argv[i]); - if (strncasecmp (argv[i], "Set", 3) == 0) { + if (!strncasecmp (argv[i], "Set", 3)) { i--; break; } else if(!end && !strncasecmp(argv[i], "where", 5)) { @@ -57,10 +57,10 @@ static int _set_cond(int *start, int argc, char *argv[], } else if(!end) { addto_char_list(cluster_list, argv[i]); set = 1; - } else if (strncasecmp (argv[i], "Format", 1) == 0) { + } else if (!strncasecmp (argv[i], "Format", 1)) { if(format_list) addto_char_list(format_list, argv[i]+end); - } else if (strncasecmp (argv[i], "Names", 1) == 0) { + } else if (!strncasecmp (argv[i], "Names", 1)) { addto_char_list(cluster_list, argv[i]+end); set = 1; @@ -83,7 +83,7 @@ static int _set_rec(int *start, int argc, char *argv[], for (i=(*start); i<argc; i++) { end = parse_option_end(argv[i]); - if (strncasecmp (argv[i], "Where", 5) == 0) { + if (!strncasecmp (argv[i], "Where", 5)) { i--; break; } else if(!end && !strncasecmp(argv[i], "set", 3)) { @@ -91,20 +91,20 @@ static int _set_rec(int *start, int argc, char *argv[], } else if(!end) { printf(" Bad format on %s: End your option with " "an '=' sign\n", argv[i]); - } else if (strncasecmp (argv[i], "FairShare", 1) == 0) { + } else if (!strncasecmp (argv[i], "FairShare", 1)) { if (get_uint(argv[i]+end, &assoc->fairshare, "FairShare") == SLURM_SUCCESS) set = 1; - } else if (strncasecmp (argv[i], "MaxJobs", 4) == 0) { + } else if (!strncasecmp (argv[i], "MaxJobs", 4)) { if (get_uint(argv[i]+end, &assoc->max_jobs, "MaxJobs") == SLURM_SUCCESS) set = 1; - } else if (strncasecmp (argv[i], "MaxNodes", 4) == 0) { + } else if (!strncasecmp (argv[i], "MaxNodes", 4)) { if (get_uint(argv[i]+end, &assoc->max_nodes_per_job, "MaxNodes") == SLURM_SUCCESS) set = 1; - } else if (strncasecmp (argv[i], "MaxWall", 4) == 0) { + } else if (!strncasecmp (argv[i], "MaxWall", 4)) { mins = time_str2mins(argv[i]+end); if (mins != NO_VAL) { assoc->max_wall_duration_per_job @@ -114,7 +114,7 @@ static int _set_rec(int *start, int argc, char *argv[], printf(" Bad MaxWall time format: %s\n", argv[i]); } - } else if (strncasecmp (argv[i], "MaxCPUSecs", 4) == 0) { + } else if (!strncasecmp (argv[i], "MaxCPUSecs", 4)) { if (get_uint(argv[i]+end, &assoc->max_cpu_secs_per_job, "MaxCPUSecs") == SLURM_SUCCESS) @@ -152,19 +152,19 @@ extern int sacctmgr_add_cluster(int argc, char *argv[]) int end = parse_option_end(argv[i]); if(!end) { addto_char_list(name_list, argv[i]+end); - } else if (strncasecmp (argv[i], "FairShare", 1) == 0) { + } else if (!strncasecmp (argv[i], "FairShare", 1)) { fairshare = atoi(argv[i]+end); limit_set = 1; - } else if (strncasecmp (argv[i], "MaxCPUSecs", 4) == 0) { + } else if (!strncasecmp (argv[i], "MaxCPUSecs", 4)) { max_cpu_secs_per_job = atoi(argv[i]+end); limit_set = 1; - } else if (strncasecmp (argv[i], "MaxJobs=", 4) == 0) { + } else if (!strncasecmp (argv[i], "MaxJobs=", 4)) { max_jobs = atoi(argv[i]+end); limit_set = 1; - } else if (strncasecmp (argv[i], "MaxNodes", 4) == 0) { + } else if (!strncasecmp (argv[i], "MaxNodes", 4)) { max_nodes_per_job = atoi(argv[i]+end); limit_set = 1; - } else if (strncasecmp (argv[i], "MaxWall", 4) == 0) { + } else if (!strncasecmp (argv[i], "MaxWall", 4)) { mins = time_str2mins(argv[i]+end); if (mins != NO_VAL) { max_wall_duration_per_job = (uint32_t) mins; @@ -173,7 +173,7 @@ extern int sacctmgr_add_cluster(int argc, char *argv[]) printf(" Bad MaxWall time format: %s\n", argv[i]); } - } else if (strncasecmp (argv[i], "Names", 1) == 0) { + } else if (!strncasecmp (argv[i], "Names", 1)) { addto_char_list(name_list, argv[i]+end); } else { printf(" Unknown option: %s\n", argv[i]); @@ -410,40 +410,40 @@ extern int sacctmgr_list_cluster(int argc, char *argv[]) while((field = list_next(itr2))) { switch(field->type) { case PRINT_CLUSTER: - field->print_routine(SLURM_PRINT_VALUE, field, + field->print_routine(field, cluster->name); break; case PRINT_CHOST: - field->print_routine(SLURM_PRINT_VALUE, field, + field->print_routine(field, cluster->control_host); break; case PRINT_CPORT: - field->print_routine(SLURM_PRINT_VALUE, field, + field->print_routine(field, cluster->control_port); break; case PRINT_FAIRSHARE: field->print_routine( - SLURM_PRINT_VALUE, field, + field, cluster->default_fairshare); break; case PRINT_MAXC: field->print_routine( - SLURM_PRINT_VALUE, field, + field, cluster->default_max_cpu_secs_per_job); break; case PRINT_MAXJ: field->print_routine( - SLURM_PRINT_VALUE, field, + field, cluster->default_max_jobs); break; case PRINT_MAXN: field->print_routine( - SLURM_PRINT_VALUE, field, + field, cluster->default_max_nodes_per_job); break; case PRINT_MAXW: field->print_routine( - SLURM_PRINT_VALUE, field, + field, cluster-> default_max_wall_duration_per_job); break; @@ -489,12 +489,12 @@ extern int sacctmgr_modify_cluster(int argc, char *argv[]) assoc->max_wall_duration_per_job = NO_VAL; for (i=0; i<argc; i++) { - if (strncasecmp (argv[i], "Where", 5) == 0) { + if (!strncasecmp (argv[i], "Where", 5)) { i++; if(_set_cond(&i, argc, argv, assoc_cond->cluster_list, NULL)) cond_set = 1; - } else if (strncasecmp (argv[i], "Set", 3) == 0) { + } else if (!strncasecmp (argv[i], "Set", 3)) { i++; if(_set_rec(&i, argc, argv, assoc)) rec_set = 1; @@ -671,14 +671,14 @@ extern int sacctmgr_dump_cluster (int argc, char *argv[]) continue; } cluster_name = xstrdup(argv[i]+end); - } else if (strncasecmp (argv[i], "File", 1) == 0) { + } else if (!strncasecmp (argv[i], "File", 1)) { if(file_name) { printf(" File name already set to %s\n", file_name); continue; } file_name = xstrdup(argv[i]+end); - } else if (strncasecmp (argv[i], "Name", 1) == 0) { + } else if (!strncasecmp (argv[i], "Name", 1)) { if(cluster_name) { printf(" Can only do one cluster at a time. " "Already doing %s\n", cluster_name); diff --git a/src/sacctmgr/common.c b/src/sacctmgr/common.c index 68f2960c115f52006f8f68145d9912797fa2ed34..891381fa94f2d01f0f3b4e5bd9ce709a887b4299 100644 --- a/src/sacctmgr/common.c +++ b/src/sacctmgr/common.c @@ -562,61 +562,39 @@ extern int get_uint(char *in_value, uint32_t *out_value, char *type) return SLURM_SUCCESS; } -extern void sacctmgr_print_coord_list(type_t type, print_field_t *field, - List value) +extern void sacctmgr_print_coord_list(print_field_t *field, List value) { ListIterator itr = NULL; char *print_this = NULL; acct_coord_rec_t *object = NULL; - switch(type) { - case SLURM_PRINT_HEADLINE: + if(!value || !list_count(value)) { if(print_fields_parsable_print) - printf("%s|", field->name); + print_this = xstrdup(""); else - printf("%-*.*s ", field->len, field->len, field->name); - break; - case SLURM_PRINT_UNDERSCORE: - if(!print_fields_parsable_print) - printf("%-*.*s ", field->len, field->len, - "---------------------------------------"); - break; - case SLURM_PRINT_VALUE: - if(!value || !list_count(value)) { - if(print_fields_parsable_print) - print_this = xstrdup(""); - else - print_this = xstrdup(" "); - } else { - list_sort(value, (ListCmpF)sort_coord_list); - itr = list_iterator_create(value); - while((object = list_next(itr))) { - if(print_this) - xstrfmtcat(print_this, ",%s", - object->name); - else - print_this = xstrdup(object->name); - } - list_iterator_destroy(itr); - } - - if(print_fields_parsable_print) - printf("%s|", print_this); - else { - if(strlen(print_this) > field->len) - print_this[field->len-1] = '+'; - - printf("%-*.*s ", field->len, field->len, print_this); + print_this = xstrdup(" "); + } else { + list_sort(value, (ListCmpF)sort_coord_list); + itr = list_iterator_create(value); + while((object = list_next(itr))) { + if(print_this) + xstrfmtcat(print_this, ",%s", + object->name); + else + print_this = xstrdup(object->name); } - xfree(print_this); - break; - default: - if(print_fields_parsable_print) - printf("%s|", "n/a"); - else - printf("%-*s ", field->len, "n/a"); - break; + list_iterator_destroy(itr); + } + + if(print_fields_parsable_print) + printf("%s|", print_this); + else { + if(strlen(print_this) > field->len) + print_this[field->len-1] = '+'; + + printf("%-*.*s ", field->len, field->len, print_this); } + xfree(print_this); } extern int sort_coord_list(acct_coord_rec_t *coord_a, acct_coord_rec_t *coord_b) diff --git a/src/sacctmgr/file_functions.c b/src/sacctmgr/file_functions.c index dc4fab7afb1ad9dca06b03f7a1cd435cba74b8c1..7521ebfdc9776f21301e424de2ad1f1c2b2cb138 100644 --- a/src/sacctmgr/file_functions.c +++ b/src/sacctmgr/file_functions.c @@ -254,52 +254,52 @@ static sacctmgr_file_opts_t *_parse_options(char *options) break; } file_opts->name = xstrdup(option); - } else if (strncasecmp (sub, "AdminLevel", 2) == 0) { + } else if (!strncasecmp (sub, "AdminLevel", 2)) { file_opts->admin = str_2_acct_admin_level(option); - } else if (strncasecmp (sub, "Coordinator", 2) == 0) { + } else if (!strncasecmp (sub, "Coordinator", 2)) { if(!file_opts->coord_list) file_opts->coord_list = list_create(slurm_destroy_char); addto_char_list(file_opts->coord_list, option); - } else if (strncasecmp (sub, "DefaultAccount", 3) == 0) { + } else if (!strncasecmp (sub, "DefaultAccount", 3)) { file_opts->def_acct = xstrdup(option); - } else if (strncasecmp (sub, "Description", 3) == 0) { + } else if (!strncasecmp (sub, "Description", 3)) { file_opts->desc = xstrdup(option); - } else if (strncasecmp (sub, "FairShare", 1) == 0) { + } else if (!strncasecmp (sub, "FairShare", 1)) { if (get_uint(option, &file_opts->fairshare, "FairShare") != SLURM_SUCCESS) { printf(" Bad FairShare value: %s\n", option); _destroy_sacctmgr_file_opts(file_opts); break; } - } else if (strncasecmp (sub, "MaxCPUSec", 4) == 0 - || strncasecmp (sub, "MaxProcSec", 4) == 0) { + } else if (!strncasecmp (sub, "MaxCPUSec", 4) + || !strncasecmp (sub, "MaxProcSec", 4)) { if (get_uint(option, &file_opts->max_cpu_secs_per_job, "MaxCPUSec") != SLURM_SUCCESS) { printf(" Bad MaxCPUSec value: %s\n", option); _destroy_sacctmgr_file_opts(file_opts); break; } - } else if (strncasecmp (sub, "MaxJobs", 4) == 0) { + } else if (!strncasecmp (sub, "MaxJobs", 4)) { if (get_uint(option, &file_opts->max_jobs, "MaxJobs") != SLURM_SUCCESS) { printf(" Bad MaxJobs value: %s\n", option); _destroy_sacctmgr_file_opts(file_opts); break; } - } else if (strncasecmp (sub, "MaxNodes", 4) == 0) { + } else if (!strncasecmp (sub, "MaxNodes", 4)) { if (get_uint(option, &file_opts->max_nodes_per_job, "MaxNodes") != SLURM_SUCCESS) { printf(" Bad MaxNodes value: %s\n", option); _destroy_sacctmgr_file_opts(file_opts); break; } - } else if (strncasecmp (sub, "MaxWall", 4) == 0) { + } else if (!strncasecmp (sub, "MaxWall", 4)) { mins = time_str2mins(option); if (mins >= 0) { file_opts->max_wall_duration_per_job = (uint32_t) mins; - } else if (strcmp(option, "-1") == 0) { + } else if (strcmp(option, "-1")) { file_opts->max_wall_duration_per_job = INFINITE; } else { printf(" Bad MaxWall time format: %s\n", @@ -307,10 +307,10 @@ static sacctmgr_file_opts_t *_parse_options(char *options) _destroy_sacctmgr_file_opts(file_opts); break; } - } else if (strncasecmp (sub, "Organization", 1) == 0) { + } else if (!strncasecmp (sub, "Organization", 1)) { file_opts->org = xstrdup(option); - } else if (strncasecmp (sub, "QosLevel", 1) == 0 - || strncasecmp (sub, "Expedite", 1) == 0) { + } else if (!strncasecmp (sub, "QosLevel", 1) + || !strncasecmp (sub, "Expedite", 1)) { file_opts->qos = str_2_acct_qos(option); } else { printf(" Unknown option: %s\n", sub); @@ -489,41 +489,41 @@ static int _print_out_assoc(List assoc_list, bool user) while((field = list_next(itr2))) { switch(field->type) { case PRINT_ACCOUNT: - field->print_routine(SLURM_PRINT_VALUE, field, + field->print_routine(field, assoc->acct); break; case PRINT_FAIRSHARE: - field->print_routine(SLURM_PRINT_VALUE, field, + field->print_routine(field, assoc->fairshare); break; case PRINT_MAXC: field->print_routine( - SLURM_PRINT_VALUE, field, + field, assoc->max_cpu_secs_per_job); break; case PRINT_MAXJ: - field->print_routine(SLURM_PRINT_VALUE, field, + field->print_routine(field, assoc->max_jobs); break; case PRINT_MAXN: - field->print_routine(SLURM_PRINT_VALUE, field, + field->print_routine(field, assoc->max_nodes_per_job); break; case PRINT_MAXW: field->print_routine( - SLURM_PRINT_VALUE, field, + field, assoc->max_wall_duration_per_job); break; case PRINT_PARENT: - field->print_routine(SLURM_PRINT_VALUE, field, + field->print_routine(field, assoc->parent_acct); break; case PRINT_PART: - field->print_routine(SLURM_PRINT_VALUE, field, + field->print_routine(field, assoc->partition); break; case PRINT_USER: - field->print_routine(SLURM_PRINT_VALUE, field, + field->print_routine(field, assoc->user); break; default: @@ -1735,22 +1735,19 @@ extern void load_sacctmgr_cfg_file (int argc, char *argv[]) switch(field->type) { case PRINT_DESC: field->print_routine( - SLURM_PRINT_VALUE, field, acct->description); break; case PRINT_NAME: field->print_routine( - SLURM_PRINT_VALUE, field, acct->name); break; case PRINT_ORG: field->print_routine( - SLURM_PRINT_VALUE, field, acct->organization); break; case PRINT_QOS: field->print_routine( - SLURM_PRINT_VALUE, field, + field, acct_qos_str(acct->qos)); break; default: @@ -1790,29 +1787,27 @@ extern void load_sacctmgr_cfg_file (int argc, char *argv[]) switch(field->type) { case PRINT_ADMIN: field->print_routine( - SLURM_PRINT_VALUE, field, + field, acct_admin_level_str( user->admin_level)); break; case PRINT_COORDS: field->print_routine( - SLURM_PRINT_VALUE, field, user->coord_accts); break; case PRINT_DACCT: field->print_routine( - SLURM_PRINT_VALUE, field, + field, user->default_acct); break; case PRINT_NAME: field->print_routine( - SLURM_PRINT_VALUE, field, user->name); break; case PRINT_QOS: field->print_routine( - SLURM_PRINT_VALUE, field, + field, acct_qos_str(user->qos)); break; default: diff --git a/src/sacctmgr/sacctmgr.h b/src/sacctmgr/sacctmgr.h index f2906d56a09787947f616ca7337b9eb977102a3d..ba67edd318e179316561b8416b6ed0ba2983e764 100644 --- a/src/sacctmgr/sacctmgr.h +++ b/src/sacctmgr/sacctmgr.h @@ -142,8 +142,7 @@ extern int notice_thread_init(); extern int notice_thread_fini(); extern int commit_check(char *warning); extern int get_uint(char *in_value, uint32_t *out_value, char *type); -extern void sacctmgr_print_coord_list(type_t type, print_field_t *field, - List value); +extern void sacctmgr_print_coord_list(print_field_t *field, List value); extern int sort_coord_list(acct_coord_rec_t *coord_a, acct_coord_rec_t *coord_b); diff --git a/src/sacctmgr/txn_functions.c b/src/sacctmgr/txn_functions.c index dc7ed3c72633f091cd1c4a02bf5011092fc3de0d..772c0f625ccf90d5e92162eecf31c88cb4d8c04e 100644 --- a/src/sacctmgr/txn_functions.c +++ b/src/sacctmgr/txn_functions.c @@ -52,15 +52,15 @@ static int _set_cond(int *start, int argc, char *argv[], if(!end && !strncasecmp(argv[i], "where", 5)) { continue; } else if(!end - || (strncasecmp (argv[i], "Id", 1) == 0) - || (strncasecmp (argv[i], "Txn", 1) == 0)) { + || (!strncasecmp (argv[i], "Id", 1)) + || (!strncasecmp (argv[i], "Txn", 1))) { if(!txn_cond->id_list) txn_cond->id_list = list_create(slurm_destroy_char); addto_char_list(txn_cond->id_list, argv[i]+end); set = 1; - } else if (strncasecmp (argv[i], "Action", 4) == 0) { + } else if (!strncasecmp (argv[i], "Action", 4)) { /* FIX ME! fill this in */ /* if(!txn_cond->action_list) */ /* txn_cond->action_list = */ @@ -69,14 +69,15 @@ static int _set_cond(int *start, int argc, char *argv[], /* addto_char_list(txn_cond->action_list, */ /* argv[i]+end); */ /* set = 1; */ - } else if (strncasecmp (argv[i], "Actors", 4) == 0) { + } else if (!strncasecmp (argv[i], "Actors", 4) + || !strncasecmp (argv[i], "User", 1)) { if(!txn_cond->actor_list) txn_cond->actor_list = list_create(slurm_destroy_char); addto_char_list(txn_cond->actor_list, argv[i]+end); set = 1; - } else if (strncasecmp (argv[i], "Format", 1) == 0) { + } else if (!strncasecmp (argv[i], "Format", 1)) { if(format_list) addto_char_list(format_list, argv[i]+end); } else { @@ -150,12 +151,12 @@ extern int sacctmgr_list_txn(int argc, char *argv[]) } else if(!strncasecmp("Info", object, 2)) { field->type = PRINT_INFO; field->name = xstrdup("Info"); - field->len = 11; - field->print_routine = print_fields_uint; + field->len = 20; + field->print_routine = print_fields_str; } else if(!strncasecmp("TimeStamp", object, 1)) { field->type = PRINT_TS; field->name = xstrdup("Time"); - field->len = 7; + field->len = 15; field->print_routine = print_fields_date; } else if(!strncasecmp("Where", object, 1)) { field->type = PRINT_WHERE; @@ -181,27 +182,27 @@ extern int sacctmgr_list_txn(int argc, char *argv[]) switch(field->type) { case PRINT_ACTION: field->print_routine( - SLURM_PRINT_VALUE, field, + field, slurmdbd_msg_type_2_str(txn->action)); break; case PRINT_ACTOR: - field->print_routine(SLURM_PRINT_VALUE, field, + field->print_routine(field, txn->actor_name); break; case PRINT_ID: - field->print_routine(SLURM_PRINT_VALUE, field, + field->print_routine(field, txn->id); break; case PRINT_INFO: - field->print_routine(SLURM_PRINT_VALUE, field, + field->print_routine(field, txn->set_info); break; case PRINT_TS: - field->print_routine(SLURM_PRINT_VALUE, field, + field->print_routine(field, txn->timestamp); break; case PRINT_WHERE: - field->print_routine(SLURM_PRINT_VALUE, field, + field->print_routine(field, txn->where_query); break; default: diff --git a/src/sacctmgr/user_functions.c b/src/sacctmgr/user_functions.c index e30becaf55937e775f7965192b20cc2d4aa3d8d2..2e8b10bf1ea036216158cb9529bba3e67a892dc3 100644 --- a/src/sacctmgr/user_functions.c +++ b/src/sacctmgr/user_functions.c @@ -49,12 +49,12 @@ static int _set_cond(int *start, int argc, char *argv[], for (i=(*start); i<argc; i++) { end = parse_option_end(argv[i]); - if (strncasecmp (argv[i], "Set", 3) == 0) { + if (!strncasecmp (argv[i], "Set", 3)) { i--; break; - } else if (!end && strncasecmp (argv[i], "WithAssoc", 5) == 0) { + } else if (!end && !strncasecmp (argv[i], "WithAssoc", 5)) { user_cond->with_assocs = 1; - } else if (strncasecmp (argv[i], "WithCoordinators", 5) == 0) { + } else if (!strncasecmp (argv[i], "WithCoordinators", 5)) { user_cond->with_coords = 1; } else if(!end && !strncasecmp(argv[i], "where", 5)) { continue; @@ -63,36 +63,36 @@ static int _set_cond(int *start, int argc, char *argv[], addto_char_list(user_cond->assoc_cond->user_list, argv[i]); u_set = 1; - } else if (strncasecmp (argv[i], "Account", 2) == 0) { + } else if (!strncasecmp (argv[i], "Account", 2)) { addto_char_list(user_cond->assoc_cond->acct_list, argv[i]+end); a_set = 1; - } else if (strncasecmp (argv[i], "AdminLevel", 2) == 0) { + } else if (!strncasecmp (argv[i], "AdminLevel", 2)) { user_cond->admin_level = str_2_acct_admin_level(argv[i]+end); u_set = 1; - } else if (strncasecmp (argv[i], "Clusters", 1) == 0) { + } else if (!strncasecmp (argv[i], "Clusters", 1)) { addto_char_list(user_cond->assoc_cond->cluster_list, argv[i]+end); a_set = 1; - } else if (strncasecmp (argv[i], "DefaultAccount", 1) == 0) { + } else if (!strncasecmp (argv[i], "DefaultAccount", 1)) { addto_char_list(user_cond->def_acct_list, argv[i]+end); u_set = 1; - } else if (strncasecmp (argv[i], "Format", 1) == 0) { + } else if (!strncasecmp (argv[i], "Format", 1)) { if(format_list) addto_char_list(format_list, argv[i]+end); - } else if (strncasecmp (argv[i], "Names", 1) == 0 - || strncasecmp (argv[i], "Users", 1) == 0) { + } else if (!strncasecmp (argv[i], "Names", 1) + || !strncasecmp (argv[i], "Users", 1)) { addto_char_list(user_cond->user_list, argv[i]+end); addto_char_list(user_cond->assoc_cond->user_list, argv[i]+end); u_set = 1; - } else if (strncasecmp (argv[i], "Partition", 3) == 0) { + } else if (!strncasecmp (argv[i], "Partition", 3)) { addto_char_list(user_cond->assoc_cond->partition_list, argv[i]+end); a_set = 1; - } else if (strncasecmp (argv[i], "QosLevel", 1) == 0) { + } else if (!strncasecmp (argv[i], "QosLevel", 1)) { user_cond->qos = str_2_acct_qos(argv[i]+end); u_set = 1; } else { @@ -121,7 +121,7 @@ static int _set_rec(int *start, int argc, char *argv[], for (i=(*start); i<argc; i++) { end = parse_option_end(argv[i]); - if (strncasecmp (argv[i], "Where", 5) == 0) { + if (!strncasecmp (argv[i], "Where", 5)) { i--; break; } else if(!end && !strncasecmp(argv[i], "set", 3)) { @@ -129,40 +129,40 @@ static int _set_rec(int *start, int argc, char *argv[], } else if(!end) { printf(" Bad format on %s: End your option with " "an '=' sign\n", argv[i]); - } else if (strncasecmp (argv[i], "AdminLevel", 2) == 0) { + } else if (!strncasecmp (argv[i], "AdminLevel", 2)) { user->admin_level = str_2_acct_admin_level(argv[i]+end); u_set = 1; - } else if (strncasecmp (argv[i], "DefaultAccount", 1) == 0) { + } else if (!strncasecmp (argv[i], "DefaultAccount", 1)) { user->default_acct = strip_quotes(argv[i]+end, NULL); u_set = 1; - } else if (strncasecmp (argv[i], "FairShare", 1) == 0) { + } else if (!strncasecmp (argv[i], "FairShare", 1)) { if(!association) continue; if (get_uint(argv[i]+end, &association->fairshare, "FairShare") == SLURM_SUCCESS) a_set = 1; - } else if (strncasecmp (argv[i], "MaxCPUSec", 4) == 0) { + } else if (!strncasecmp (argv[i], "MaxCPUSec", 4)) { if(!association) continue; if (get_uint(argv[i]+end, &association->max_cpu_secs_per_job, "MaxCPUSec") == SLURM_SUCCESS) a_set = 1; - } else if (strncasecmp (argv[i], "MaxJobs", 4) == 0) { + } else if (!strncasecmp (argv[i], "MaxJobs", 4)) { if(!association) continue; if (get_uint(argv[i]+end, &association->max_jobs, "MaxJobs") == SLURM_SUCCESS) a_set = 1; - } else if (strncasecmp (argv[i], "MaxNodes", 4) == 0) { + } else if (!strncasecmp (argv[i], "MaxNodes", 4)) { if(!association) continue; if (get_uint(argv[i]+end, &association->max_nodes_per_job, "MaxNodes") == SLURM_SUCCESS) a_set = 1; - } else if (strncasecmp (argv[i], "MaxWall", 4) == 0) { + } else if (!strncasecmp (argv[i], "MaxWall", 4)) { if(!association) continue; mins = time_str2mins(argv[i]+end); @@ -174,7 +174,7 @@ static int _set_rec(int *start, int argc, char *argv[], printf(" Bad MaxWall time format: %s\n", argv[i]); } - } else if (strncasecmp (argv[i], "QosLevel", 1) == 0) { + } else if (!strncasecmp (argv[i], "QosLevel", 1)) { user->qos = str_2_acct_qos(argv[i]+end); u_set = 1; } else { @@ -243,35 +243,35 @@ extern int sacctmgr_add_user(int argc, char *argv[]) int end = parse_option_end(argv[i]); if(!end) { addto_char_list(assoc_cond->user_list, argv[i]+end); - } else if (strncasecmp (argv[i], "Accounts", 2) == 0) { + } else if (!strncasecmp (argv[i], "Accounts", 2)) { addto_char_list(assoc_cond->acct_list, argv[i]+end); - } else if (strncasecmp (argv[i], "AdminLevel", 2) == 0) { + } else if (!strncasecmp (argv[i], "AdminLevel", 2)) { admin_level = str_2_acct_admin_level(argv[i]+end); - } else if (strncasecmp (argv[i], "Clusters", 1) == 0) { + } else if (!strncasecmp (argv[i], "Clusters", 1)) { addto_char_list(assoc_cond->cluster_list, argv[i]+end); - } else if (strncasecmp (argv[i], "DefaultAccount", 1) == 0) { + } else if (!strncasecmp (argv[i], "DefaultAccount", 1)) { default_acct = strip_quotes(argv[i]+end, NULL); addto_char_list(assoc_cond->acct_list, default_acct); - } else if (strncasecmp (argv[i], "FairShare", 1) == 0) { + } else if (!strncasecmp (argv[i], "FairShare", 1)) { if (get_uint(argv[i]+end, &fairshare, "FairShare") == SLURM_SUCCESS) limit_set = 1; - } else if (strncasecmp (argv[i], "MaxCPUSecs", 4) == 0) { + } else if (!strncasecmp (argv[i], "MaxCPUSecs", 4)) { if (get_uint(argv[i]+end, &max_cpu_secs_per_job, "MaxCPUSecs") == SLURM_SUCCESS) limit_set = 1; - } else if (strncasecmp (argv[i], "MaxJobs", 4) == 0) { + } else if (!strncasecmp (argv[i], "MaxJobs", 4)) { if (get_uint(argv[i]+end, &max_jobs, "MaxJobs") == SLURM_SUCCESS) limit_set = 1; - } else if (strncasecmp (argv[i], "MaxNodes", 4) == 0) { + } else if (!strncasecmp (argv[i], "MaxNodes", 4)) { if (get_uint(argv[i]+end, &max_nodes_per_job, "MaxNodes") == SLURM_SUCCESS) limit_set = 1; - } else if (strncasecmp (argv[i], "MaxWall", 4) == 0) { + } else if (!strncasecmp (argv[i], "MaxWall", 4)) { mins = time_str2mins(argv[i]+end); if (mins != NO_VAL) { max_wall_duration_per_job = (uint32_t) mins; @@ -280,12 +280,12 @@ extern int sacctmgr_add_user(int argc, char *argv[]) printf(" Bad MaxWall time format: %s\n", argv[i]); } - } else if (strncasecmp (argv[i], "Names", 1) == 0) { + } else if (!strncasecmp (argv[i], "Names", 1)) { addto_char_list(assoc_cond->user_list, argv[i]+end); - } else if (strncasecmp (argv[i], "Partitions", 1) == 0) { + } else if (!strncasecmp (argv[i], "Partitions", 1)) { addto_char_list(assoc_cond->partition_list, argv[i]+end); - } else if (strncasecmp (argv[i], "QosLevel", 1) == 0) { + } else if (!strncasecmp (argv[i], "QosLevel", 1)) { qos = str_2_acct_qos(argv[i]+end); } else { printf(" Unknown option: %s\n", argv[i]); @@ -894,13 +894,11 @@ extern int sacctmgr_list_user(int argc, char *argv[]) switch(field->type) { case PRINT_ACCOUNT: field->print_routine( - SLURM_PRINT_VALUE, field, assoc->acct); break; case PRINT_ADMIN: field->print_routine( - SLURM_PRINT_VALUE, field, acct_admin_level_str( user-> @@ -908,101 +906,85 @@ extern int sacctmgr_list_user(int argc, char *argv[]) break; case PRINT_CLUSTER: field->print_routine( - SLURM_PRINT_VALUE, field, assoc->cluster); break; case PRINT_COORDS: field->print_routine( - SLURM_PRINT_VALUE, field, user->coord_accts); break; case PRINT_DACCT: field->print_routine( - SLURM_PRINT_VALUE, field, user->default_acct); break; case PRINT_FAIRSHARE: field->print_routine( - SLURM_PRINT_VALUE, field, assoc->fairshare); break; case PRINT_ID: field->print_routine( - SLURM_PRINT_VALUE, field, assoc->id); break; case PRINT_MAXC: field->print_routine( - SLURM_PRINT_VALUE, field, assoc-> max_cpu_secs_per_job); break; case PRINT_MAXJ: field->print_routine( - SLURM_PRINT_VALUE, field, assoc->max_jobs); break; case PRINT_MAXN: field->print_routine( - SLURM_PRINT_VALUE, field, assoc-> max_nodes_per_job); break; case PRINT_MAXW: field->print_routine( - SLURM_PRINT_VALUE, field, assoc-> max_wall_duration_per_job); break; case PRINT_QOS: field->print_routine( - SLURM_PRINT_VALUE, field, acct_qos_str( user->qos)); break; case PRINT_QOS_GOLD: field->print_routine( - SLURM_PRINT_VALUE, field, user->qos-1); break; case PRINT_QOS_RAW: field->print_routine( - SLURM_PRINT_VALUE, field, user->qos); break; case PRINT_PID: field->print_routine( - SLURM_PRINT_VALUE, field, assoc->parent_id); break; case PRINT_PNAME: field->print_routine( - SLURM_PRINT_VALUE, field, assoc->parent_acct); break; case PRINT_PART: field->print_routine( - SLURM_PRINT_VALUE, field, assoc->partition); break; case PRINT_USER: field->print_routine( - SLURM_PRINT_VALUE, field, user->name); break; @@ -1019,89 +1001,88 @@ extern int sacctmgr_list_user(int argc, char *argv[]) switch(field->type) { case PRINT_ACCOUNT: field->print_routine( - SLURM_PRINT_VALUE, field, + field, NULL); break; case PRINT_ADMIN: field->print_routine( - SLURM_PRINT_VALUE, field, + field, acct_admin_level_str( user->admin_level)); break; case PRINT_CLUSTER: field->print_routine( - SLURM_PRINT_VALUE, field, + field, NULL); break; case PRINT_COORDS: field->print_routine( - SLURM_PRINT_VALUE, field, user->coord_accts); break; case PRINT_DACCT: field->print_routine( - SLURM_PRINT_VALUE, field, + field, user->default_acct); break; case PRINT_FAIRSHARE: field->print_routine( - SLURM_PRINT_VALUE, field, + field, NULL); break; case PRINT_ID: field->print_routine( - SLURM_PRINT_VALUE, field, + field, NULL); break; case PRINT_MAXC: field->print_routine( - SLURM_PRINT_VALUE, field, + field, NULL); break; case PRINT_MAXJ: field->print_routine( - SLURM_PRINT_VALUE, field, + field, NULL); break; case PRINT_MAXN: field->print_routine( - SLURM_PRINT_VALUE, field, + field, NULL); break; case PRINT_MAXW: field->print_routine( - SLURM_PRINT_VALUE, field, + field, NULL); break; case PRINT_QOS: field->print_routine( - SLURM_PRINT_VALUE, field, + field, acct_qos_str(user->qos)); break; case PRINT_QOS_GOLD: field->print_routine( - SLURM_PRINT_VALUE, field, + field, user->qos-1); break; case PRINT_QOS_RAW: field->print_routine( - SLURM_PRINT_VALUE, field, + field, user->qos); break; case PRINT_PID: field->print_routine( - SLURM_PRINT_VALUE, field, + field, NULL); break; case PRINT_PART: field->print_routine( - SLURM_PRINT_VALUE, field, + field, NULL); break; case PRINT_USER: field->print_routine( - SLURM_PRINT_VALUE, field, + field, user->name); break; default: @@ -1152,11 +1133,11 @@ extern int sacctmgr_modify_user(int argc, char *argv[]) assoc->max_wall_duration_per_job = NO_VAL; for (i=0; i<argc; i++) { - if (strncasecmp (argv[i], "Where", 5) == 0) { + if (!strncasecmp (argv[i], "Where", 5)) { i++; cond_set = _set_cond(&i, argc, argv, user_cond, NULL); - } else if (strncasecmp (argv[i], "Set", 3) == 0) { + } else if (!strncasecmp (argv[i], "Set", 3)) { i++; rec_set = _set_rec(&i, argc, argv, user, assoc); } else { diff --git a/src/salloc/Makefile.am b/src/salloc/Makefile.am index a27f098f63607db4138573666e471be22641aa8b..3f3fe6e26969872f3e5990420cea29967c8444ec 100644 --- a/src/salloc/Makefile.am +++ b/src/salloc/Makefile.am @@ -1,6 +1,7 @@ # AUTOMAKE_OPTIONS = foreign +CLEANFILES = core.* INCLUDES = -I$(top_srcdir) diff --git a/src/salloc/Makefile.in b/src/salloc/Makefile.in index 1c34e396f741c1926c094c248169b1f903098101..68fe891269444748cecc8f24dbc2c74678007eea 100644 --- a/src/salloc/Makefile.in +++ b/src/salloc/Makefile.in @@ -261,6 +261,7 @@ target_vendor = @target_vendor@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = foreign +CLEANFILES = core.* INCLUDES = -I$(top_srcdir) salloc_SOURCES = salloc.c salloc.h opt.c opt.h convenience_libs = $(top_builddir)/src/api/libslurmhelper.la @@ -466,6 +467,7 @@ install-strip: mostlyclean-generic: clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) diff --git a/src/sbatch/Makefile.am b/src/sbatch/Makefile.am index de4ffb6aaabc6288ff314317d396c6cf713e1f36..4a8aacc1f95a0a1cf65b629f4aed828f6cf56b06 100644 --- a/src/sbatch/Makefile.am +++ b/src/sbatch/Makefile.am @@ -1,6 +1,7 @@ # AUTOMAKE_OPTIONS = foreign +CLEANFILES = core.* INCLUDES = -I$(top_srcdir) diff --git a/src/sbatch/Makefile.in b/src/sbatch/Makefile.in index 7cd63bdf96e48c6720c217cb9edce25bd2d3862b..73407e724b3562304fa3398649dcb4b4ab7c335d 100644 --- a/src/sbatch/Makefile.in +++ b/src/sbatch/Makefile.in @@ -261,6 +261,7 @@ target_vendor = @target_vendor@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = foreign +CLEANFILES = core.* INCLUDES = -I$(top_srcdir) sbatch_SOURCES = sbatch.c opt.c opt.h convenience_libs = $(top_builddir)/src/api/libslurmhelper.la @@ -464,6 +465,7 @@ install-strip: mostlyclean-generic: clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) diff --git a/src/sreport/Makefile.am b/src/sreport/Makefile.am index c01f23057d469da3d3532e4d46e4e15025471fa8..9cba5dbe05406a05b78744161992e0c95f5e63cd 100644 --- a/src/sreport/Makefile.am +++ b/src/sreport/Makefile.am @@ -1,6 +1,7 @@ # Makefile for sreport AUTOMAKE_OPTIONS = foreign +CLEANFILES = core.* INCLUDES = -I$(top_srcdir) diff --git a/src/sreport/Makefile.in b/src/sreport/Makefile.in index b32e054f34d07dc963154e8319cd0b2458feee35..d87270ddb4841979d9c0f65ef80414fe4f1b42a5 100644 --- a/src/sreport/Makefile.in +++ b/src/sreport/Makefile.in @@ -266,6 +266,7 @@ target_vendor = @target_vendor@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = foreign +CLEANFILES = core.* INCLUDES = -I$(top_srcdir) sreport_SOURCES = \ sreport.c sreport.h \ @@ -483,6 +484,7 @@ install-strip: mostlyclean-generic: clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) diff --git a/src/srun/Makefile.am b/src/srun/Makefile.am index 80a846909da642901012de95128b9d9dfdffee55..0f56761d18fe69283aaa511059c3697b81a20f48 100644 --- a/src/srun/Makefile.am +++ b/src/srun/Makefile.am @@ -1,6 +1,7 @@ # AUTOMAKE_OPTIONS = foreign +CLEANFILES = core.* INCLUDES = -I$(top_srcdir) @@ -22,7 +23,8 @@ srun_SOURCES = \ multi_prog.c multi_prog.h \ srun.wrapper.c -convenience_libs = $(top_builddir)/src/api/libslurmhelper.la +convenience_libs = $(top_builddir)/src/api/libslurmhelper.la \ + $(top_builddir)/src/common/libcommon.o -ldl srun_LDADD = \ $(convenience_libs) diff --git a/src/srun/Makefile.in b/src/srun/Makefile.in index 4485b7d17062a5582aee3cfdd870bd36d23e761c..34638721819a51c51b59a9d440ef419502b8673e 100644 --- a/src/srun/Makefile.in +++ b/src/srun/Makefile.in @@ -75,7 +75,9 @@ am_srun_OBJECTS = srun.$(OBJEXT) opt.$(OBJEXT) srun_job.$(OBJEXT) \ allocate.$(OBJEXT) core-format.$(OBJEXT) multi_prog.$(OBJEXT) \ srun.wrapper.$(OBJEXT) srun_OBJECTS = $(am_srun_OBJECTS) -srun_DEPENDENCIES = $(convenience_libs) +am__DEPENDENCIES_1 = $(top_builddir)/src/api/libslurmhelper.la \ + $(top_builddir)/src/common/libcommon.o +srun_DEPENDENCIES = $(am__DEPENDENCIES_1) srun_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(srun_LDFLAGS) \ $(LDFLAGS) -o $@ @@ -264,6 +266,7 @@ target_vendor = @target_vendor@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = foreign +CLEANFILES = core.* INCLUDES = -I$(top_srcdir) srun_SOURCES = \ srun.c srun.h \ @@ -281,7 +284,9 @@ srun_SOURCES = \ multi_prog.c multi_prog.h \ srun.wrapper.c -convenience_libs = $(top_builddir)/src/api/libslurmhelper.la +convenience_libs = $(top_builddir)/src/api/libslurmhelper.la \ + $(top_builddir)/src/common/libcommon.o -ldl + srun_LDADD = \ $(convenience_libs) @@ -492,6 +497,7 @@ install-strip: mostlyclean-generic: clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)