changeset 46:5f73c8cd333a

Change some structure member names in optarg_t.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 03 Oct 2011 15:38:53 +0300
parents e031a062b731
children c811c952d21d
files th_args.c th_args.h
diffstat 2 files changed, 13 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/th_args.c	Mon Oct 03 15:37:53 2011 +0300
+++ b/th_args.c	Mon Oct 03 15:38:53 2011 +0300
@@ -128,7 +128,7 @@
  */
 static BOOL th_args_check_arg(optarg_t *o, char *optArg)
 {
-    if ((o->optFlags & OPT_ARGMASK) == OPT_ARGREQ && optArg == NULL)
+    if ((o->flags & OPT_ARGMASK) == OPT_ARGREQ && optArg == NULL)
     {
         if (o->optShort != 0 && o->optLong != NULL)
         {
@@ -169,7 +169,7 @@
             if (*tmpArg == optList[optN].optShort)
             {
                 /* Get possible option argument, if needed */
-                if ((optList[optN].optFlags & OPT_ARGMASK) != 0
+                if ((optList[optN].flags & OPT_ARGMASK) != 0
                     && (++(*newArgIndex) < argc))
                     optArg = argv[*newArgIndex];
                 else
@@ -187,7 +187,7 @@
 
                     tmpStr[0] = *tmpArg;
 
-                    if (!handleOpt(optList[optN].optID, optArg, tmpStr))
+                    if (!handleOpt(optList[optN].id, optArg, tmpStr))
                         return FALSE;
                 }
 
@@ -234,7 +234,7 @@
     /* Get possible option argument, if needed */
     if (optN >= 0)
     {
-        if ((optList[optN].optFlags & OPT_ARGMASK) != 0)
+        if ((optList[optN].flags & OPT_ARGMASK) != 0)
         {
             if (currArg[optLen] == '=')
                 optArg = &currArg[optLen + 1];
@@ -251,7 +251,7 @@
         {
             /* Option was given succesfully, try to handle it */
             wasGiven[optN] = TRUE;
-            if (!handleOpt(optList[optN].optID, optArg, currArg))
+            if (!handleOpt(optList[optN].id, optArg, currArg))
                 return FALSE;
         }
     }
@@ -348,7 +348,7 @@
 
     /* Check wasGiven by isRequired */
     for (i = 0; i < optListN; i++)
-        if ((optList[i].optFlags & OPT_REQUIRED) != 0 && !wasGiven[i])
+        if ((optList[i].flags & OPT_REQUIRED) != 0 && !wasGiven[i])
         {
             THERR("Option -%s (--%s) is required.\n",
                   optList[i].optShort, optList[i].optLong);
@@ -385,13 +385,13 @@
         {
             char tmpStr[64], *p;
 
-            if ((o->optFlags & OPT_ARGMASK) == OPT_ARGOPT)
+            if ((o->flags & OPT_ARGMASK) == OPT_ARGOPT)
             {
                 snprintf(tmpStr, sizeof(tmpStr), "%s[=ARG]",
                          optList[i].optLong);
                 p = tmpStr;
             }
-            else if ((o->optFlags & OPT_ARGMASK) == OPT_ARGREQ)
+            else if ((o->flags & OPT_ARGMASK) == OPT_ARGREQ)
             {
                 snprintf(tmpStr, sizeof(tmpStr), "%s=ARG",
                          optList[i].optLong);
@@ -405,9 +405,9 @@
         else
             fprintf(outFile, "                 ");
 
-        fprintf(outFile, "  %s.", optList[i].optDesc);
+        fprintf(outFile, "  %s.", optList[i].desc);
 
-        if (o->optFlags & OPT_REQUIRED)
+        if (o->flags & OPT_REQUIRED)
         {
             fprintf(outFile, " [*]\n");
             nrequired++;
--- a/th_args.h	Mon Oct 03 15:37:53 2011 +0300
+++ b/th_args.h	Mon Oct 03 15:38:53 2011 +0300
@@ -26,11 +26,11 @@
 
 
 typedef struct {
-    int optID;
+    int id;
     char optShort;
     char *optLong;
-    char *optDesc;
-    int optFlags;
+    char *desc;
+    int flags;
 } optarg_t;