From ea4ba1e8b36e290c117ebbbe2e71c5d96158b4c9 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 26 Jun 2016 12:30:28 +0200 Subject: [PATCH] Remove ggo.c and ggo.h. No source file includes ggo.h and none of the executables is linked with ggo.o any more, so we may get rid of them. --- ggo.c | 60 -------------------------------------------------- ggo.h | 70 ----------------------------------------------------------- 2 files changed, 130 deletions(-) delete mode 100644 ggo.c delete mode 100644 ggo.h diff --git a/ggo.c b/ggo.c deleted file mode 100644 index 81ab4644..00000000 --- a/ggo.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2008 Andre Noll - * - * Licensed under the GPL v2. For licencing details see COPYING. - */ - -/** \file ggo.c Function for printing help. */ - - -#include "para.h" -#include "ggo.h" -#include "version.h" - -/** - * Wrapper for printf() that exits on errors. - * - * \param fmt Usual format string. - * - * \return The return value of the underlying (successful) call to vprintf(3), - * i.e. the number of characters printed, excluding the terminating null byte. - */ -__printf_1_2 int printf_or_die(const char *fmt, ...) -{ - va_list argp; - int ret; - - va_start(argp, fmt); - ret = vprintf(fmt, argp); - va_end(argp); - if (ret >= 0) - return ret; - exit(EXIT_FAILURE); -} - -/** - * Print one of the two given help texts. - * - * \param help contains the help texts. - * \param flags What to print, see \ref ggo_print_help_flags. - */ -void ggo_print_help(struct ggo_help *help, unsigned flags) -{ - const char **p; - - if (help->purpose && (flags & GPH_PRINT_NAME_PURPOSE)) - printf_or_die("para_%s - %s\n", help->prefix, help->purpose); - if (help->usage && (flags & GPH_PRINT_USAGE)) - printf_or_die("\n%s\n", help->usage); - if (help->description && (flags & GPH_PRINT_DESCRIPTION)) - printf_or_die("\n%s\n", help->description); - printf_or_die("\n"); - if (flags & GPH_DETAILED) - p = help->detailed_help; - else - p = help->short_help; - if (!p) - return; - for (; *p; p++) - printf_or_die("%s\n", *p); -} diff --git a/ggo.h b/ggo.h deleted file mode 100644 index 7e524031..00000000 --- a/ggo.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 2008 Andre Noll - * - * Licensed under the GPL v2. For licencing details see COPYING. - */ - -/** \file ggo.h Functions and structures for help text handling. */ - -/** - * Information extracted from the .cmdline.h header files. - */ -struct ggo_help { - /** Program or module (receiver, filter, writer) name. */ - const char *prefix; - /** Generated by gengetopt from the options in the .ggo file. */ - const char **short_help; - /** Like \a short_help, plus the \a details section. */ - const char **detailed_help; - /** The purpose text as specified in the ggo file. */ - const char *purpose; - /** Generated by gengetopt and exported via the *.cmdline.h file. */ - const char *usage; - /** The description text given in the .ggo file. */ - const char *description; -}; - -/** - * Control the output of \ref ggo_print_help(). - * - * Any combination of these flags may be passed to ggo_print_help(). - * Note that the list of supported options is always printed. - */ -enum ggo_print_help_flags { - /** Whether to print the short help or the detailed help. */ - GPH_DETAILED = 1 << 0, - /** Print the program or module name and the purpose text. */ - GPH_PRINT_NAME_PURPOSE = 1 << 1, - /** Print the synopsis. */ - GPH_PRINT_USAGE = 1 << 2, - /** Print the description text. */ - GPH_PRINT_DESCRIPTION = 1 << 3, -}; - -/** Used to print the normal help of programs (--help) */ -#define GPH_STANDARD_FLAGS \ - (GPH_PRINT_NAME_PURPOSE | GPH_PRINT_USAGE) - -/** Additional information for --detailed-help. */ -#define GPH_STANDARD_FLAGS_DETAILED \ - (GPH_STANDARD_FLAGS | GPH_DETAILED | GPH_PRINT_DESCRIPTION) - -/** For module help embedded in a program help. */ -#define GPH_MODULE_FLAGS 0 - -/** Modules help with detailed descriptions. */ -#define GPH_MODULE_FLAGS_DETAILED GPH_DETAILED | GPH_PRINT_DESCRIPTION - -/** Make a ggo_help structure using information from the .cmdline.h file. */ -#define DEFINE_GGO_HELP(_prefix) \ - { \ - .prefix = #_prefix, \ - .short_help = _prefix ## _args_info_help, \ - .detailed_help = _prefix ## _args_info_detailed_help, \ - .purpose = _prefix ## _args_info_purpose, \ - .usage = _prefix ## _args_info_usage, \ - .description = _prefix ## _args_info_description, \ - } - -void ggo_print_help(struct ggo_help *help, unsigned flags); -__printf_1_2 int printf_or_die(const char *fmt, ...); -- 2.39.2