Index: bin/chflags/chflags.1 =================================================================== --- bin/chflags/chflags.1 +++ bin/chflags/chflags.1 @@ -208,7 +208,7 @@ In addition, these options override each other and the command's actions are determined by the last one specified. .Pp -You can use "ls -lo" to see the flags of existing files. +You can use "ls -lO" to see the flags of existing files. .Pp Note that the ability to change certain flags is dependent on the current kernel Index: bin/ls/ls.h =================================================================== --- bin/ls/ls.h +++ bin/ls/ls.h @@ -54,8 +54,10 @@ extern int f_samesort; /* sort time and name in same direction */ extern int f_sectime; /* print the real time for all files */ extern int f_size; /* list size in short listing */ +extern int f_sgroup; /* show the name of owning group */ extern int f_slash; /* append a '/' if the file is a directory */ extern int f_sortacross; /* sort across rows, not down columns */ +extern int f_sowner; /* show the owner's name */ extern int f_statustime; /* use time of last mode change */ extern int f_thousands; /* show file sizes with thousands separators */ extern char *f_timeformat; /* user-specified time format */ Index: bin/ls/ls.1 =================================================================== --- bin/ls/ls.1 +++ bin/ls/ls.1 @@ -162,6 +162,13 @@ This option cancels the .Fl P option. +.It Fl O +Include the file flags in a long +.Pq Fl l +output. +See +.Xr chflags 1 +for a list of file flags and their meanings. .It Fl P If argument is a symbolic link, list the link itself rather than the object the link references. @@ -301,14 +308,9 @@ .Fl s options. .It Fl g -This option has no effect. -It is only available for compatibility with -.Bx 4.3 , -where it was used to display the group name in the long +Display the long .Pq Fl l -format output. -This option is incompatible with -.St -p1003.1-2008 . +format output without the file owner's name or number. .It Fl h When used with the .Fl l @@ -339,14 +341,9 @@ .Pq Fl l output. .It Fl o -Include the file flags in a long +Display the long .Pq Fl l -output. -This option is incompatible with -.St -p1003.1-2008 . -See -.Xr chflags 1 -for a list of file flags and their meanings. +format output without the file's group name or number. .It Fl p Write a slash .Pq Ql / @@ -863,7 +860,7 @@ .Xr chflags 1 ) , and suffix each filename with a symbol representing its file type: .Pp -.Dl $ ls -lioF +.Dl $ ls -liOF .Pp List the files in .Pa /var/log , Index: bin/ls/ls.c =================================================================== --- bin/ls/ls.c +++ bin/ls/ls.c @@ -141,8 +141,10 @@ static int f_singlecol; /* use single column output */ int f_size; /* list size in short listing */ static int f_sizesort; + int f_sgroup; /* show the name of owning group */ int f_slash; /* similar to f_type, but only for dirs */ int f_sortacross; /* sort across rows, not down columns */ + int f_sowner; /* show owner's name */ int f_statustime; /* use time of last mode change */ static int f_stream; /* stream the output, separate with commas */ int f_thousands; /* show file sizes with thousands separators */ @@ -275,7 +277,7 @@ colorflag = COLORFLAG_AUTO; #endif while ((ch = getopt_long(argc, argv, - "+1ABCD:FGHILPRSTUWXZabcdfghiklmnopqrstuwxy,", long_opts, + "+1ABCD:FGHILOPRSTUWXZabcdfghiklmnopqrstuwxy,", long_opts, NULL)) != -1) { switch (ch) { /* @@ -373,6 +375,9 @@ fts_options |= FTS_LOGICAL; f_nofollow = 0; break; + case 'O': + f_flags = 1; + break; case 'P': fts_options &= ~FTS_COMFOLLOW; fts_options &= ~FTS_LOGICAL; @@ -401,7 +406,11 @@ f_listdir = 1; f_recursive = 0; break; - case 'g': /* Compatibility with 4.3BSD. */ + case 'g': + f_longform = 1; + f_singlecol = 0; + f_stream = 0; + f_sowner = 1; break; case 'h': f_humanval = 1; @@ -420,9 +429,16 @@ break; case 'n': f_numericonly = 1; + f_longform = 1; + f_singlecol = 0; + f_stream = 0; break; case 'o': - f_flags = 1; + f_longform = 1; + f_singlecol = 0; + f_stream = 0; + f_sgroup = 1; + (void)printf("The original function of the -o option is deprecated. Use -O to show file flags.\n"); break; case 'p': f_slash = 1; Index: bin/ls/print.c =================================================================== --- bin/ls/print.c +++ bin/ls/print.c @@ -234,9 +234,11 @@ strmode(sp->st_mode, buf); aclmode(buf, p); np = p->fts_pointer; - (void)printf("%s %*ju %-*s %-*s ", buf, dp->s_nlink, - (uintmax_t)sp->st_nlink, dp->s_user, np->user, dp->s_group, - np->group); + (void)printf("%s %*ju ", buf, dp->s_nlink,(uintmax_t)sp->st_nlink); + if (!f_sowner) + (void)printf("%-*s ", dp->s_user, np->user); + if (!f_sgroup) + (void)printf("%-*s ", dp->s_group, np->group); if (f_flags) (void)printf("%-*s ", dp->s_flags, np->flags); if (f_label) Index: bin/ls/tests/ls_tests.sh =================================================================== --- bin/ls/tests/ls_tests.sh +++ bin/ls/tests/ls_tests.sh @@ -696,7 +696,7 @@ atf_test_case o_flag o_flag_head() { - atf_set "descr" "Verify that the output from ls -o prints out the chflag values or '-' if none are set" + atf_set "descr" "Verify that the output from ls -O prints out the chflag values or '-' if none are set" } o_flag_body() @@ -713,9 +713,9 @@ atf_check -e empty -o empty -s exit:0 chflags 0 b.file atf_check -e empty -o match:"[[:space:]]+uarch[[:space:]]$size+.+a\\.file" \ - -s exit:0 ls -lo a.file + -s exit:0 ls -lO a.file atf_check -e empty -o match:"[[:space:]]+\\-[[:space:]]$size+.+b\\.file" \ - -s exit:0 ls -lo b.file + -s exit:0 ls -lO b.file } atf_test_case p_flag Index: bin/ls/util.c =================================================================== --- bin/ls/util.c +++ bin/ls/util.c @@ -227,9 +227,9 @@ { (void)fprintf(stderr, #ifdef COLORLS - "usage: ls [-ABCFGHILPRSTUWZabcdfghiklmnopqrstuwxy1,] [--color=when] [-D format]" + "usage: ls [-ABCFGHILOPRSTUWZabcdfghiklmnopqrstuwxy1,] [--color=when] [-D format]" #else - "usage: ls [-ABCFHILPRSTUWZabcdfghiklmnopqrstuwxy1,] [-D format]" + "usage: ls [-ABCFHILOPRSTUWZabcdfghiklmnopqrstuwxy1,] [-D format]" #endif " [file ...]\n"); exit(1); Index: share/skel/dot.shrc =================================================================== --- share/skel/dot.shrc +++ share/skel/dot.shrc @@ -22,7 +22,7 @@ alias h='fc -l' alias j=jobs alias m="$PAGER" -alias ll='ls -laFo' +alias ll='ls -laFO' alias l='ls -l' alias g='egrep -i'