From owner-p4-projects Thu Oct 3 9:51:47 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 063AB37B404; Thu, 3 Oct 2002 09:51:45 -0700 (PDT) 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 7283637B401 for ; Thu, 3 Oct 2002 09:51:44 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2762443E8A for ; Thu, 3 Oct 2002 09:51:44 -0700 (PDT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from freefall.freebsd.org (perforce@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id g93GphCo045422 for ; Thu, 3 Oct 2002 09:51:43 -0700 (PDT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id g93Gphme045409 for perforce@freebsd.org; Thu, 3 Oct 2002 09:51:43 -0700 (PDT) Date: Thu, 3 Oct 2002 09:51:43 -0700 (PDT) Message-Id: <200210031651.g93Gphme045409@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson Subject: PERFORCE change 18589 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG http://people.freebsd.org/~peter/p4db/chv.cgi?CH=18589 Change 18589 by rwatson@rwatson_paprika on 2002/10/03 09:50:42 Attempt to better approximate ls behavior in the presence of symlinks: don't follow links if the user has requested that statistics be generated for the links themselves, but do follow links if they haven't. Affected files ... .. //depot/projects/trustedbsd/mac/bin/ls/ls.c#13 edit Differences ... ==== //depot/projects/trustedbsd/mac/bin/ls/ls.c#13 (text+ko) ==== @@ -80,7 +80,7 @@ */ #define STRBUF_SIZEOF(t) (1 + CHAR_BIT * sizeof(t) / 3 + 1) -static void display(FTSENT *, FTSENT *); +static void display(FTSENT *, FTSENT *, int); static u_quad_t makenines(u_long); static int mastercmp(const FTSENT * const *, const FTSENT * const *); static void traverse(int, char **, int); @@ -440,7 +440,7 @@ fts_open(argv, options, f_nosort ? NULL : mastercmp)) == NULL) err(1, "fts_open"); - display(NULL, fts_children(ftsp, 0)); + display(NULL, fts_children(ftsp, 0), options); if (f_listdir) return; @@ -477,7 +477,7 @@ output = 1; } chp = fts_children(ftsp, ch_options); - display(p, chp); + display(p, chp, options); if (!f_recursive && chp != NULL) (void)fts_set(ftsp, p, FTS_SKIP); @@ -495,7 +495,7 @@ * points to the parent directory of the display list. */ static void -display(FTSENT *p, FTSENT *list) +display(FTSENT *p, FTSENT *list, int options) { struct stat *sp; DISPLAY d; @@ -693,16 +693,12 @@ goto label_out; } -#if 0 - if (S_ISLNK(sp->st_mode)) -#endif - error = mac_get_link( + if (options & FTS_LOGICAL) + error = mac_get_file( cur->fts_path, label); -#if 0 else - error = mac_get_file( + error = mac_get_link( cur->fts_name, label); -#endif if (error == -1) { perror(cur->fts_name); mac_free(label); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message