RTStrNCmp.cpp revision 3183efc91c7b8252f1dc50dca3efd2d8ae627813
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync/* $Id$ */
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync/** @file
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync * IPRT - RTStrNCmp.
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync */
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync/*
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync * Copyright (C) 2006-2009 Sun Microsystems, Inc.
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync *
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync * available from http://www.virtualbox.org. This file is free software;
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync * you can redistribute it and/or modify it under the terms of the GNU
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync * General Public License (GPL) as published by the Free Software
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync *
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync * The contents of this file may alternatively be used under the terms
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync * of the Common Development and Distribution License Version 1.0
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync * VirtualBox OSE distribution, in which case the provisions of the
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync * CDDL are applicable instead of those of the GPL.
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync *
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync * You may elect to license modified versions of this file under the
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync * terms and conditions of either the GPL or the CDDL or both.
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync *
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync * additional information or have any questions.
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync */
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync/*******************************************************************************
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync* Header Files *
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync*******************************************************************************/
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync#include <iprt/string.h>
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync#include "internal/iprt.h"
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsyncRTDECL(int) RTStrNCmp(const char *psz1, const char *psz2, size_t cchMax)
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync{
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync if (psz1 == psz2)
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync return 0;
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync if (!psz1)
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync return -1;
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync if (!psz2)
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync return 1;
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync return strncmp(psz1, psz2, cchMax);
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync}
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsyncRT_EXPORT_SYMBOL(RTStrNCmp);
3183efc91c7b8252f1dc50dca3efd2d8ae627813vboxsync