Deleted Added
sdiff udiff text old ( 196773 ) new ( 202945 )
full compact
1/*-
2 * Copyright (c) 1989, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Michael Fischbein.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 22 unchanged lines hidden (view full) ---

31 */
32
33#if 0
34#ifndef lint
35static char sccsid[] = "@(#)print.c 8.4 (Berkeley) 4/17/94";
36#endif /* not lint */
37#endif
38#include <sys/cdefs.h>
39__FBSDID("$FreeBSD: head/bin/ls/print.c 196773 2009-09-02 20:50:39Z trasz $");
40
41#include <sys/param.h>
42#include <sys/stat.h>
43#include <sys/acl.h>
44
45#include <err.h>
46#include <errno.h>
47#include <fts.h>

--- 9 unchanged lines hidden (view full) ---

57#include <termcap.h>
58#include <signal.h>
59#endif
60
61#include "ls.h"
62#include "extern.h"
63
64static int printaname(const FTSENT *, u_long, u_long);
65static void printlink(const FTSENT *);
66static void printtime(time_t);
67static int printtype(u_int);
68static void printsize(size_t, off_t);
69#ifdef COLORLS
70static void endcolor(int);
71static int colortype(mode_t);
72#endif

--- 87 unchanged lines hidden (view full) ---

160 (void)printf("%s %*u %-*s %-*s ", buf, dp->s_nlink,
161 sp->st_nlink, dp->s_user, np->user, dp->s_group,
162 np->group);
163 if (f_flags)
164 (void)printf("%-*s ", dp->s_flags, np->flags);
165 if (f_label)
166 (void)printf("%-*s ", dp->s_label, np->label);
167 if (S_ISCHR(sp->st_mode) || S_ISBLK(sp->st_mode))
168 if (minor(sp->st_rdev) > 255 || minor(sp->st_rdev) < 0)
169 (void)printf("%3d, 0x%08x ",
170 major(sp->st_rdev),
171 (u_int)minor(sp->st_rdev));
172 else
173 (void)printf("%3d, %3d ",
174 major(sp->st_rdev), minor(sp->st_rdev));
175 else if (dp->bcfile)
176 (void)printf("%*s%*jd ",
177 8 - dp->s_size, "", dp->s_size, sp->st_size);
178 else
179 printsize(dp->s_size, sp->st_size);
180 if (f_accesstime)
181 printtime(sp->st_atime);
182 else if (f_birthtime)
183 printtime(sp->st_birthtime);
184 else if (f_statustime)
185 printtime(sp->st_ctime);

--- 162 unchanged lines hidden (view full) ---

348 if (f_color && color_printed)
349 endcolor(0);
350#endif
351 if (f_type)
352 chcnt += printtype(sp->st_mode);
353 return (chcnt);
354}
355
356static void
357printtime(time_t ftime)
358{
359 char longstring[80];
360 static time_t now = 0;
361 const char *format;
362 static int d_first = -1;
363
364 if (d_first < 0)

--- 222 unchanged lines hidden (view full) ---

587 (void)printname(path);
588}
589
590static void
591printsize(size_t width, off_t bytes)
592{
593
594 if (f_humanval) {
595 char buf[5];
596
597 humanize_number(buf, sizeof(buf), (int64_t)bytes, "",
598 HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL);
599 (void)printf("%5s ", buf);
600 } else
601 (void)printf("%*jd ", (u_int)width, bytes);
602}
603
604/*
605 * Add a + after the standard rwxrwxrwx mode if the file has an
606 * ACL. strmode() reserves space at the end of the string.
607 */

--- 66 unchanged lines hidden ---