files. (Jan-Simon has *way* too much free time...)
SCCS-vsn: bin/ls/ls.c 5.67
SCCS-vsn: bin/ls/ls.h 5.18
SCCS-vsn: bin/ls/print.c 5.36
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)ls.c 5.66 (Berkeley) %G%";
+static char sccsid[] = "@(#)ls.c 5.67 (Berkeley) %G%";
#endif /* not lint */
#include <sys/types.h>
#endif /* not lint */
#include <sys/types.h>
- * Display() takes a linked list of FTSENT structures passes the list along
- * with any other necessary information to the print function (printfcn()).
- * P points to the parent directory of the display list.
+ * Display() takes a linked list of FTSENT structures and passes the list
+ * along with any other necessary information to the print function. P
+ * points to the parent directory of the display list.
*/
static void
display(p, list)
*/
static void
display(p, list)
NAMES *np;
u_long btotal, maxblock, maxinode, maxlen, maxnlink;
u_quad_t maxsize;
NAMES *np;
u_long btotal, maxblock, maxinode, maxlen, maxnlink;
u_quad_t maxsize;
- int flen, glen, ulen, maxflags, maxgroup, maxuser;
+ int bcfile, flen, glen, ulen, maxflags, maxgroup, maxuser;
int entries, needstats;
char *user, *group, *flags, buf[20]; /* 32 bits == 10 digits */
int entries, needstats;
char *user, *group, *flags, buf[20]; /* 32 bits == 10 digits */
needstats = f_inode || f_longform || f_size;
flen = 0;
btotal = maxblock = maxinode = maxlen = maxnlink = 0;
needstats = f_inode || f_longform || f_size;
flen = 0;
btotal = maxblock = maxinode = maxlen = maxnlink = 0;
maxuser = maxgroup = maxflags = 0;
maxsize = 0;
for (cur = list, entries = 0; cur; cur = cur->fts_link) {
maxuser = maxgroup = maxflags = 0;
maxsize = 0;
for (cur = list, entries = 0; cur; cur = cur->fts_link) {
np->group = &np->data[ulen + 1];
(void)strcpy(np->group, group);
np->group = &np->data[ulen + 1];
(void)strcpy(np->group, group);
+ if (S_ISCHR(sp->st_mode) ||
+ S_ISBLK(sp->st_mode))
+ bcfile = 1;
+
if (f_flags) {
np->flags = &np->data[ulen + glen + 2];
(void)strcpy(np->flags, flags);
if (f_flags) {
np->flags = &np->data[ulen + glen + 2];
(void)strcpy(np->flags, flags);
d.entries = entries;
d.maxlen = maxlen;
if (needstats) {
d.entries = entries;
d.maxlen = maxlen;
if (needstats) {
d.btotal = btotal;
d.s_block = snprintf(buf, sizeof(buf), "%lu", maxblock);
d.s_flags = maxflags;
d.btotal = btotal;
d.s_block = snprintf(buf, sizeof(buf), "%lu", maxblock);
d.s_flags = maxflags;
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)ls.h 5.17 (Berkeley) %G%
+ * @(#)ls.h 5.18 (Berkeley) %G%
typedef struct {
FTSENT *list;
u_long btotal;
typedef struct {
FTSENT *list;
u_long btotal;
int entries;
int maxlen;
int s_block;
int entries;
int maxlen;
int s_block;
-static char sccsid[] = "@(#)print.c 5.35 (Berkeley) %G%";
+static char sccsid[] = "@(#)print.c 5.36 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
if (S_ISCHR(sp->st_mode) || S_ISBLK(sp->st_mode))
(void)printf("%3d, %3d ",
major(sp->st_rdev), minor(sp->st_rdev));
if (S_ISCHR(sp->st_mode) || S_ISBLK(sp->st_mode))
(void)printf("%3d, %3d ",
major(sp->st_rdev), minor(sp->st_rdev));
+ else if (dp->bcfile)
+ (void)printf("%*s%*qd ",
+ 8 - dp->s_size, "", dp->s_size, sp->st_size);
else
(void)printf("%*qd ", dp->s_size, sp->st_size);
if (f_accesstime)
else
(void)printf("%*qd ", dp->s_size, sp->st_size);
if (f_accesstime)