diff options
author | ljb1 <ljb1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-09-13 18:33:22 +0000 |
---|---|---|
committer | ljb1 <ljb1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-09-13 18:33:22 +0000 |
commit | 8c87ea41ff90d4eaca198cfc8cfc7ebe68c95d22 (patch) | |
tree | 8ae24ce675b3575ea1927af7e9b1da25722651a1 /ace/Arg_Shifter.cpp | |
parent | 4fe0b65e50654603333bc1b175269aeacb363e14 (diff) | |
download | ATCD-8c87ea41ff90d4eaca198cfc8cfc7ebe68c95d22.tar.gz |
ChangeLogTag: Mon Sep 13 13:31:23 1999 Luther J Baker <ljb1@cs.wustl.edu>
Diffstat (limited to 'ace/Arg_Shifter.cpp')
-rw-r--r-- | ace/Arg_Shifter.cpp | 58 |
1 files changed, 19 insertions, 39 deletions
diff --git a/ace/Arg_Shifter.cpp b/ace/Arg_Shifter.cpp index a9c2471bc3a..febd47d60c8 100644 --- a/ace/Arg_Shifter.cpp +++ b/ace/Arg_Shifter.cpp @@ -59,51 +59,31 @@ ACE_Arg_Shifter::get_current (void) const } char* -ACE_Arg_Shifter::get_current_parameter (int offset) +ACE_Arg_Shifter::get_the_parameter (const char* flag) { - if (this->is_anything_left()) + // the return 0's abound because this method + // would otherwise be a deep if { } else { } + + // check to see if any arguments still exist + if (!this->is_anything_left()) + return 0; + + // check to see if the flag is the argument + int offset = this->cur_arg_strncasecmp (flag); + if (offset == -1) + return 0; + + if (offset == 0) { - unsigned int margin = 0; + this->consume_arg (); - if (offset < 0) - { - int difference = ACE_OS::strlen(this->temp_[current_index_]) + offset; - - if (difference < 0) - { - return 0; - } - else - { - margin = ++difference; - } - } - else if (offset > 0) + if (!this->is_parameter_next()) { - int difference = ACE_OS::strlen(this->temp_[current_index_]) - offset; - - if (difference < 0) - { - return 0; - } - else - { - margin = offset; - } - } - else - { - this->consume_arg (); - - if (!this->is_parameter_next()) - { - return 0; - } + return 0; } - return this->temp_[current_index_] + margin; } - - return 0; + // the paramter is in the middle somewhere... + return this->temp_[current_index_] + offset; return 0; } int |