summaryrefslogtreecommitdiffstats
path: root/main.cxx
diff options
context:
space:
mode:
authorjistone <jistone>2006-03-03 19:39:49 +0000
committerjistone <jistone>2006-03-03 19:39:49 +0000
commit6f9f33e208c46af712e40c089748c5185121ceaf (patch)
tree6ffc28072a820b3f9b9465c4278290e97c57ddd2 /main.cxx
parent77a5c1f9949be4bdf3ebc6fb969debd68a9ebd27 (diff)
downloadsystemtap-steved-6f9f33e208c46af712e40c089748c5185121ceaf.tar.gz
systemtap-steved-6f9f33e208c46af712e40c089748c5185121ceaf.tar.xz
systemtap-steved-6f9f33e208c46af712e40c089748c5185121ceaf.zip
2006-03-03 Josh Stone <joshua.i.stone@intel.com>
PR 2390 * main.cxx (main): expand search path so that revision w.x.y.z searches w.x.y.z, w.x.y, and w.x.
Diffstat (limited to 'main.cxx')
-rw-r--r--main.cxx19
1 files changed, 11 insertions, 8 deletions
diff --git a/main.cxx b/main.cxx
index 8088c65b..46f79566 100644
--- a/main.cxx
+++ b/main.cxx
@@ -313,7 +313,7 @@ main (int argc, char * const argv [])
// Construct arch / kernel-versioning search path
vector<string> version_suffixes;
- const string& kvr = s.kernel_release;
+ string kvr = s.kernel_release;
const string& arch = s.architecture;
// add full kernel-version-release (2.6.NN-FOOBAR) + arch
version_suffixes.push_back ("/" + kvr + "/" + arch);
@@ -321,15 +321,18 @@ main (int argc, char * const argv [])
// add kernel version (2.6.NN) + arch
string::size_type dash_index = kvr.find ('-');
if (dash_index > 0 && dash_index != string::npos) {
- version_suffixes.push_back ("/" + kvr.substr (0, dash_index) + "/" + arch);
- version_suffixes.push_back ("/" + kvr.substr (0, dash_index));
+ kvr.erase(dash_index);
+ version_suffixes.push_back ("/" + kvr + "/" + arch);
+ version_suffixes.push_back ("/" + kvr);
}
// add kernel family (2.6) + arch
- string::size_type dot_index = kvr.find ('.');
- string::size_type dot2_index = kvr.find ('.', dot_index+1);
- if (dot2_index > 0 && dot2_index != string::npos) {
- version_suffixes.push_back ("/" + kvr.substr (0, dot2_index) + "/" + arch);
- version_suffixes.push_back ("/" + kvr.substr (0, dot2_index));
+ string::size_type dot1_index = kvr.find ('.');
+ string::size_type dot2_index = kvr.rfind ('.');
+ while (dot2_index > dot1_index && dot2_index != string::npos) {
+ kvr.erase(dot2_index);
+ version_suffixes.push_back ("/" + kvr + "/" + arch);
+ version_suffixes.push_back ("/" + kvr);
+ dot2_index = kvr.rfind ('.');
}
// add architecture search path
version_suffixes.push_back("/" + arch);