# HG changeset patch # User Matti Hamalainen # Date 1317645533 -10800 # Node ID 5f73c8cd333a529f927d34f5321a3349b464a1eb # Parent e031a062b7313f03e4d6a6c323af9d4f6205d70c Change some structure member names in optarg_t. diff -r e031a062b731 -r 5f73c8cd333a th_args.c --- 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++; diff -r e031a062b731 -r 5f73c8cd333a th_args.h --- 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;