/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1982-2007 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* David Korn <dgk@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
static const char usage[] =
"[-?\n@(#)$Id: readlink (AT&T Research) 2008-06-08 $\n]"
"[+NAME?readlink - read the contents of a symbolic link]"
"[+DESCRIPTION?\breadlink\b returns the contents of the symbolic "
"link referred to by the path argument. Unless the \b-f\b "
"option is specified an error will be returned when the path "
"is not a symbolic link.]"
"[f:canonicalize?The returned value will be an absolute pathname that names "
"the same file, whose resolution does not involve \".\", \"..\", or "
"symbolic links, otherwise only the exact (relative) value will be returned.]"
"[n:no-newline?Supress newline at the end.]"
"[v:verbose?Verbose - print errors.]"
"[+SEE ALSO?\bbasename\b(1),\bdirname\b(2),\breadlink\b(2),\breadpath\n(2)]"
;
#include <cmd.h>
int
{
register char* s;
register int i;
register char* m;
register char* x;
int canonicalize = 0,
nonewline = 0,
verbose = 0;
int len = 0;
char *filename,
for (;;)
{
{
case 'f':
continue;
case 'n':
continue;
case 'v':
continue;
case '?':
continue;
case ':':
continue;
}
break;
}
if (canonicalize)
{
}
else
{
}
if (len != -1)
resolvedname = buf;
if (!resolvedname)
{
if (verbose)
else
return 1;
}
if (!nonewline)
return 0;
}