[PATCH 2/2] perf: Handle perf-versionnumber

Andi Kleen
2010-11-18T10:51:12Z

From: Andi Kleen <ak@linux.intel.com>

Sometimes it's useful to have multiple perfs with version number
around. This was defeated by the internal command code. Don't
try to handle a number as a internal command.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
tools/perf/perf.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index cdd6c03..c14c0fa 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -444,8 +444,11 @@ int main(int argc, const char **argv)
*
* So we just directly call the internal command handler, and
* die if that one cannot handle it.
+ *
+ * If there is a number after the - don't do this. Assume it's
+ * a perf-VERSIONNUMBER
*/
- if (!prefixcmp(cmd, "perf-")) {
+ if (!prefixcmp(cmd, "perf-") && !isdigit(cmd[5])) {
cmd += 5;
argv[0] = cmd;
handle_internal_command(argc, argv);
--
1.7.1