/*
 * Copyright (C) 2008-2010, Gostai S.A.S.
 *
 * This software is provided "as is" without warranty of any kind,
 * either expressed or implied, including but not limited to the
 * implied warranties of fitness for a particular purpose.
 *
 * See the LICENSE file for more information.
 */

#ifndef LIBPORT_CSTRING
# define LIBPORT_CSTRING

# include <cstring>

# include <libport/export.hh>

namespace libport
{
  /// Portable for Windows: if errnum (which is expected to be really
  /// errno, even on Windows), is null, then we use GetLastError() to
  /// get the Windows specific error messages.
  ///
  /// Really beware: do _not_ pass the result of GetLastError() to
  /// this function, it calls is itself.
  LIBPORT_API
  const char* strerror(int errnum);

  /// Whether the C strings \a lhs and \a rhs are equal.
  bool streq(const char* lhs, const char* rhs);

  /// Whether the C strings \a lhs and \a rhs are equal up to \a n chars.
  bool strneq(const char* lhs, const char* rhs, size_t n);

  /// Pointer to the first occurence of \a c in the first \a n bytes
  /// of \a str, or 0 if not found.
  const char* strnchr(const char* str, size_t n, char c);
}

# include <libport/cstring.hxx>

#endif // !LIBPORT_CSTRING

// Local Variables:
// mode: C++
// End:
