fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync/* $Id$ */
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync/** @file
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync * IPRT - RTStrCatPEx
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync */
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync/*
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync * Copyright (C) 2011 Oracle Corporation
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync *
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync * available from http://www.virtualbox.org. This file is free software;
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync * you can redistribute it and/or modify it under the terms of the GNU
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync * General Public License (GPL) as published by the Free Software
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync *
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync * The contents of this file may alternatively be used under the terms
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync * of the Common Development and Distribution License Version 1.0
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync * VirtualBox OSE distribution, in which case the provisions of the
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync * CDDL are applicable instead of those of the GPL.
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync *
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync * You may elect to license modified versions of this file under the
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync * terms and conditions of either the GPL or the CDDL or both.
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync */
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync/*******************************************************************************
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync* Header Files *
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync*******************************************************************************/
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync#include <iprt/string.h>
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync#include "internal/iprt.h"
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsyncRTDECL(int) RTStrCatPEx(char **ppszDst, size_t *pcbDst, const char *pszSrc, size_t cchMaxSrc)
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync{
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync /*
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync * Advance past the current string in the output buffer and turn this into
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync * a copy operation.
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync */
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync size_t cbDst = *pcbDst;
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync char *pszDst = RTStrEnd(*ppszDst, cbDst);
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync AssertReturn(pszDst, VERR_INVALID_PARAMETER);
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync *pcbDst -= pszDst - *ppszDst;
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync *ppszDst = pszDst;
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync return RTStrCopyPEx(ppszDst, pcbDst, pszSrc, cchMaxSrc);
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync}
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsyncRT_EXPORT_SYMBOL(RTStrCatPEx);
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync