summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/perk/perk_structs.h2
-rw-r--r--src/internal/argv/argv.h16
2 files changed, 14 insertions, 4 deletions
diff --git a/include/perk/perk_structs.h b/include/perk/perk_structs.h
index b1823b4..9ffb480 100644
--- a/include/perk/perk_structs.h
+++ b/include/perk/perk_structs.h
@@ -332,7 +332,7 @@ struct pe_raw_coff_symbol_name {
struct pe_raw_coff_strtbl {
unsigned char cst_size [0x04]; /* 0x00 */
- unsigned char cst_data [0x01]; /* 0x04 */
+ unsigned char cst_data []; /* 0x04 */
};
diff --git a/src/internal/argv/argv.h b/src/internal/argv/argv.h
index fc25730..3fc6c44 100644
--- a/src/internal/argv/argv.h
+++ b/src/internal/argv/argv.h
@@ -833,6 +833,7 @@ static void argv_usage_impl(
{
const struct argv_option ** optv;
const struct argv_option * option;
+ int nlong;
bool fshort,flong,fboth;
size_t len,optlen,desclen;
char cache;
@@ -865,7 +866,7 @@ static void argv_usage_impl(
if (header)
argv_dprintf(fd,"%s",header);
- for (optlen=0,optv=options; *optv; optv++) {
+ for (optlen=0,nlong=0,optv=options; *optv; optv++) {
option = *optv;
/* indent + comma */
@@ -884,6 +885,11 @@ static void argv_usage_impl(
/* optlen */
if (len > optlen)
optlen = len;
+
+ /* long (vs. hybrid-only) option? */
+ if (option->long_name)
+ if (!(option->flags & ARGV_OPTION_HYBRID_ONLY))
+ nlong++;
}
if (optlen >= optcap) {
@@ -904,7 +910,7 @@ static void argv_usage_impl(
/* color */
if (fcolor) {
color = (color == ccyan) ? cblue : ccyan;
- argv_dprintf(fd,color);
+ argv_dprintf(fd,color,0);
}
/* description, using either paradigm or argname if applicable */
@@ -916,7 +922,11 @@ static void argv_usage_impl(
/* long/hybrid option prefix (-/--) */
prefix = option->flags & ARGV_OPTION_HYBRID_ONLY
- ? " -" : "--";
+ ? " -" : " --";
+
+ /* avoid extra <stace> when all long opts are hybrid-only */
+ if (nlong == 0)
+ prefix++;
/* option string */
if (fboth && option->short_name && option->long_name)