fix doc example typo
[boost.git] / tools / bcp / path_operations.cpp
blob24ca6fe07f4a2d2a73391959b1d321c1b402cde2
1 /*
3 * Copyright (c) 2003 Dr John Maddock
4 * Use, modification and distribution is subject to the
5 * Boost Software License, Version 1.0. (See accompanying file
6 * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 * This file implements path comparisons
9 */
12 #include "bcp_imp.hpp"
13 #include <cctype>
15 #ifdef BOOST_NO_STDC_NAMESPACE
16 namespace std{
17 using ::tolower;
19 #endif
22 int compare_paths(const fs::path& a, const fs::path& b)
24 const std::string& as = a.string();
25 const std::string& bs = b.string();
26 std::string::const_iterator i, j, k, l;
27 i = as.begin();
28 j = as.end();
29 k = bs.begin();
30 l = bs.end();
31 while(i != j)
33 if(k == l)
34 return -1;
35 int r = std::tolower(*i) - std::tolower(*k);
36 if(r) return r;
37 ++i;
38 ++k;
40 return (k == l) ? 0 : 1;