Date: Thu, 3 Oct 2002 09:51:43 -0700 (PDT) From: Robert Watson <rwatson@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 18589 for review Message-ID: <200210031651.g93Gphme045409@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200210031651.g93Gphme045409>