make -g behave as it should according to SUSv3 (long listing without
owner). ok'd by kleink@.
This commit is contained in:
parent
40414b8e25
commit
75d0e9d0c0
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: ls.1,v 1.38 2003/02/25 10:34:39 wiz Exp $
|
||||
.\" $NetBSD: ls.1,v 1.39 2003/05/07 13:00:24 grant Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1980, 1990, 1991, 1993, 1994
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@ -36,7 +36,7 @@
|
||||
.\"
|
||||
.\" @(#)ls.1 8.7 (Berkeley) 7/29/94
|
||||
.\"
|
||||
.Dd January 3, 1998
|
||||
.Dd May 7, 2003
|
||||
.Dt LS 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -127,8 +127,9 @@ symbolic links in the argument list are not indirected through.
|
||||
.It Fl f
|
||||
Output is not sorted.
|
||||
.It Fl g
|
||||
Does nothing; kept for compatibility with older versions of
|
||||
.Xr ls 1 .
|
||||
The same as
|
||||
.Fl l ,
|
||||
except that the owner is not printed.
|
||||
.It Fl i
|
||||
For each file, print the file's file serial number (inode number).
|
||||
.It Fl k
|
||||
|
10
bin/ls/ls.c
10
bin/ls/ls.c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ls.c,v 1.45 2002/09/27 12:01:51 simonb Exp $ */
|
||||
/* $NetBSD: ls.c,v 1.46 2003/05/07 13:00:24 grant Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993, 1994
|
||||
@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993, 1994\n\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)ls.c 8.7 (Berkeley) 8/5/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: ls.c,v 1.45 2002/09/27 12:01:51 simonb Exp $");
|
||||
__RCSID("$NetBSD: ls.c,v 1.46 2003/05/07 13:00:24 grant Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -91,6 +91,7 @@ int f_accesstime; /* use time of last access */
|
||||
int f_column; /* columnated format */
|
||||
int f_columnacross; /* columnated format, sorted across */
|
||||
int f_flags; /* show flags associated with a file */
|
||||
int f_grouponly; /* long listing without owner */
|
||||
int f_inode; /* print inode */
|
||||
int f_listdir; /* list actual directory, not contents */
|
||||
int f_listdot; /* list files beginning with . */
|
||||
@ -151,6 +152,9 @@ ls_main(int argc, char *argv[])
|
||||
f_columnacross = f_longform = f_singlecol = f_stream =
|
||||
0;
|
||||
break;
|
||||
/* The -g option implies -l */
|
||||
case 'g':
|
||||
f_grouponly = 1;
|
||||
case 'l':
|
||||
f_longform = 1;
|
||||
f_column = f_columnacross = f_singlecol = f_stream = 0;
|
||||
@ -197,8 +201,6 @@ ls_main(int argc, char *argv[])
|
||||
case 'f':
|
||||
f_nosort = 1;
|
||||
break;
|
||||
case 'g': /* Compatibility with 4.3BSD. */
|
||||
break;
|
||||
case 'i':
|
||||
f_inode = 1;
|
||||
break;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ls.h,v 1.11 2000/06/17 16:11:25 assar Exp $ */
|
||||
/* $NetBSD: ls.h,v 1.12 2003/05/07 13:00:24 grant Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -44,6 +44,7 @@ extern long blocksize; /* block size units */
|
||||
|
||||
extern int f_accesstime; /* use time of last access */
|
||||
extern int f_flags; /* show flags associated with a file */
|
||||
extern int f_grouponly; /* long listing without owner */
|
||||
extern int f_inode; /* print inode */
|
||||
extern int f_longform; /* long listing format */
|
||||
extern int f_sectime; /* print the real time for all files */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: print.c,v 1.33 2002/11/09 12:27:08 enami Exp $ */
|
||||
/* $NetBSD: print.c,v 1.34 2003/05/07 13:00:24 grant Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993, 1994
|
||||
@ -41,7 +41,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)print.c 8.5 (Berkeley) 7/28/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: print.c,v 1.33 2002/11/09 12:27:08 enami Exp $");
|
||||
__RCSID("$NetBSD: print.c,v 1.34 2003/05/07 13:00:24 grant Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -113,9 +113,11 @@ printlong(DISPLAY *dp)
|
||||
(long long)howmany(sp->st_blocks, blocksize));
|
||||
(void)strmode(sp->st_mode, buf);
|
||||
np = p->fts_pointer;
|
||||
(void)printf("%s %*lu %-*s %-*s ", buf, dp->s_nlink,
|
||||
(unsigned long)sp->st_nlink, dp->s_user, np->user,
|
||||
dp->s_group, np->group);
|
||||
(void)printf("%s %*lu ", buf, dp->s_nlink,
|
||||
(unsigned long)sp->st_nlink);
|
||||
if (!f_grouponly)
|
||||
(void)printf("%-*s ", dp->s_user, np->user);
|
||||
(void)printf("%-*s ", dp->s_group, np->group);
|
||||
if (f_flags)
|
||||
(void)printf("%-*s ", dp->s_flags, np->flags);
|
||||
if (S_ISCHR(sp->st_mode) || S_ISBLK(sp->st_mode))
|
||||
|
Loading…
Reference in New Issue
Block a user