View | Details | Raw Unified | Return to bug 81625
Collapse All | Expand All

(-)cmp.c (+16 lines)
Lines 139-141 Link Here
139
139
140
	return (statcmp(b, a));
140
	return (statcmp(b, a));
141
}
141
}
142
143
int
144
sizecmp(const FTSENT *a, const FTSENT *b)
145
{
146
	if (b->fts_statp->st_size > a->fts_statp->st_size)
147
		return (-1);
148
	if (b->fts_statp->st_size < a->fts_statp->st_size)
149
		return (1);
150
	return (strcoll(a->fts_name, b->fts_name));
151
}
152
153
int
154
revsizecmp(const FTSENT *a, const FTSENT *b)
155
{
156
	return (sizecmp(b, a));
157
}
(-)extern.h (+2 lines)
Lines 38-43 Link Here
38
int	 revnamecmp(const FTSENT *, const FTSENT *);
38
int	 revnamecmp(const FTSENT *, const FTSENT *);
39
int	 statcmp(const FTSENT *, const FTSENT *);
39
int	 statcmp(const FTSENT *, const FTSENT *);
40
int	 revstatcmp(const FTSENT *, const FTSENT *);
40
int	 revstatcmp(const FTSENT *, const FTSENT *);
41
int	 sizecmp(const FTSENT *, const FTSENT *);
42
int	 revsizecmp(const FTSENT *, const FTSENT *);
41
43
42
void	 printcol(const DISPLAY *);
44
void	 printcol(const DISPLAY *);
43
void	 printlong(const DISPLAY *);
45
void	 printlong(const DISPLAY *);
(-)ls.1 (-3 / +4 lines)
Lines 40-46 Link Here
40
.Nd list directory contents
40
.Nd list directory contents
41
.Sh SYNOPSIS
41
.Sh SYNOPSIS
42
.Nm
42
.Nm
43
.Op Fl ABCFGHLPRTWZabcdfghiklmnopqrstuwx1
43
.Op Fl ABCFGHLPRSTWZabcdfghiklmnopqrstuwx1
44
.Op Ar
44
.Op Ar
45
.Sh DESCRIPTION
45
.Sh DESCRIPTION
46
For each operand that names a
46
For each operand that names a
Lines 133-138 Link Here
133
options.
133
options.
134
.It Fl R
134
.It Fl R
135
Recursively list subdirectories encountered.
135
Recursively list subdirectories encountered.
136
.It Fl S
137
Sort by size (before sorting
136
.It Fl T
138
.It Fl T
137
When used with the
139
When used with the
138
.Fl l
140
.Fl l
Lines 221-228 Link Here
221
.Ql \&? ;
223
.Ql \&? ;
222
this is the default when output is to a terminal.
224
this is the default when output is to a terminal.
223
.It Fl r
225
.It Fl r
224
Reverse the order of the sort to get reverse
226
Reverse the order of the sort.
225
lexicographical order or the oldest entries first.
226
.It Fl s
227
.It Fl s
227
Display the number of file system blocks actually used by each file, in units
228
Display the number of file system blocks actually used by each file, in units
228
of 512 bytes, where partial units are rounded up to the next integer value.
229
of 512 bytes, where partial units are rounded up to the next integer value.
(-)ls.c (-3 / +9 lines)
Lines 127-132 Link Here
127
       int f_statustime;	/* use time of last mode change */
127
       int f_statustime;	/* use time of last mode change */
128
static int f_stream;		/* stream the output, separate with commas */
128
static int f_stream;		/* stream the output, separate with commas */
129
static int f_timesort;		/* sort by time vice name */
129
static int f_timesort;		/* sort by time vice name */
130
static int f_sizesort;
130
       int f_type;		/* add type character for non-regular files */
131
       int f_type;		/* add type character for non-regular files */
131
static int f_whiteout;		/* show whiteout entries */
132
static int f_whiteout;		/* show whiteout entries */
132
       int f_label;		/* show MAC label */
133
       int f_label;		/* show MAC label */
Lines 179-185 Link Here
179
		f_listdot = 1;
180
		f_listdot = 1;
180
181
181
	fts_options = FTS_PHYSICAL;
182
	fts_options = FTS_PHYSICAL;
182
 	while ((ch = getopt(argc, argv, "1ABCFGHLPRTWZabcdfghiklmnopqrstuwx")) 
183
 	while ((ch = getopt(argc, argv, "1ABCFGHLPRSTWZabcdfghiklmnopqrstuwx"))
183
	    != -1) {
184
	    != -1) {
184
		switch (ch) {
185
		switch (ch) {
185
		/*
186
		/*
Lines 298-303 Link Here
298
		case 't':
299
		case 't':
299
			f_timesort = 1;
300
			f_timesort = 1;
300
			break;
301
			break;
302
		case 'S':
303
			f_sizesort = 1;
304
			break;
301
		case 'W':
305
		case 'W':
302
			f_whiteout = 1;
306
			f_whiteout = 1;
303
			break;
307
			break;
Lines 360-370 Link Here
360
#endif
364
#endif
361
365
362
	/*
366
	/*
363
	 * If not -F, -i, -l, -s or -t options, don't require stat
367
	 * If not -F, -i, -l, -s, -S or -t options, don't require stat
364
	 * information, unless in color mode in which case we do
368
	 * information, unless in color mode in which case we do
365
	 * need this to determine which colors to display.
369
	 * need this to determine which colors to display.
366
	 */
370
	 */
367
	if (!f_inode && !f_longform && !f_size && !f_timesort && !f_type
371
	if (!f_inode && !f_longform && !f_size && !f_timesort && !f_sizesort && !f_type
368
#ifdef COLORLS
372
#ifdef COLORLS
369
	    && !f_color
373
	    && !f_color
370
#endif
374
#endif
Lines 405-410 Link Here
405
			sortfcn = revstatcmp;
409
			sortfcn = revstatcmp;
406
		else		/* Use modification time. */
410
		else		/* Use modification time. */
407
			sortfcn = revmodcmp;
411
			sortfcn = revmodcmp;
412
		if (f_sizesort) sortfcn = revsizecmp;
408
	} else {
413
	} else {
409
		if (!f_timesort)
414
		if (!f_timesort)
410
			sortfcn = namecmp;
415
			sortfcn = namecmp;
Lines 414-419 Link Here
414
			sortfcn = statcmp;
419
			sortfcn = statcmp;
415
		else		/* Use modification time. */
420
		else		/* Use modification time. */
416
			sortfcn = modcmp;
421
			sortfcn = modcmp;
422
		if (f_sizesort) sortfcn = sizecmp;
417
	}
423
	}
418
424
419
	/* Select a print function. */
425
	/* Select a print function. */

Return to bug 81625