deb4998ba50060c48cce222fd18a8eed053918d7vboxsync/* $Id$ */
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync/** @file
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * IPRT - CRT Strings, strncmp().
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync */
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync/*
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * Copyright (C) 2006-2010 Oracle Corporation
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync *
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * available from http://www.virtualbox.org. This file is free software;
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * you can redistribute it and/or modify it under the terms of the GNU
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * General Public License (GPL) as published by the Free Software
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync *
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * The contents of this file may alternatively be used under the terms
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * of the Common Development and Distribution License Version 1.0
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * VirtualBox OSE distribution, in which case the provisions of the
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * CDDL are applicable instead of those of the GPL.
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync *
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * You may elect to license modified versions of this file under the
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * terms and conditions of either the GPL or the CDDL or both.
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync */
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync#include <iprt/string.h>
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync#ifdef _MSC_VER
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync_CRTIMP int __cdecl strncmp
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync#else
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncint strncmp
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync#endif
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync (const char *pszStr1, const char *pszStr2, size_t cb)
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync#if defined(__THROW) && !defined(RT_OS_WINDOWS) && !defined(RT_OS_OS2)
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync __THROW
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync#endif
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync{
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync const char* fini = pszStr1+cb;
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync while (pszStr1 < fini)
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync {
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync int res=*pszStr1-*pszStr2;
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync if (res)
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync return res;
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync if (!*pszStr1)
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync return 0;
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync ++pszStr1; ++pszStr2;
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync }
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync return 0;
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync}
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync