fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync/* $Id$ */
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync/** @file
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync * IPRT - RTStrCat.
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync */
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync/*
2f7d372a31fd0f5515c2d307db549db16dd443f0vboxsync * Copyright (C) 2010-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) RTStrCatP(char **ppszDst, size_t *pcbDst, const char *pszSrc)
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync{
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync /*
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync * Advance past the current string in the output buffer and turn this into
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync * a copy operation.
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync */
2f7d372a31fd0f5515c2d307db549db16dd443f0vboxsync char *pszDstOrg = *ppszDst;
2f7d372a31fd0f5515c2d307db549db16dd443f0vboxsync size_t cbDst = *pcbDst;
2f7d372a31fd0f5515c2d307db549db16dd443f0vboxsync char *pszDst = RTStrEnd(pszDstOrg, cbDst);
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync AssertReturn(pszDst, VERR_INVALID_PARAMETER);
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync *ppszDst = pszDst;
2f7d372a31fd0f5515c2d307db549db16dd443f0vboxsync *pcbDst = cbDst - (pszDst - pszDstOrg);
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync return RTStrCopyP(ppszDst, pcbDst, pszSrc);
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync}
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsyncRT_EXPORT_SYMBOL(RTStrCatP);
fa073a3bc9ea2b9d238fd31e618643c5f1531327vboxsync