summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorGeorgi Kodinov <georgi.kodinov@oracle.com>2013-06-26 12:19:02 +0300
committerGeorgi Kodinov <georgi.kodinov@oracle.com>2013-06-26 12:19:02 +0300
commit1827eb8a2a8afd73603dabb442e7375774578da0 (patch)
tree808f0571d9278718300cd1d54e8428b318c0b717 /mysys
parent45a3854af72472bc403326470371d413d7e0031c (diff)
downloadmariadb-git-1827eb8a2a8afd73603dabb442e7375774578da0.tar.gz
Bug #16996656: UNIQUE OPTION PREFIXES NOT DEPRECATED IN 5.5+
Backported the deprecation warnings from WL#6978 to 5.5
Diffstat (limited to 'mysys')
-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..8d1da06af8c 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;
}