summaryrefslogtreecommitdiff
path: root/mysys/my_getopt.c
diff options
context:
space:
mode:
authorGeorgi Kodinov <georgi.kodinov@oracle.com>2013-06-28 17:13:44 +0300
committerGeorgi Kodinov <georgi.kodinov@oracle.com>2013-06-28 17:13:44 +0300
commit3b4bc33d93541a09e6d29e18a625e95a2d8983c4 (patch)
treec41fcf02d5b8f8d4f73f4dad74f680d885448f92 /mysys/my_getopt.c
parentb2159871e4401f25585ef95978405cf23adaf2c3 (diff)
parent1827eb8a2a8afd73603dabb442e7375774578da0 (diff)
downloadmariadb-git-3b4bc33d93541a09e6d29e18a625e95a2d8983c4.tar.gz
merge back to the 5.5 tree and fix indentation
Diffstat (limited to 'mysys/my_getopt.c')
-rw-r--r--mysys/my_getopt.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c
index 8575fde0ca9..03469589173 100644
--- a/mysys/my_getopt.c
+++ b/mysys/my_getopt.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -829,6 +829,7 @@ static int findopt(char *optpat, uint length,
{
uint count;
const struct my_option *opt= *opt_res;
+ my_bool is_prefix= FALSE;
for (count= 0; opt->name; opt++)
{
@@ -837,11 +838,14 @@ static int findopt(char *optpat, uint length,
(*opt_res)= opt;
if (!opt->name[length]) /* Exact match */
return 1;
+
if (!count)
{
/* We only need to know one prev */
count= 1;
*ffname= opt->name;
+ if (opt->name[length])
+ is_prefix= TRUE;
}
else if (strcmp(*ffname, opt->name))
{
@@ -853,6 +857,12 @@ static int findopt(char *optpat, uint length,
}
}
}
+ if (is_prefix && count == 1)
+ my_getopt_error_reporter(WARNING_LEVEL,
+ "Using unique option prefix %.*s instead of %s "
+ "is deprecated and will be removed in a future "
+ "release. Please use the full name instead.",
+ length, optpat, *ffname);
return count;
}