You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/mail-mta/nullmailer/files/nullmailer-1.10-fix-sendmai...

101 lines
3.2 KiB

diff --git a/lib/cli++/main.cc b/lib/cli++/main.cc
index f0eb014..406e990 100644
--- a/lib/cli++/main.cc
+++ b/lib/cli++/main.cc
@@ -36,6 +36,7 @@ static cli_option help_option = { 'h', "help", cli_option::flag,
static cli_option** options;
static unsigned optionc;
+static const char* short_options;
static void build_options()
{
@@ -47,6 +48,13 @@ static void build_options()
for(unsigned i = 0; i < optionc-1; i++)
options[i] = &cli_options[i];
options[optionc-1] = &help_option;
+
+ char* so;
+ short_options = so = new char[optionc+1];
+ for (unsigned i = 0; i < optionc; i++)
+ if (options[i]->ch != 0)
+ *so++ = options[i]->ch;
+ *so = 0;
}
static inline int max(int a, int b)
@@ -275,14 +283,6 @@ static int parse_long(int, char* argv[])
++arg;
for(unsigned j = 0; j < optionc; j++) {
cli_option* o = options[j];
- if (cli_only_long && o->ch) {
- if (arg[0] == o->ch) {
- if (arg[1] == '\0')
- return o->parse_long_noeq(argv[1], true);
- else if (arg[1] == '=')
- return o->parse_long_eq(arg+2, true);
- }
- }
if(o->name) {
size_t len = strlen(o->name);
if(!memcmp(arg, o->name, len)) {
@@ -297,6 +297,13 @@ static int parse_long(int, char* argv[])
return -1;
}
+static int parse_either(int argc, char* argv[])
+{
+ return (strchr(short_options, argv[0][1]) != 0)
+ ? parse_short(argc, argv)
+ : parse_long(argc, argv);
+}
+
static int parse_args(int argc, char* argv[])
{
build_options();
@@ -312,9 +319,9 @@ static int parse_args(int argc, char* argv[])
i++;
break;
}
- int j = (!cli_only_long && arg[1] != '-')
- ? parse_short(argc-i, argv+i)
- : parse_long(argc-i, argv+i);
+ int j = (arg[1] == '-') ? parse_long(argc-i, argv+i)
+ : cli_only_long ? parse_either(argc-i, argv+i)
+ : parse_short(argc-i, argv+i);
if(j < 0)
usage(1);
else
diff --git a/src/sendmail.cc b/src/sendmail.cc
index f245226..2e5615b 100644
--- a/src/sendmail.cc
+++ b/src/sendmail.cc
@@ -66,26 +66,13 @@ cli_option cli_options[] = {
{ 'N', 0, cli_option::string, 0, &o_dummys, "Ignored", 0 },
{ 'n', 0, cli_option::flag, 0, &o_dummyi, "Ignored", 0 },
{ 'O', 0, cli_option::string, 0, &o_dummys, "Ignored", 0 },
- { 0, "odb", cli_option::flag, 0, &o_dummyi,
- "Deliver in background (always true)", 0 },
- { 0, "odf", cli_option::flag, 0, &o_dummyi,
- "Deliver in foreground (ignored)", 0 },
- { 0, "oem", cli_option::flag, 0, &o_dummyi,
- "Ignored", 0 },
+ { 'o', 0, cli_option::string, 0, &o_dummys, "Set sendmail flag, ignored", 0 },
{ 0, "em", cli_option::flag, 0, &o_dummyi,
"Ignored", 0 },
- { 0, "oep", cli_option::flag, 0, &o_dummyi,
- "Ignored", 0 },
{ 0, "ep", cli_option::flag, 0, &o_dummyi,
"Ignored", 0 },
- { 0, "oeq", cli_option::flag, 0, &o_dummyi,
- "Ignored", 0 },
{ 0, "eq", cli_option::flag, 0, &o_dummyi,
"Ignored", 0 },
- { 0, "oi", cli_option::flag, 0, &o_dummyi,
- "Ignored", 0 },
- { 0, "om", cli_option::flag, 0, &o_dummyi,
- "Ignored", 0 },
{ 'p', 0, cli_option::string, 0, &o_dummys, "Ignored", 0 },
{ 'q', 0, cli_option::string, 0, &o_dummys, "Ignored", 0 },
{ 'R', 0, cli_option::string, 0, &o_dummys, "Ignored", 0 },