/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
/*
* System includes
*/
#include <stdio.h>
#include <limits.h>
#include <stdlib.h>
#include <unistd.h>
#include <libgen.h>
#include <errno.h>
#include <string.h>
#include <fcntl.h>
#include <signal.h>
#include <assert.h>
#include <locale.h>
#include <libintl.h>
/*
* local includes
*/
#include "instzones_lib.h"
#include "zones_strings.h"
(!x[2] || (x[2] == '/')))
/*
* *****************************************************************************
* global external (public) functions
* *****************************************************************************
*/
/*
* Name: z_make_zone_root
* Description: Given its zonepath, generate a string representing the
* mountpoint of where the root path for a nonglobal zone is
* mounted. The zone is mounted using 'zoneadm', which mounts
* the zone's filesystems wrt <zonepath>/lu/a
* Arguments: zone_path - non-NULL pointer to string representing zonepath
* Returns: char * - pointer to string representing zonepath of zone
* NULL - if zone_path is NULL.
* Notes: The string returned is in static storage and should not be
* free()ed by the caller.
*/
char *
{
return (NULL);
(zone_path[0] != '\0' &&
return (zone_root_buf);
}
void
{
char *pt;
char *last;
int level;
/* remove references such as "./" and "../" and "//" */
level = 0;
do {
level++;
last += 2;
if (*last) {
last++;
}
--pt; /* point to previous '/' */
while (level--) {
return;
}
;
}
if (*pt == '/') {
pt++;
}
} else {
pt++;
}
if (*pt == '/') {
}
pt++;
}
}
}
*pt = '\0';
}
}
void
{
char *dst;
char *src_start;
/* keep a ptr to the beginning of the src string */
while (*src) {
if (*src == '/') {
*dst++ = '/';
while (*src == '/')
src++;
} else
}
/*
* remove any trailing slashes, unless the whole string is just "/".
* If the whole string is "/" (i.e. if the last '/' cahr in dst
* in the beginning of the original string), just terminate it
* and return "/".
*/
dst--;
*dst = '\0';
}