Deleted Added
full compact
ls.c (242807) ls.c (242840)
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

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

37#endif /* not lint */
38
39#if 0
40#ifndef lint
41static char sccsid[] = "@(#)ls.c 8.5 (Berkeley) 4/2/94";
42#endif /* not lint */
43#endif
44#include <sys/cdefs.h>
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

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

37#endif /* not lint */
38
39#if 0
40#ifndef lint
41static char sccsid[] = "@(#)ls.c 8.5 (Berkeley) 4/2/94";
42#endif /* not lint */
43#endif
44#include <sys/cdefs.h>
45__FBSDID("$FreeBSD: head/bin/ls/ls.c 242807 2012-11-08 23:45:19Z grog $");
45__FBSDID("$FreeBSD: head/bin/ls/ls.c 242840 2012-11-09 20:19:56Z peter $");
46
47#include <sys/param.h>
48#include <sys/stat.h>
49#include <sys/ioctl.h>
50#include <sys/mac.h>
51
52#include <dirent.h>
53#include <err.h>

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

73/*
74 * Upward approximation of the maximum number of characters needed to
75 * represent a value of integral type t as a string, excluding the
76 * NUL terminator, with provision for a sign.
77 */
78#define STRBUF_SIZEOF(t) (1 + CHAR_BIT * sizeof(t) / 3 + 1)
79
80/*
46
47#include <sys/param.h>
48#include <sys/stat.h>
49#include <sys/ioctl.h>
50#include <sys/mac.h>
51
52#include <dirent.h>
53#include <err.h>

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

73/*
74 * Upward approximation of the maximum number of characters needed to
75 * represent a value of integral type t as a string, excluding the
76 * NUL terminator, with provision for a sign.
77 */
78#define STRBUF_SIZEOF(t) (1 + CHAR_BIT * sizeof(t) / 3 + 1)
79
80/*
81 * MAKENINES(n) turns n into (10**n)-1. This is useful for converting a width
81 * MAKENINES(n) turns n into (10**n)-1. This is useful for converting a width
82 * into a number that wide in decimal.
83 * XXX: Overflows are not considered.
84 */
85#define MAKENINES(n) \
86 do { \
87 intmax_t i; \
88 \
89 /* Use a loop as all values of n are small. */ \

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

236 case 'S':
237 f_sizesort = 1;
238 f_timesort = 0;
239 break;
240 case 't':
241 f_timesort = 1;
242 f_sizesort = 0;
243 break;
82 * into a number that wide in decimal.
83 * XXX: Overflows are not considered.
84 */
85#define MAKENINES(n) \
86 do { \
87 intmax_t i; \
88 \
89 /* Use a loop as all values of n are small. */ \

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

236 case 'S':
237 f_sizesort = 1;
238 f_timesort = 0;
239 break;
240 case 't':
241 f_timesort = 1;
242 f_sizesort = 0;
243 break;
244 /* Other flags. Please keep alphabetic. */
244 /* Other flags. Please keep alphabetic. */
245 case ',':
246 f_thousands = 1;
247 break;
248 case 'B':
249 f_nonprint = 0;
250 f_octal = 1;
251 f_octal_escape = 0;
252 break;

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

529 break;
530 case FTS_D:
531 if (p->fts_level != FTS_ROOTLEVEL &&
532 p->fts_name[0] == '.' && !f_listdot)
533 break;
534
535 /*
536 * If already output something, put out a newline as
245 case ',':
246 f_thousands = 1;
247 break;
248 case 'B':
249 f_nonprint = 0;
250 f_octal = 1;
251 f_octal_escape = 0;
252 break;

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

529 break;
530 case FTS_D:
531 if (p->fts_level != FTS_ROOTLEVEL &&
532 p->fts_name[0] == '.' && !f_listdot)
533 break;
534
535 /*
536 * If already output something, put out a newline as
537 * a separator. If multiple arguments, precede each
537 * a separator. If multiple arguments, precede each
538 * directory with its name.
539 */
540 if (output) {
541 putchar('\n');
542 (void)printname(p->fts_path);
543 puts(":");
544 } else if (argc > 1) {
545 (void)printname(p->fts_path);

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

869 if (f_longform)
870 for (cur = list; cur; cur = cur->fts_link)
871 free(cur->fts_pointer);
872}
873
874/*
875 * Ordering for mastercmp:
876 * If ordering the argv (fts_level = FTS_ROOTLEVEL) return non-directories
538 * directory with its name.
539 */
540 if (output) {
541 putchar('\n');
542 (void)printname(p->fts_path);
543 puts(":");
544 } else if (argc > 1) {
545 (void)printname(p->fts_path);

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

869 if (f_longform)
870 for (cur = list; cur; cur = cur->fts_link)
871 free(cur->fts_pointer);
872}
873
874/*
875 * Ordering for mastercmp:
876 * If ordering the argv (fts_level = FTS_ROOTLEVEL) return non-directories
877 * as larger than directories. Within either group, use the sort function.
877 * as larger than directories. Within either group, use the sort function.
878 * All other levels use the sort function. Error entries remain unsorted.
879 */
880static int
881mastercmp(const FTSENT * const *a, const FTSENT * const *b)
882{
883 int a_info, b_info;
884
885 a_info = (*a)->fts_info;

--- 18 unchanged lines hidden ---
878 * All other levels use the sort function. Error entries remain unsorted.
879 */
880static int
881mastercmp(const FTSENT * const *a, const FTSENT * const *b)
882{
883 int a_info, b_info;
884
885 a_info = (*a)->fts_info;

--- 18 unchanged lines hidden ---