10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * CDDL HEADER START
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * The contents of this file are subject to the terms of the
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Common Development and Distribution License (the "License").
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * You may not use this file except in compliance with the License.
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * See the License for the specific language governing permissions
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * and limitations under the License.
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * When distributing Covered Code, include this CDDL HEADER in each
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * If applicable, add the following below this CDDL HEADER, with the
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * fields enclosed by brackets "[]" replaced with your own identifying
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * information: Portions Copyright [yyyy] [name of copyright owner]
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * CDDL HEADER END
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Use is subject to license terms.
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Handle expansion of make macros
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Included files
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe#include <mksh/macro.h> /* getvar(), expand_value() */
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Defined macros
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * typedefs & structs
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Static variables
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * File table of contents
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowesetvar_append(register Name name, register Name value)
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe register Property macro_apx = get_prop(name->prop, macro_append_prop);
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe register Property macro = get_prop(name->prop, macro_prop);
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe macro_apx = append_prop(name, macro_append_prop);
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe macro_apx->body.macro_appendix.value = macro->body.macro.value;
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe val = macro_apx->body.macro_appendix.value_to_append;
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe value = GETNAME(destination.buffer.start, FIND_LENGTH);
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe macro_apx->body.macro_appendix.value_to_append = value;
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * setvar_envvar()
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * This function scans the list of environment variables that have
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * dynamic values and sets them.
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Parameters:
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Global variables used:
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * envvar A list of environment vars with $ in value
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe if ((length = wcslen(value.buffer.start)) >= MAXPATHLEN) {
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe mbs = tmp_mbs_buffer = getmem((length + 1) * MB_LEN_MAX);
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe length = 2 + strlen(p->name->string_mb) + strlen(mbs);
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe if (!p->already_put || length > (MAXPATHLEN * MB_LEN_MAX)) {
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe tmp_mbs_buffer2 = NULL; // We should not return this memory now