/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1985-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* David Korn <dgk@research.att.com> *
* Phong Vo <kpv@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* Glenn Fowler
* AT&T Bell Laboratories
*
* ls formatter
*/
#include <ast.h>
#include <ls.h>
#include <tm.h>
#ifndef LS_W_MAX
#endif
/*
* ls formatter
*
* buf results placed here
* name file name
* st file stat buffer
* info optional info
* link link text if != 0
* flags LS_* flags
*
* return end of formatted buf
*/
char*
fmtls(char* buf, const char* name, register struct stat* st, const char* info, const char* link, register int flags)
{
register char* s;
Sfoff_t n;
s = buf;
if (flags & LS_INUMBER)
{
}
{
s += sfsprintf(s, LS_W_MAX, "%s%3u", fmtmode(st->st_mode, flags & LS_EXTERNAL), (unsigned int)st->st_nlink);
{
else
}
if (!(flags & LS_NOGROUP))
{
else
}
else
*s++ = ' ';
}
if (info)
{
while (*s = *info++)
s++;
*s++ = ' ';
}
while (*s = *name++)
s++;
{
*s++ = '/';
#ifdef S_ISLNK
*s++ = '@';
#endif
*s++ = '*';
}
if (link)
{
#ifdef S_ISLNK
#endif
"==", link);
}
*s = 0;
return s;
}