Switch to unified view

a/src/utils/pathut.cpp b/src/utils/pathut.cpp
1
#ifndef lint
1
#ifndef lint
2
static char rcsid[] = "@(#$Id: pathut.cpp,v 1.9 2006-02-02 08:58:11 dockes Exp $ (C) 2004 J.F.Dockes";
2
static char rcsid[] = "@(#$Id: pathut.cpp,v 1.10 2006-03-29 11:18:15 dockes Exp $ (C) 2004 J.F.Dockes";
3
#endif
3
#endif
4
/*
4
/*
5
 *   This program is free software; you can redistribute it and/or modify
5
 *   This program is free software; you can redistribute it and/or modify
6
 *   it under the terms of the GNU General Public License as published by
6
 *   it under the terms of the GNU General Public License as published by
7
 *   the Free Software Foundation; either version 2 of the License, or
7
 *   the Free Software Foundation; either version 2 of the License, or
...
...
187
    }
187
    }
188
    globfree(&mglob);
188
    globfree(&mglob);
189
    return res;
189
    return res;
190
}
190
}
191
191
192
std::string url_encode(const std::string url, string::size_type offs)
193
{
194
    string out = url.substr(0, offs);
195
    const char *cp = url.c_str();
196
    for (string::size_type i = offs; i < url.size(); i++) {
197
  int c;
198
  char *h = "0123456789ABCDEF";
199
  c = cp[i];
200
  if(c <= 0x1f || 
201
     c >= 0x7f || 
202
     c == '<' ||
203
     c == '>' ||
204
     c == ' ' ||
205
     c == '\t'||
206
     c == '"' ||
207
     c == '#' ||
208
     c == '%' ||
209
     c == '{' ||
210
     c == '}' ||
211
     c == '|' ||
212
     c == '\\' ||
213
     c == '^' ||
214
     c == '~'||
215
     c == '[' ||
216
     c == ']' ||
217
     c == '`') {
218
      out += '%';
219
      out += h[(c >> 4) & 0xf];
220
      out += h[c & 0xf];
221
  } else {
222
      out += char(c);
223
  }
224
    }
225
    return out;
226
}
192
227
193
#else // TEST_PATHUT
228
#else // TEST_PATHUT
194
229
195
#include <iostream>
230
#include <iostream>
196
using namespace std;
231
using namespace std;