/**************************************************************************/
/*                                                                        */
/*                                 Sources                                */
/*                                from  the                               */
/*                           XSC SOFTWARE PACKAGE                         */
/*                                                                        */
/*                Copyright (c) 1997 University of Karlsruhe              */
/*                     Institute for Appl. Mathematics                    */
/*                                                                        */
/* This program is free software for non-commercial use. For details, see */
/* the file LICENSE.XSC, distributed with this software package.          */
/*                                                                        */
/* This program is distributed WITHOUT ANY WARRANTY. For details, see the */
/* file LICENSE.XSC, distributed with this software package.              */
/*                                                                        */
/**************************************************************************/

/* RCS $Id: s_vlcp.c,v 1.2 1997/09/25 18:04:36 ae59 Exp $ */
/*
$Log: s_vlcp.c,v $
 * Revision 1.2  1997/09/25  18:04:36  ae59
 * Copyright-message
 *
 * Revision 1.1  1994/01/27  13:24:54  ae59
 * Put under RCS control
 *
 */
/****************************************************************/
/*                                                              */
/*      Filename        : s_vlcp.c                              */
/*                                                              */
/*      Entries         : void s_vlcp(d)                        */
/*                        s_trng *d;                            */
/*                                                              */
/*      Arguments       : d = string                            */
/*                                                              */
/*      Description     : copy value-parameter if temporary flag*/
/*                        is FALSE, otherwise set temporary-flag*/
/*                        FALSE.                                */
/*                                                              */
/*      Date            : 1993-09-16                            */
/*      1993-09-16 : char* cast in malloc =b=                   */
/*      1991-06-11 : set d->suba to FALSE                       */
/*      1990-12-18 : value arguments always have default length */
/*      1990-12-03 : one more allocated for direct use of '\0'  */
/*      1990-11-22 : replace strncpy by memcpy                  */
/*      1990-11-20 : E_TPUSH+E_TPOPP                            */
/*      1990-11-12 : assign ptr to d->ptr                       */
/*      1990-10-31 : copy allocated length not current length   */
/****************************************************************/

#ifndef ALL_IN_ONE
#ifdef AIX
#include "/u/p88c/runtime/o_defs.h"
#else
#include "o_defs.h"
#endif
#define local
#endif

#ifdef LINT_ARGS
local void s_vlcp(s_trng *d)
#else
local void s_vlcp(d)

s_trng *d;
#endif
        {
        char *ptr;

        E_TPUSH("s_vlcp")

        if (d->tmp==FALSE)
           {

           /* one more allocated for dierct use of '\0' */
           if ((ptr = (char*) malloc(d->alen+1))==NULL)
              e_trap(ALLOCATION,2,E_TMSG,54);
           else
              {
#ifdef HEAP_CHECK
b_geth((a_char *)&d->ptr,(a_char *)ptr,(a_char *)"s_vlcp");
#endif
              memcpy(ptr,d->ptr,d->alen);
              d->ptr = ptr;
              }
           d->suba = FALSE;
           }
        else
           d->tmp = FALSE;

        d->fix = FALSE;

        E_TPOPP("s_vlcp")
        return;
        }

