diff options
author | Georgi Kodinov <georgi.kodinov@oracle.com> | 2013-06-26 12:19:02 +0300 |
---|---|---|
committer | Georgi Kodinov <georgi.kodinov@oracle.com> | 2013-06-26 12:19:02 +0300 |
commit | 8d87015412d574566107ecb3c8d875e11d6bbb81 (patch) | |
tree | 808f0571d9278718300cd1d54e8428b318c0b717 /mysys/my_getopt.c | |
parent | 26d14295a1e3ae5039dbcb435bb1740d25bd24b5 (diff) | |
download | mariadb-git-8d87015412d574566107ecb3c8d875e11d6bbb81.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/my_getopt.c')
-rw-r--r-- | mysys/my_getopt.c | 12 |
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; } |