changeset 45:e031a062b731

Separate program "banner" printing from th_args_help() to th_print_banner().
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 03 Oct 2011 15:37:53 +0300
parents 669d2bc97c57
children 5f73c8cd333a
files th_args.c th_args.h th_util.c th_util.h
diffstat 4 files changed, 17 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/th_args.c	Mon Oct 03 00:28:55 2011 +0300
+++ b/th_args.c	Mon Oct 03 15:37:53 2011 +0300
@@ -366,20 +366,10 @@
 /* Print help for commandline arguments/options
  */
 void th_args_help(FILE * outFile,
-                  optarg_t optList[], int optListN,
-                  char *progName, char *progUsage)
+                  optarg_t optList[], int optListN)
 {
     int i, nrequired;
 
-    fprintf(outFile,
-            "\n%s v%s (%s)\n"
-            "%s\n"
-            "%s\n"
-            "Usage: %s %s\n",
-            th_prog_name, th_prog_version, th_prog_fullname,
-            th_prog_author, th_prog_license, progName, progUsage);
-
-
     for (i = nrequired = 0; i < optListN; i++)
     {
         optarg_t *o = &optList[i];
--- a/th_args.h	Mon Oct 03 00:28:55 2011 +0300
+++ b/th_args.h	Mon Oct 03 15:37:53 2011 +0300
@@ -39,7 +39,7 @@
      BOOL (*handleOpt)(int, char *, char *),
      BOOL (*handleFile)(char *), BOOL);
 
-void th_args_help(FILE *, optarg_t optList[], int optListN, char *, char *);
+void th_args_help(FILE *, optarg_t optList[], int optListN);
 
 #ifdef __cplusplus
 }
--- a/th_util.c	Mon Oct 03 00:28:55 2011 +0300
+++ b/th_util.c	Mon Oct 03 15:37:53 2011 +0300
@@ -45,6 +45,18 @@
 }
 
 
+void th_print_banner(FILE *outFile, const char *binName, const char *progUsage)
+{
+    fprintf(outFile,
+            "\n%s v%s (%s)\n"
+            "%s\n"
+            "%s\n"
+            "Usage: %s %s\n",
+            th_prog_name, th_prog_version, th_prog_fullname,
+            th_prog_author, th_prog_license, binName, progUsage);
+}
+
+
 /* Print formatted error, warning and information messages
  * TODO: Implement th_vfprintf() and friends?
  */
--- a/th_util.h	Mon Oct 03 00:28:55 2011 +0300
+++ b/th_util.h	Mon Oct 03 15:37:53 2011 +0300
@@ -13,6 +13,7 @@
 #endif
 
 #include "th_types.h"
+#include <stdio.h>
 #include <stdarg.h>
 #include <stdlib.h>
 #include <sys/types.h>
@@ -65,6 +66,8 @@
  */
 void    th_init(char *progName, char *progFullName, char *progVersion,
                char *progAuthor, char *progLicense);
+void    th_print_banner(FILE *outFile, const char *binName, const char *progUsage);
+
 void    THERR(const char *, ...);
 void    THMSG(int, const char *, ...);
 void    THPRINT(int, const char *, ...);