Subject: bin/13978: bin/ls with corrected style
To: None <gnats-bugs@gnats.netbsd.org>
From: Petri Koistinen <thoron@mb-u10ip029.mbnet.fi>
List: netbsd-bugs
Date: 09/16/2001 23:03:35
>Number:         13978
>Category:       bin
>Synopsis:       bin/ls with corrected style
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Sep 16 13:01:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Petri Koistinen
>Release:        NetBSD-current Sun Sep 16 23:01:05 EEST 2001
>Organization:
>Environment:
System: NetBSD mb-u10ip029.mbnet.fi 1.5Y NetBSD 1.5Y (SPEEDBALL) #4: Sun Sep 16 17:06:05 EEST 2001 thoron@legoland:/usr/src/sys/arch/amiga/compile/SPEEDBALL amiga
Architecture: m68k
Machine: amiga
>Description:
	Please apply attached patches for bin/ls program.
>How-To-Repeat:
>Fix:
Index: cmp.c
===================================================================
RCS file: /cvsroot/basesrc/bin/ls/cmp.c,v
retrieving revision 1.16
diff -u -r1.16 cmp.c
--- cmp.c	2000/07/29 03:46:14	1.16
+++ cmp.c	2001/09/16 19:54:52
@@ -1,4 +1,4 @@
-/*	$NetBSD: cmp.c,v 1.16 2000/07/29 03:46:14 lukem Exp $	*/
+/* $NetBSD: cmp.c,v 1.16 2000/07/29 03:46:14 lukem Exp $ */
 
 /*
  * Copyright (c) 1989, 1993
@@ -71,21 +71,18 @@
 int
 namecmp(const FTSENT *a, const FTSENT *b)
 {
-
 	return (strcmp(a->fts_name, b->fts_name));
 }
 
 int
 revnamecmp(const FTSENT *a, const FTSENT *b)
 {
-
 	return (strcmp(b->fts_name, a->fts_name));
 }
 
 int
 modcmp(const FTSENT *a, const FTSENT *b)
 {
-
 	if (b->fts_statp->st_mtime > a->fts_statp->st_mtime)
 		return (1);
 	else if (b->fts_statp->st_mtime < a->fts_statp->st_mtime)
@@ -101,7 +98,6 @@
 int
 revmodcmp(const FTSENT *a, const FTSENT *b)
 {
-
 	if (b->fts_statp->st_mtime > a->fts_statp->st_mtime)
 		return (-1);
 	else if (b->fts_statp->st_mtime < a->fts_statp->st_mtime)
@@ -117,7 +113,6 @@
 int
 acccmp(const FTSENT *a, const FTSENT *b)
 {
-
 	if (b->fts_statp->st_atime > a->fts_statp->st_atime)
 		return (1);
 	else if (b->fts_statp->st_atime < a->fts_statp->st_atime)
@@ -133,7 +128,6 @@
 int
 revacccmp(const FTSENT *a, const FTSENT *b)
 {
-
 	if (b->fts_statp->st_atime > a->fts_statp->st_atime)
 		return (-1);
 	else if (b->fts_statp->st_atime < a->fts_statp->st_atime)
@@ -149,7 +143,6 @@
 int
 statcmp(const FTSENT *a, const FTSENT *b)
 {
-
 	if (b->fts_statp->st_ctime > a->fts_statp->st_ctime)
 		return (1);
 	else if (b->fts_statp->st_ctime < a->fts_statp->st_ctime)
@@ -165,7 +158,6 @@
 int
 revstatcmp(const FTSENT *a, const FTSENT *b)
 {
-
 	if (b->fts_statp->st_ctime > a->fts_statp->st_ctime)
 		return (-1);
 	else if (b->fts_statp->st_ctime < a->fts_statp->st_ctime)
@@ -181,7 +173,6 @@
 int
 sizecmp(const FTSENT *a, const FTSENT *b)
 {
-
 	if (b->fts_statp->st_size > a->fts_statp->st_size)
 		return (1);
 	if (b->fts_statp->st_size < a->fts_statp->st_size)
@@ -193,7 +184,6 @@
 int
 revsizecmp(const FTSENT *a, const FTSENT *b)
 {
-
 	if (b->fts_statp->st_size > a->fts_statp->st_size)
 		return (-1);
 	if (b->fts_statp->st_size < a->fts_statp->st_size)
Index: extern.h
===================================================================
RCS file: /cvsroot/basesrc/bin/ls/extern.h,v
retrieving revision 1.13
diff -u -r1.13 extern.h
--- extern.h	2000/07/29 03:46:15	1.13
+++ extern.h	2001/09/16 19:54:52
@@ -1,4 +1,4 @@
-/*	$NetBSD: extern.h,v 1.13 2000/07/29 03:46:15 lukem Exp $	*/
+/* $NetBSD: extern.h,v 1.13 2000/07/29 03:46:15 lukem Exp $ */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -35,6 +35,9 @@
  *	@(#)extern.h	8.1 (Berkeley) 5/31/93
  */
 
+#ifndef _EXTERN_H_
+#define _EXTERN_H_
+
 int	 acccmp(const FTSENT *, const FTSENT *);
 int	 revacccmp(const FTSENT *, const FTSENT *);
 int	 modcmp(const FTSENT *, const FTSENT *);
@@ -57,3 +60,5 @@
 void	 usage(void);
 
 #include "stat_flags.h"
+
+#endif /* !_EXTERN_H_ */
Index: ls.c
===================================================================
RCS file: /cvsroot/basesrc/bin/ls/ls.c,v
retrieving revision 1.43
diff -u -r1.43 ls.c
--- ls.c	2000/07/29 03:46:15	1.43
+++ ls.c	2001/09/16 19:54:54
@@ -1,4 +1,4 @@
-/*	$NetBSD: ls.c,v 1.43 2000/07/29 03:46:15 lukem Exp $	*/
+/* $NetBSD: ls.c,v 1.43 2000/07/29 03:46:15 lukem Exp $ */
 
 /*
  * Copyright (c) 1989, 1993, 1994
@@ -58,14 +58,14 @@
 #include <err.h>
 #include <errno.h>
 #include <fts.h>
+#include <grp.h>
 #include <locale.h>
+#include <pwd.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
 #include <termios.h>
-#include <pwd.h>
-#include <grp.h>
+#include <unistd.h>
 
 #include "ls.h"
 #include "extern.h"
@@ -118,6 +118,7 @@
 	int kflag = 0;
 	const char *p;
 
+	setprogname(argv[0]);
 	setlocale(LC_ALL, "");
 
 	/* Terminal defaults to -Cq, non-terminal defaults to -1. */
Index: ls.h
===================================================================
RCS file: /cvsroot/basesrc/bin/ls/ls.h,v
retrieving revision 1.11
diff -u -r1.11 ls.h
--- ls.h	2000/06/17 16:11:25	1.11
+++ ls.h	2001/09/16 19:54:54
@@ -1,4 +1,4 @@
-/*	$NetBSD: ls.h,v 1.11 2000/06/17 16:11:25 assar Exp $	*/
+/* $NetBSD: ls.h,v 1.11 2000/06/17 16:11:25 assar Exp $ */
 
 /*
  * Copyright (c) 1989, 1993
@@ -38,6 +38,9 @@
  *	@(#)ls.h	8.1 (Berkeley) 5/31/93
  */
 
+#ifndef _LS_H_
+#define _LS_H_
+
 #define NO_PRINT	1
 
 extern long blocksize;		/* block size units */
@@ -75,3 +78,5 @@
 	char *flags;
 	char data[1];
 } NAMES;
+
+#endif /* !_LS_H_ */
Index: main.c
===================================================================
RCS file: /cvsroot/basesrc/bin/ls/main.c,v
retrieving revision 1.2
diff -u -r1.2 main.c
--- main.c	2000/07/29 03:46:15	1.2
+++ main.c	2001/09/16 19:54:54
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.2 2000/07/29 03:46:15 lukem Exp $	*/
+/* $NetBSD: main.c,v 1.2 2000/07/29 03:46:15 lukem Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -43,17 +43,17 @@
 #endif /* not lint */
 
 #include <sys/types.h>
+
 #include <fts.h>
 
 #include "ls.h"
 #include "extern.h"
 
-int	main(int, char *[]);
+int main(int, char *[]);
 
 int
 main(int argc, char *argv[])
 {
-
 	return (ls_main(argc, argv));
 	/* NOTREACHED */
 }
Index: print.c
===================================================================
RCS file: /cvsroot/basesrc/bin/ls/print.c,v
retrieving revision 1.31
diff -u -r1.31 print.c
--- print.c	2001/02/04 19:34:08	1.31
+++ print.c	2001/09/16 19:54:55
@@ -1,4 +1,4 @@
-/*	$NetBSD: print.c,v 1.31 2001/02/04 19:34:08 christos Exp $	*/
+/* $NetBSD: print.c,v 1.31 2001/02/04 19:34:08 christos Exp $ */
 
 /*
  * Copyright (c) 1989, 1993, 1994
Index: stat_flags.c
===================================================================
RCS file: /cvsroot/basesrc/bin/ls/stat_flags.c,v
retrieving revision 1.8
diff -u -r1.8 stat_flags.c
--- stat_flags.c	2000/07/29 03:46:15	1.8
+++ stat_flags.c	2001/09/16 19:54:55
@@ -1,4 +1,4 @@
-/*	$NetBSD: stat_flags.c,v 1.8 2000/07/29 03:46:15 lukem Exp $	*/
+/* $NetBSD: stat_flags.c,v 1.8 2000/07/29 03:46:15 lukem Exp $ */
 
 /*-
  * Copyright (c) 1993
Index: stat_flags.h
===================================================================
RCS file: /cvsroot/basesrc/bin/ls/stat_flags.h,v
retrieving revision 1.2
diff -u -r1.2 stat_flags.h
--- stat_flags.h	2000/07/29 03:46:15	1.2
+++ stat_flags.h	2001/09/16 19:54:55
@@ -1,4 +1,4 @@
-/*	$NetBSD: stat_flags.h,v 1.2 2000/07/29 03:46:15 lukem Exp $	*/
+/* $NetBSD: stat_flags.h,v 1.2 2000/07/29 03:46:15 lukem Exp $ */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -35,5 +35,10 @@
  *	@(#)extern.h	8.1 (Berkeley) 5/31/93
  */
 
-char	*flags_to_string(u_long, char *);
-int	 string_to_flags(char **, u_long *, u_long *);
+#ifndef _STAT_FLAGS_H_
+#define _STAT_FLAGS_H_
+
+char *flags_to_string(u_long, char *);
+int string_to_flags(char **, u_long *, u_long *);
+
+#endif /* !_STAT_FLAGS_H_ */
Index: util.c
===================================================================
RCS file: /cvsroot/basesrc/bin/ls/util.c,v
retrieving revision 1.20
diff -u -r1.20 util.c
--- util.c	2000/07/29 03:46:15	1.20
+++ util.c	2001/09/16 19:54:55
@@ -1,4 +1,4 @@
-/*	$NetBSD: util.c,v 1.20 2000/07/29 03:46:15 lukem Exp $	*/
+/* $NetBSD: util.c,v 1.20 2000/07/29 03:46:15 lukem Exp $ */
 
 /*
  * Copyright (c) 1989, 1993, 1994
@@ -75,7 +75,8 @@
 usage(void)
 {
 	(void)fprintf(stderr, 
-	    "usage: ls [-1ACFLRSTWacdfgiklmnopqrstux] [file ...]\n");
+	    "usage: %s [-1ACFLRSTWacdfgiklmnopqrstux] [file ...]\n",
+	    getprogname());
 	exit(EXIT_FAILURE);
 	/* NOTREACHED */
 }
>Release-Note:
>Audit-Trail:
>Unformatted: