pwd.c revision 4870e0a7381ec2ec57437062574e6ddc3dd48d7f
/*
* 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
*/
/*
* Copyright 2015 PALO, Richard.
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* UNIX shell
*/
#include "mac.h"
#include <errno.h>
#include <limits.h>
#include "defs.h"
#define DOT '.'
#define NULLCHAR '\0'
#define SLASH '/'
#define PARTLY 2
#ifdef __STDC__
extern const char longpwd[];
#else
extern char longpwd[];
#endif
extern char *getcwd();
void
{
unsigned char *pcwd;
unsigned char *pdir;
/* First remove extra /'s */
/* Now remove any .'s */
pdir++;
while (*pdir) { /* remove /./ by itself */
continue;
}
pdir++;
pdir++;
if (*pdir)
pdir++;
}
/* take care of trailing /. */
} else {
}
}
/* Remove extra /'s */
/* Now that the dir is canonicalized, process it */
return;
}
/* Absolute path */
}
else
{
/* Relative path */
return;
}
while (*dir) {
/* Parent directory, so backup one */
--pcwd;
;
pcwd++;
dir += 2;
dir++;
}
continue;
}
return;
}
return;
}
}
if (*dir) {
return;
}
}
}
return;
}
--pcwd;
/* Remove trailing / */
}
}
void
cwd2()
{
unsigned char *pcwd;
/* check if there are any symbolic links in pathname */
return;
while (*pcwd) {
char c;
do {
c = *pcwd++;
*pcwd = c;
return;
}
*pcwd = c;
if (c)
pcwd++;
}
} else
return;
}
/*
* check if ino's and dev's match; pathname could
* consist of symbolic links with ".."
*/
}
unsigned char *
cwdget()
{
cwd2();
}
return (cwdname);
}
/*
* Print the current working directory.
*/
void
cwdprint(void)
{
unsigned char *cp;
cwd2();
else
}
}
}
}
/*
* This routine will remove repeated slashes from string.
*/
static void
{
unsigned char *pstring;
while (*pstring) {
/* Remove repeated SLASH's */
continue;
}
pstring++;
}
--pstring;
/* Remove trailing / */
}
}