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 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{ |
296 char longstring[80]; 297 static time_t now; |
298 const char *format; |
299 300 if (now == 0) 301 now = time(NULL); 302 |
303#define SIXMONTHS ((365 / 2) * 86400) 304 if (f_sectime) |
305 /* Mmm dd hh:mm:ss yyyy */ 306 format = "%b %e %T %Y "; |
307 else if (ftime + SIXMONTHS > now && ftime < now + SIXMONTHS) |
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); |
315} 316 317static int 318printtype(mode) 319 u_int mode; 320{ 321 switch (mode & S_IFMT) { 322 case S_IFDIR: --- 177 unchanged lines hidden --- |