From owner-p4-projects@FreeBSD.ORG Fri Feb 6 04:12:26 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id DF1EC16A4D0; Fri, 6 Feb 2004 04:12:25 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9FDEF16A4CE for ; Fri, 6 Feb 2004 04:12:25 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id D88D543D1D for ; Fri, 6 Feb 2004 04:12:17 -0800 (PST) (envelope-from cvance@nailabs.com) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.10/8.12.10) with ESMTP id i16CCH0B075901 for ; Fri, 6 Feb 2004 04:12:17 -0800 (PST) (envelope-from cvance@nailabs.com) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.10/8.12.10/Submit) id i16CCHQ9075898 for perforce@freebsd.org; Fri, 6 Feb 2004 04:12:17 -0800 (PST) (envelope-from cvance@nailabs.com) Date: Fri, 6 Feb 2004 04:12:17 -0800 (PST) Message-Id: <200402061212.i16CCHQ9075898@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to cvance@nailabs.com using -f From: Chris Vance To: Perforce Change Reviews Subject: PERFORCE change 46580 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Feb 2004 12:12:26 -0000 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)