diff th_args.h @ 142:0a4fd9cfb929

Revise the argument handling API. Breaks compatibility.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 22 Nov 2014 23:37:44 +0200
parents f81c6dc7bd0f
children 51eec969b07a
line wrap: on
line diff
--- a/th_args.h	Mon Oct 13 06:36:15 2014 +0300
+++ b/th_args.h	Sat Nov 22 23:37:44 2014 +0200
@@ -1,7 +1,7 @@
 /*
  * Simple commandline argument processing function
  * Programmed and designed by Matti 'ccr' Hamalainen
- * (C) Copyright 2002-2012 Tecnic Software productions (TNSP)
+ * (C) Copyright 2002-2014 Tecnic Software productions (TNSP)
  *
  * Please read file 'COPYING' for information on license and distribution.
  */
@@ -19,10 +19,9 @@
  */
 #define OPT_NONE             (0)    // Simple option with no arguments
 #define OPT_ARGREQ           (1)    // Option requires an argument
-#define OPT_ARGMASK          (3)    // Mask for option argument flags
+#define OPT_ARGMASK          (1)    // Mask for option argument flags
 
 #define OPTH_BAILOUT         0x0001 // Bail out on errors
-
 #define OPTH_ONLY_OPTS       0x0010 // Handle only options
 #define OPTH_ONLY_OTHER      0x0020 // Handle only "non-options"
 #define OPTH_ONLY_MASK       0x00f0 // Mask
@@ -37,15 +36,16 @@
     char *optLong;
     char *desc;
     int flags;
-} optarg_t;
+} th_optarg_t;
 
 
 BOOL th_args_process(int argc, char *argv[],
-     optarg_t argList[], int argListN,
-     BOOL (*handleOpt)(int, char *, char *),
-     BOOL (*handleFile)(char *), int flags);
+     const th_optarg_t *opts, const int nopts,
+     BOOL (*handleOption)(int, char *, char *),
+     BOOL (*handleOther)(char *), const int flags);
 
-void th_args_help(FILE *, optarg_t optList[], int optListN);
+void th_args_help(FILE *, const th_optarg_t *opts,
+     const int nopts, const int flags);
 
 #ifdef __cplusplus
 }