/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Copyright (c) 2001 by Sun Microsystems, Inc.
* All rights reserved.
*/
#ident "%Z%%M% %I% %E% SMI" /* from SVR4 bnu:expfile.c 2.10 */
#include "uucp.h"
/*
* expand file name expansion is based on first characters
* / -> fully qualified pathname. no
* processing necessary
* ~ -> prepended with login directory
* ~/ -> prepended with Pubdir
* default -> prepended with current directory
* file -> filename to expand
* returns:
* 0 -> ok
* FAIL -> no Wrkdir name available
*/
int
register char *file;
{
return(FAIL);
if (*file != '/')
if (*file == '~') {
/* find / and copy user part */
*up = '\0';
}
return(FAIL);
} else {
return(FAIL);
if (Wrkdir[0] == '\0')
return(FAIL);
}
return(FAIL);
} else
return(0);
}
/*
* make all necessary directories
* name -> directory to make
* mask -> mask to use during directory creation
* return:
* 0 -> success
* FAIL -> failure
*/
int
register char *name;
{
register char *p;
p = dir + 1;
for (;;) {
return(0);
*p = '\0';
/* if directory exists and is owned by uucp, child's
permissions should be no more open than parent */
} else {
return (FAIL);
}
}
*p++ = '/';
}
/* NOTREACHED */
}
/*
* expand file name and check return
* print error if it failed.
* file -> file name to check
* returns:
* 0 -> ok
* FAIL -> if expfile failed
*/
int
char *file;
{
return(0);
return(FAIL);
}
/*
* make canonical path out of path passed as argument.
*
* Eliminate redundant self-references like // or /./
* (A single terminal / will be preserved, however.)
* Dispose of references to .. in the path names.
* In relative path names, this means that .. or a/../..
* will be treated as an illegal reference.
* In full paths, .. is always allowed, with /.. treated as /
*
* returns:
* 0 -> path is now in canonical form
* FAIL -> relative path contained illegal .. reference
*/
int
register char *path; /* path is modified in place */
{
for (;;) {
/* skip past references to self and validate references to .. */
for (;;) {
if (*fr == '/') {
fr++;
continue;
}
fr++;
continue;
}
fr += 2;
/* /.. is / */
/* error if no previous component */
/* back past previous component */
continue;
}
break;
}
/*
* What follows is a legitimate component,
* terminated by a null or a /
*/
if (*fr == '\0') break;
}
/* null path is . */
*to = '\0';
return (0);
}