Date: Fri, 6 Feb 2004 04:12:17 -0800 (PST) From: Chris Vance <cvance@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 46580 for review Message-ID: <200402061212.i16CCHQ9075898@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=46580 Change 46580 by cvance@cvance_sony on 2004/02/06 04:12:15 Copy modifications from the SEBSD branch - allow the -Z flag to work without requiring the long output format. Affected files ... .. //depot/projects/trustedbsd/mac/bin/ls/ls.c#28 edit .. //depot/projects/trustedbsd/mac/bin/ls/print.c#20 edit Differences ... ==== //depot/projects/trustedbsd/mac/bin/ls/ls.c#28 (text+ko) ==== @@ -368,7 +368,7 @@ * information, unless in color mode in which case we do * need this to determine which colors to display. */ - if (!f_inode && !f_longform && !f_size && !f_timesort && !f_type + if (!f_inode && !f_longform && !f_size && !f_timesort && !f_type && !f_label #ifdef COLORLS && !f_color #endif @@ -421,7 +421,7 @@ } /* Select a print function. */ - if (f_singlecol) + if (f_singlecol || (f_label && !f_longform)) printfcn = printscol; else if (f_longform) printfcn = printlong; @@ -547,7 +547,7 @@ if (list == NULL) return; - needstats = f_inode || f_longform || f_size; + needstats = f_inode || f_longform || f_size || f_label; flen = 0; btotal = 0; initmax = getenv("LS_COLWIDTHS"); @@ -673,7 +673,7 @@ maxsize = sp->st_size; btotal += sp->st_blocks; - if (f_longform) { + if (f_longform || f_label) { if (f_numericonly) { (void)snprintf(nuser, sizeof(nuser), "%u", sp->st_uid); @@ -812,7 +812,7 @@ printfcn(&d); output = 1; - if (f_longform) + if (f_longform || f_label) for (cur = list; cur; cur = cur->fts_link) free(cur->fts_pointer); } ==== //depot/projects/trustedbsd/mac/bin/ls/print.c#20 (text+ko) ==== @@ -65,7 +65,7 @@ #include "ls.h" #include "extern.h" -static int printaname(const FTSENT *, u_long, u_long); +static int printaname(const FTSENT *, u_long, u_long, u_long); static void printlink(const FTSENT *); static void printtime(time_t); static int printtype(u_int); @@ -135,7 +135,7 @@ for (p = dp->list; p; p = p->fts_link) { if (IS_NOPRINT(p)) continue; - (void)printaname(p, dp->s_inode, dp->s_block); + (void)printaname(p, dp->s_label, dp->s_inode, dp->s_block); (void)putchar('\n'); } } @@ -248,7 +248,7 @@ putchar('\n'); chcnt = 0; } - chcnt += printaname(p, dp->s_inode, dp->s_block); + chcnt += printaname(p, dp->s_label, dp->s_inode, dp->s_block); if (p->fts_link) { printf(", "); chcnt += 2; @@ -327,8 +327,8 @@ if (!f_sortacross) base = row; for (col = 0, chcnt = 0; col < numcols; ++col) { - chcnt += printaname(array[base], dp->s_inode, - dp->s_block); + chcnt += printaname(array[base], dp->s_label, + dp->s_inode, dp->s_block); if (f_sortacross) base++; else @@ -353,9 +353,11 @@ * return # of characters printed, no trailing characters. */ static int -printaname(const FTSENT *p, u_long inodefield, u_long sizefield) +printaname(const FTSENT *p, u_long labelfield, u_long inodefield, + u_long sizefield) { struct stat *sp; + NAMES *np; int chcnt; #ifdef COLORLS int color_printed = 0; @@ -363,6 +365,10 @@ sp = p->fts_statp; chcnt = 0; + if (f_label) { + np = p->fts_pointer; + chcnt += printf("%-*s ", (int)labelfield, np->label); + } if (f_inode) chcnt += printf("%*lu ", (int)inodefield, (u_long)sp->st_ino); if (f_size)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200402061212.i16CCHQ9075898>