Tools: print full usage info. Also put feature AEC at the top

This commit is contained in:
Shahram Najm 2022-02-24 15:32:34 +00:00
parent 35e7f397a8
commit acd5c95d54
1 changed files with 17 additions and 15 deletions

View File

@ -20,13 +20,16 @@ extern int optind;
static void usage_and_exit(const char* progname)
{
printf("\nUsage: %s [-v] [-d] [-s]\n", progname);
printf("\t-v\tPrint only the version of ecCodes\n");
printf("\t-d\tPrint only the definitions path\n");
printf("\t-s\tPrint only the samples path\n");
exit(1);
}
#define INFO_PRINT_ALL 0
#define INFO_PRINT_VERSION (1 << 0)
#define INFO_PRINT_ALL 0
#define INFO_PRINT_VERSION (1 << 0)
#define INFO_PRINT_DEFINITION_PATH (1 << 1)
#define INFO_PRINT_SAMPLES_PATH (1 << 2)
#define INFO_PRINT_SAMPLES_PATH (1 << 2)
static void print_debug_info(grib_context* context)
{
@ -37,19 +40,19 @@ static void print_debug_info(grib_context* context)
#ifdef HAVE_AEC
aec = 1;
#endif
grib_context_log(context, GRIB_LOG_DEBUG, "Git SHA1=%s", grib_get_git_sha1());
grib_context_log(context, GRIB_LOG_DEBUG, "Build date=%s", codes_get_build_date());
grib_context_log(context, GRIB_LOG_DEBUG, "Git SHA1: %s", grib_get_git_sha1());
grib_context_log(context, GRIB_LOG_DEBUG, "Build date: %s", codes_get_build_date());
grib_context_log(context, GRIB_LOG_DEBUG, "Features:");
grib_context_log(context, GRIB_LOG_DEBUG, " HAVE_JPEG=%d", HAVE_JPEG);
grib_context_log(context, GRIB_LOG_DEBUG, " HAVE_LIBJASPER=%d", HAVE_LIBJASPER);
grib_context_log(context, GRIB_LOG_DEBUG, " HAVE_LIBOPENJPEG=%d", HAVE_JPEG);
grib_context_log(context, GRIB_LOG_DEBUG, " HAVE_LIBPNG=%d", HAVE_LIBPNG);
grib_context_log(context, GRIB_LOG_DEBUG, " HAVE_AEC=%d", aec);
grib_context_log(context, GRIB_LOG_DEBUG, " HAVE_ECCODES_THREADS=%d", GRIB_PTHREADS);
grib_context_log(context, GRIB_LOG_DEBUG, " HAVE_AEC=%d", aec);
grib_context_log(context, GRIB_LOG_DEBUG, " HAVE_JPEG=%d", HAVE_JPEG);
grib_context_log(context, GRIB_LOG_DEBUG, " HAVE_LIBJASPER=%d", HAVE_LIBJASPER);
grib_context_log(context, GRIB_LOG_DEBUG, " HAVE_LIBOPENJPEG=%d", HAVE_JPEG);
grib_context_log(context, GRIB_LOG_DEBUG, " HAVE_LIBPNG=%d", HAVE_LIBPNG);
grib_context_log(context, GRIB_LOG_DEBUG, " HAVE_ECCODES_THREADS=%d", GRIB_PTHREADS);
#ifdef GRIB_OMP_THREADS
grib_context_log(context, GRIB_LOG_DEBUG, " HAVE_ECCODES_OMP_THREADS=%d", GRIB_OMP_THREADS);
grib_context_log(context, GRIB_LOG_DEBUG, " HAVE_ECCODES_OMP_THREADS=%d", GRIB_OMP_THREADS);
#endif
grib_context_log(context, GRIB_LOG_DEBUG, " HAVE_MEMFS=%d", memfs);
grib_context_log(context, GRIB_LOG_DEBUG, " HAVE_MEMFS=%d", memfs);
}
int main(int argc, char* argv[])
@ -90,8 +93,7 @@ int main(int argc, char* argv[])
if (print_flags == INFO_PRINT_ALL) {
print_debug_info(context);
printf("\n");
printf("%s Version %d.%d.%d",
grib_get_package_name(), major, minor, revision);
printf("%s Version %d.%d.%d", grib_get_package_name(), major, minor, revision);
if (ECCODES_MAJOR_VERSION < 1)
printf(" PRE-RELEASE");