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

(-)ls.c (-3 / +17 lines)
Lines 100-105 Link Here
100
int f_timesort;			/* sort by time vice name */
100
int f_timesort;			/* sort by time vice name */
101
int f_type;			/* add type character for non-regular files */
101
int f_type;			/* add type character for non-regular files */
102
int f_whiteout;			/* show whiteout entries */
102
int f_whiteout;			/* show whiteout entries */
103
int f_numbers;			/* show uid/gid numbers rather than names */
103
104
104
int rval;
105
int rval;
105
106
Lines 137-143 Link Here
137
		f_listdot = 1;
138
		f_listdot = 1;
138
139
139
	fts_options = FTS_PHYSICAL;
140
	fts_options = FTS_PHYSICAL;
140
	while ((ch = getopt(argc, argv, "1ABCFHLPRTWabcdfgikloqrstu")) != -1) {
141
	while ((ch = getopt(argc, argv, "1ABCFHLPRTWabcdfgiklnoqrstu")) != -1) {
141
		switch (ch) {
142
		switch (ch) {
142
		/*
143
		/*
143
		 * The -1, -C and -l options all override each other so shell
144
		 * The -1, -C and -l options all override each other so shell
Lines 209-214 Link Here
209
		case 'k':
210
		case 'k':
210
			f_kblocks = 1;
211
			f_kblocks = 1;
211
			break;
212
			break;
213
		case 'n':
214
			f_numbers = 1;
215
			break;
212
		case 'o':
216
		case 'o':
213
			f_flags = 1;
217
			f_flags = 1;
214
			break;
218
			break;
Lines 401-406 Link Here
401
	char *initmax;
405
	char *initmax;
402
	int entries, needstats;
406
	int entries, needstats;
403
	char *user, *group, *flags, buf[20];	/* 32 bits == 10 digits */
407
	char *user, *group, *flags, buf[20];	/* 32 bits == 10 digits */
408
	char user_num[8], group_num[8];
404
409
405
	/*
410
	/*
406
	 * If list is NULL there are two possibilities: that the parent
411
	 * If list is NULL there are two possibilities: that the parent
Lines 512-521 Link Here
512
517
513
			btotal += sp->st_blocks;
518
			btotal += sp->st_blocks;
514
			if (f_longform) {
519
			if (f_longform) {
515
				user = user_from_uid(sp->st_uid, 0);
520
				if (f_numbers) {
521
					snprintf(user_num, sizeof(user_num),
522
					    "%d", sp->st_uid);
523
					user = user_num;
524
					snprintf(group_num, sizeof(group_num),
525
					    "%d", sp->st_gid);
526
					group = user_num;
527
				} else {
528
					user = user_from_uid(sp->st_uid, 0);
529
					group = group_from_gid(sp->st_gid, 0);
530
				}
516
				if ((ulen = strlen(user)) > maxuser)
531
				if ((ulen = strlen(user)) > maxuser)
517
					maxuser = ulen;
532
					maxuser = ulen;
518
				group = group_from_gid(sp->st_gid, 0);
519
				if ((glen = strlen(group)) > maxgroup)
533
				if ((glen = strlen(group)) > maxgroup)
520
					maxgroup = glen;
534
					maxgroup = glen;
521
				if (f_flags) {
535
				if (f_flags) {

Return to bug 12866