X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=ggo.c;h=81ab464491070f8b43fb7cfb018eef8e40a75495;hp=58d86d0796adec72bf3ea134532b9bc3c80bea07;hb=refs%2Fheads%2Fmaint;hpb=9d75ded33ce6664156acb07e311f51d55970bbea diff --git a/ggo.c b/ggo.c deleted file mode 100644 index 58d86d07..00000000 --- a/ggo.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2008-2013 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. - */ -__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); -}