Deleted Added
full compact
print.c (61341) print.c (61814)
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

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

34 * SUCH DAMAGE.
35 */
36
37#ifndef lint
38#if 0
39static char sccsid[] = "@(#)print.c 8.4 (Berkeley) 4/17/94";
40#else
41static const char rcsid[] =
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

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

34 * SUCH DAMAGE.
35 */
36
37#ifndef lint
38#if 0
39static char sccsid[] = "@(#)print.c 8.4 (Berkeley) 4/17/94";
40#else
41static const char rcsid[] =
42 "$FreeBSD: head/bin/ls/print.c 61337 2000-06-06 12:44:29Z ache $";
42 "$FreeBSD: head/bin/ls/print.c 61814 2000-06-18 22:18:04Z joe $";
43#endif
44#endif /* not lint */
45
46#include <sys/param.h>
47#include <sys/stat.h>
48
49#include <err.h>
50#include <errno.h>

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

288 chcnt += printtype(sp->st_mode);
289 return (chcnt);
290}
291
292static void
293printtime(ftime)
294 time_t ftime;
295{
43#endif
44#endif /* not lint */
45
46#include <sys/param.h>
47#include <sys/stat.h>
48
49#include <err.h>
50#include <errno.h>

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

288 chcnt += printtype(sp->st_mode);
289 return (chcnt);
290}
291
292static void
293printtime(ftime)
294 time_t ftime;
295{
296 int i;
297 char longstring[80];
298 static time_t now;
296 char longstring[80];
297 static time_t now;
298 const char *format;
299
300 if (now == 0)
301 now = time(NULL);
302
299
300 if (now == 0)
301 now = time(NULL);
302
303 strftime(longstring, sizeof(longstring), "%c", localtime(&ftime));
304 for (i = 4; i < 11; ++i)
305 (void)putchar(longstring[i]);
306
307#define SIXMONTHS ((365 / 2) * 86400)
308 if (f_sectime)
303#define SIXMONTHS ((365 / 2) * 86400)
304 if (f_sectime)
309 for (i = 11; i < 24; i++)
310 (void)putchar(longstring[i]);
305 /* Mmm dd hh:mm:ss yyyy */
306 format = "%b %e %T %Y ";
311 else if (ftime + SIXMONTHS > now && ftime < now + SIXMONTHS)
307 else if (ftime + SIXMONTHS > now && ftime < now + SIXMONTHS)
312 for (i = 11; i < 16; ++i)
313 (void)putchar(longstring[i]);
314 else {
315 (void)putchar(' ');
316 for (i = 20; i < 24; ++i)
317 (void)putchar(longstring[i]);
318 }
319 (void)putchar(' ');
308 /* Mmm dd hh:mm */
309 format = "%b %e %R ";
310 else
311 /* Mmm dd yyyy */
312 format = "%b %e %Y ";
313 strftime(longstring, sizeof(longstring), format, localtime(&ftime));
314 fputs(longstring, stdout);
320}
321
322static int
323printtype(mode)
324 u_int mode;
325{
326 switch (mode & S_IFMT) {
327 case S_IFDIR:

--- 177 unchanged lines hidden ---
315}
316
317static int
318printtype(mode)
319 u_int mode;
320{
321 switch (mode & S_IFMT) {
322 case S_IFDIR:

--- 177 unchanged lines hidden ---