Subject: bin/13977: bin/ps 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 22:43:28
>Number:         13977
>Category:       bin
>Synopsis:       bin/ps 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 12:41:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Petri Koistinen
>Release:        NetBSD-current Sun Sep 16 22:42:32 EEST 200
>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 patch for bin/ps program.
>How-To-Repeat:
>Fix:
Index: extern.h
===================================================================
RCS file: /cvsroot/basesrc/bin/ps/extern.h,v
retrieving revision 1.20
diff -u -r1.20 extern.h
--- extern.h	2001/07/14 06:53:43	1.20
+++ extern.h	2001/09/16 19:33:45
@@ -1,4 +1,4 @@
-/*	$NetBSD: extern.h,v 1.20 2001/07/14 06:53:43 matt Exp $	*/
+/* $NetBSD: extern.h,v 1.20 2001/07/14 06:53:43 matt Exp $ */
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -35,6 +35,9 @@
  *	@(#)extern.h	8.3 (Berkeley) 4/2/94
  */
 
+#ifndef _EXTERN_H_
+#define _EXTERN_H_
+
 struct kinfo;
 struct nlist;
 struct var;
@@ -50,42 +53,44 @@
 extern VARENT *vhead;
 
 __BEGIN_DECLS
-void	 command __P((struct kinfo_proc2 *, VARENT *, int));
-void	 cputime __P((struct kinfo_proc2 *, VARENT *, int));
-int	 donlist __P((void));
-int	 donlist_sysctl __P((void));
-void	 fmt_puts __P((char *, int *));
-void	 fmt_putc __P((int, int *));
-double	 getpcpu __P((struct kinfo_proc2 *));
-double	 getpmem __P((struct kinfo_proc2 *));
-void	 logname __P((struct kinfo_proc2 *, VARENT *, int));
-void	 longtname __P((struct kinfo_proc2 *, VARENT *, int));
-void	 lstarted __P((struct kinfo_proc2 *, VARENT *, int));
-void	 maxrss __P((struct kinfo_proc2 *, VARENT *, int));
-void	 nlisterr __P((struct nlist *));
-void	 p_rssize __P((struct kinfo_proc2 *, VARENT *, int));
-void	 pagein __P((struct kinfo_proc2 *, VARENT *, int));
-void	 parsefmt __P((char *));
-void	 pcpu __P((struct kinfo_proc2 *, VARENT *, int));
-void	 pmem __P((struct kinfo_proc2 *, VARENT *, int));
-void	 pnice __P((struct kinfo_proc2 *, VARENT *, int));
-void	 pri __P((struct kinfo_proc2 *, VARENT *, int));
-void	 printheader __P((void));
+void	 command(struct kinfo_proc2 *, VARENT *, int);
+void	 cputime(struct kinfo_proc2 *, VARENT *, int);
+int	 donlist(void);
+int	 donlist_sysctl(void);
+void	 fmt_puts(char *, int *);
+void	 fmt_putc(int, int *);
+double	 getpcpu(struct kinfo_proc2 *);
+double	 getpmem(struct kinfo_proc2 *);
+void	 logname(struct kinfo_proc2 *, VARENT *, int);
+void	 longtname(struct kinfo_proc2 *, VARENT *, int);
+void	 lstarted(struct kinfo_proc2 *, VARENT *, int);
+void	 maxrss(struct kinfo_proc2 *, VARENT *, int);
+void	 nlisterr(struct nlist *);
+void	 p_rssize(struct kinfo_proc2 *, VARENT *, int);
+void	 pagein(struct kinfo_proc2 *, VARENT *, int);
+void	 parsefmt(char *);
+void	 pcpu(struct kinfo_proc2 *, VARENT *, int);
+void	 pmem(struct kinfo_proc2 *, VARENT *, int);
+void	 pnice(struct kinfo_proc2 *, VARENT *, int);
+void	 pri(struct kinfo_proc2 *, VARENT *, int);
+void	 printheader(void);
 struct kinfo_proc2
-	*getkinfo_procfs __P((int, int, int *));
-char	**procfs_getargv __P((const struct kinfo_proc2 *, int));
-void	 pvar __P((struct kinfo_proc2 *, VARENT *, int));
-void	 rssize __P((struct kinfo_proc2 *, VARENT *, int));
-void	 runame __P((struct kinfo_proc2 *, VARENT *, int));
-void	 showkey __P((void));
-void	 started __P((struct kinfo_proc2 *, VARENT *, int));
-void	 state __P((struct kinfo_proc2 *, VARENT *, int));
-void	 tdev __P((struct kinfo_proc2 *, VARENT *, int));
-void	 tname __P((struct kinfo_proc2 *, VARENT *, int));
-void	 tsize __P((struct kinfo_proc2 *, VARENT *, int));
-void	 ucomm __P((struct kinfo_proc2 *, VARENT *, int));
-void	 uname __P((struct kinfo_proc2 *, VARENT *, int));
-void	 uvar __P((struct kinfo_proc2 *, VARENT *, int));
-void	 vsize __P((struct kinfo_proc2 *, VARENT *, int));
-void	 wchan __P((struct kinfo_proc2 *, VARENT *, int));
+	*getkinfo_procfs(int, int, int *);
+char	**procfs_getargv(const struct kinfo_proc2 *, int);
+void	 pvar(struct kinfo_proc2 *, VARENT *, int);
+void	 rssize(struct kinfo_proc2 *, VARENT *, int);
+void	 runame(struct kinfo_proc2 *, VARENT *, int);
+void	 showkey(void);
+void	 started(struct kinfo_proc2 *, VARENT *, int);
+void	 state(struct kinfo_proc2 *, VARENT *, int);
+void	 tdev(struct kinfo_proc2 *, VARENT *, int);
+void	 tname(struct kinfo_proc2 *, VARENT *, int);
+void	 tsize(struct kinfo_proc2 *, VARENT *, int);
+void	 ucomm(struct kinfo_proc2 *, VARENT *, int);
+void	 uname(struct kinfo_proc2 *, VARENT *, int);
+void	 uvar(struct kinfo_proc2 *, VARENT *, int);
+void	 vsize(struct kinfo_proc2 *, VARENT *, int);
+void	 wchan(struct kinfo_proc2 *, VARENT *, int);
 __END_DECLS
+
+#endif /* !_EXTERN_H_ */
Index: fmt.c
===================================================================
RCS file: /cvsroot/basesrc/bin/ps/fmt.c,v
retrieving revision 1.16
diff -u -r1.16 fmt.c
--- fmt.c	2001/03/23 01:06:02	1.16
+++ fmt.c	2001/09/16 19:33:45
@@ -1,19 +1,19 @@
-/*	$NetBSD: fmt.c,v 1.16 2001/03/23 01:06:02 enami Exp $	*/
+/* $NetBSD: fmt.c,v 1.16 2001/03/23 01:06:02 enami Exp $ */
 
+#include <sys/time.h>
+#include <sys/resource.h>
+
 #include <kvm.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 #include <vis.h>
-#include <sys/time.h>
-#include <sys/resource.h>
+
 #include "ps.h"
 
 void
-fmt_puts(s, leftp)
-	char *s;
-	int *leftp;
+fmt_puts(char *s, int *leftp)
 {
 	static char *v = 0, *nv;
 	static int maxlen = 0;
@@ -48,9 +48,7 @@
 }
 
 void
-fmt_putc(c, leftp)
-	int c;
-	int *leftp;
+fmt_putc(int c, int *leftp)
 {
 
 	if (*leftp == 0)
Index: keyword.c
===================================================================
RCS file: /cvsroot/basesrc/bin/ps/keyword.c,v
retrieving revision 1.26
diff -u -r1.26 keyword.c
--- keyword.c	2001/01/08 13:20:29	1.26
+++ keyword.c	2001/09/16 19:33:47
@@ -1,4 +1,4 @@
-/*	$NetBSD: keyword.c,v 1.26 2001/01/08 13:20:29 itojun Exp $	*/
+/* $NetBSD: keyword.c,v 1.26 2001/01/08 13:20:29 itojun Exp $ */
 
 /*-
  * Copyright (c) 1990, 1993, 1994
@@ -60,8 +60,8 @@
 
 #include "ps.h"
 
-static VAR *findvar __P((char *));
-static int  vcmp __P((const void *, const void *));
+static VAR *findvar(char *);
+static int vcmp(const void *, const void *);
 
 #ifdef NOTINUSE
 	{"stime", "STIME", NULL, 0, cputime},	/* XXX add stime, utime ... */
@@ -179,7 +179,7 @@
 };
 
 void
-showkey()
+showkey(void)
 {
 	VAR *v;
 	int i;
@@ -200,8 +200,7 @@
 }
 
 void
-parsefmt(p)
-	char *p;
+parsefmt(char *p)
 {
 	static struct varent *vtail;
 
@@ -231,8 +230,7 @@
 }
 
 static VAR *
-findvar(p)
-	char *p;
+findvar(char *p)
 {
 	VAR *v, key;
 	char *hp;
@@ -265,8 +263,7 @@
 }
 
 static int
-vcmp(a, b)
-        const void *a, *b;
+vcmp(const void *a, const void *b)
 {
         return (strcmp(((VAR *)a)->name, ((VAR *)b)->name));
 }
Index: nlist.c
===================================================================
RCS file: /cvsroot/basesrc/bin/ps/nlist.c,v
retrieving revision 1.18
diff -u -r1.18 nlist.c
--- nlist.c	2001/07/14 06:53:44	1.18
+++ nlist.c	2001/09/16 19:33:47
@@ -1,4 +1,4 @@
-/*	$NetBSD: nlist.c,v 1.18 2001/07/14 06:53:44 matt Exp $	*/
+/* $NetBSD: nlist.c,v 1.18 2001/07/14 06:53:44 matt Exp $ */
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -90,6 +90,7 @@
 #include <math.h>
 #include <nlist.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 
@@ -118,7 +119,7 @@
 	kvm_read(kd, psnl[x].n_value, (char *)&v, sizeof v) != sizeof(v)
 
 int
-donlist()
+donlist(void)
 {
 	int rval;
 	fixpt_t xccpu;
@@ -151,7 +152,7 @@
 }
 
 int
-donlist_sysctl()
+donlist_sysctl(void)
 {
 	int mib[2];
 	size_t size;
@@ -204,12 +205,11 @@
 }
 
 void
-nlisterr(nl)
-	struct nlist nl[];
+nlisterr(struct nlist nl[])
 {
 	int i;
 
-	(void)fprintf(stderr, "ps: nlist: can't find following symbols:");
+	(void)fprintf(stderr, "%s: nlist: can't find following symbols:", getprogname());
 	for (i = 0; nl[i].n_name != NULL; i++)
 		if (nl[i].n_value == 0)
 			(void)fprintf(stderr, " %s", nl[i].n_name);
Index: print.c
===================================================================
RCS file: /cvsroot/basesrc/bin/ps/print.c,v
retrieving revision 1.69
diff -u -r1.69 print.c
--- print.c	2001/08/24 06:37:03	1.69
+++ print.c	2001/09/16 19:33:48
@@ -1,4 +1,4 @@
-/*	$NetBSD: print.c,v 1.69 2001/08/24 06:37:03 lukem Exp $	*/
+/* $NetBSD: print.c,v 1.69 2001/08/24 06:37:03 lukem Exp $ */
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -101,20 +101,19 @@
 
 #include "ps.h"
 
-static char *cmdpart __P((char *));
-static void  printval __P((void *, VAR *, int));
-static int   titlecmp __P((char *, char **));
-
-static void  doubleprintorsetwidth __P((VAR *, double, int, int));
-static void  intprintorsetwidth __P((VAR *, int, int));
-static void  strprintorsetwidth __P((VAR *, const char *, int));
+static char *cmdpart(char *);
+static void printval(void *, VAR *, int);
+static int titlecmp(char *, char **);
+
+static void doubleprintorsetwidth(VAR *, double, int, int);
+static void intprintorsetwidth(VAR *, int, int);
+static void strprintorsetwidth(VAR *, const char *, int);
 
 #define	min(a,b)	((a) <= (b) ? (a) : (b))
 #define	max(a,b)	((a) >= (b) ? (a) : (b))
 
 static char *
-cmdpart(arg0)
-	char *arg0;
+cmdpart(char *arg0)
 {
 	char *cp;
 
@@ -122,7 +121,7 @@
 }
 
 void
-printheader()
+printheader(void)
 {
 	int len;
 	VAR *v;
@@ -160,14 +159,11 @@
  * not match the command name (p_comm)
  */
 static int
-titlecmp(name, argv)
-	char *name;
-	char **argv;
+titlecmp(char *name, char **argv)
 {
 	char *title;
 	int namelen;
 
-
 	/* no argument vector == no match; system processes/threads do that */
 	if (argv == 0 || argv[0] == 0)
 		return (1);
@@ -195,11 +191,7 @@
 }
 
 static void
-doubleprintorsetwidth(v, val, prec, mode)
-	VAR *v;
-	double val;
-	int prec;
-	int mode;
+doubleprintorsetwidth(VAR *v, double val, int prec, int mode)
 {
 	int fmtlen;
 
@@ -221,10 +213,7 @@
 }
 
 static void
-intprintorsetwidth(v, val, mode)
-	VAR *v;
-	int val;
-	int mode;
+intprintorsetwidth(VAR *v, int val, int mode)
 {
 	int fmtlen;
 
@@ -245,9 +234,7 @@
 }
 
 static void
-strprintorsetwidth(v, str, mode)
-	VAR *v;
-	const char *str;
+strprintorsetwidth(VAR *v, const char *str, int mode)
 {
 	int len;
 
@@ -264,10 +251,7 @@
 }
 
 void
-command(ki, ve, mode)
-	struct kinfo_proc2 *ki;
-	VARENT *ve;
-	int mode;
+command(struct kinfo_proc2 *ki, VARENT *ve, int mode)
 {
 	VAR *v;
 	int left;
@@ -351,10 +335,7 @@
 }
 
 void
-ucomm(k, ve, mode)
-	struct kinfo_proc2 *k;
-	VARENT *ve;
-	int mode;
+ucomm(struct kinfo_proc2 *k, VARENT *ve, int mode)
 {
 	VAR *v;
 
@@ -363,10 +344,7 @@
 }
 
 void
-logname(k, ve, mode)
-	struct kinfo_proc2 *k;
-	VARENT *ve;
-	int mode;
+logname(struct kinfo_proc2 *k, VARENT *ve, int mode)
 {
 	VAR *v;
 
@@ -375,10 +353,7 @@
 }
 
 void
-state(k, ve, mode)
-	struct kinfo_proc2 *k;
-	VARENT *ve;
-	int mode;
+state(struct kinfo_proc2 *k, VARENT *ve, int mode)
 {
 	int flag, is_zombie;
 	char *cp;
@@ -446,10 +421,7 @@
 }
 
 void
-pnice(k, ve, mode)
-	struct kinfo_proc2 *k;
-	VARENT *ve;
-	int mode;
+pnice(struct kinfo_proc2 *k, VARENT *ve, int mode)
 {
 	VAR *v;
 
@@ -458,10 +430,7 @@
 }
 
 void
-pri(k, ve, mode)
-	struct kinfo_proc2 *k;
-	VARENT *ve;
-	int mode;
+pri(struct kinfo_proc2 *k, VARENT *ve, int mode)
 {
 	VAR *v;
 
@@ -470,10 +439,7 @@
 }
 
 void
-uname(k, ve, mode)
-	struct kinfo_proc2 *k;
-	VARENT *ve;
-	int mode;
+uname(struct kinfo_proc2 *k, VARENT *ve, int mode)
 {
 	VAR *v;
 
@@ -482,10 +448,7 @@
 }
 
 void
-runame(k, ve, mode)
-	struct kinfo_proc2 *k;
-	VARENT *ve;
-	int mode;
+runame(struct kinfo_proc2 *k, VARENT *ve, int mode)
 {
 	VAR *v;
 
@@ -494,10 +457,7 @@
 }
 
 void
-tdev(k, ve, mode)
-	struct kinfo_proc2 *k;
-	VARENT *ve;
-	int mode;
+tdev(struct kinfo_proc2 *k, VARENT *ve, int mode)
 {
 	VAR *v;
 	dev_t dev;
@@ -520,10 +480,7 @@
 }
 
 void
-tname(k, ve, mode)
-	struct kinfo_proc2 *k;
-	VARENT *ve;
-	int mode;
+tname(struct kinfo_proc2 *k, VARENT *ve, int mode)
 {
 	VAR *v;
 	dev_t dev;
@@ -560,10 +517,7 @@
 }
 
 void
-longtname(k, ve, mode)
-	struct kinfo_proc2 *k;
-	VARENT *ve;
-	int mode;
+longtname(struct kinfo_proc2 *k, VARENT *ve, int mode)
 {
 	VAR *v;
 	dev_t dev;
@@ -585,10 +539,7 @@
 }
 
 void
-started(k, ve, mode)
-	struct kinfo_proc2 *k;
-	VARENT *ve;
-	int mode;
+started(struct kinfo_proc2 *k, VARENT *ve, int mode)
 {
 	VAR *v;
 	static time_t now;
@@ -631,10 +582,7 @@
 }
 
 void
-lstarted(k, ve, mode)
-	struct kinfo_proc2 *k;
-	VARENT *ve;
-	int mode;
+lstarted(struct kinfo_proc2 *k, VARENT *ve, int mode)
 {
 	VAR *v;
 	time_t startt;
@@ -661,10 +609,7 @@
 }
 
 void
-wchan(k, ve, mode)
-	struct kinfo_proc2 *k;
-	VARENT *ve;
-	int mode;
+wchan(struct kinfo_proc2 *k, VARENT *ve, int mode)
 {
 	VAR *v;
 	char *buf;
@@ -692,10 +637,7 @@
 #define pgtok(a)        (((a)*getpagesize())/1024)
 
 void
-vsize(k, ve, mode)
-	struct kinfo_proc2 *k;
-	VARENT *ve;
-	int mode;
+vsize(struct kinfo_proc2 *k, VARENT *ve, int mode)
 {
 	VAR *v;
 
@@ -705,10 +647,7 @@
 }
 
 void
-rssize(k, ve, mode)
-	struct kinfo_proc2 *k;
-	VARENT *ve;
-	int mode;
+rssize(struct kinfo_proc2 *k, VARENT *ve, int mode)
 {
 	VAR *v;
 
@@ -718,10 +657,7 @@
 }
 
 void
-p_rssize(k, ve, mode)		/* doesn't account for text */
-	struct kinfo_proc2 *k;
-	VARENT *ve;
-	int mode;
+p_rssize(struct kinfo_proc2 *k, VARENT *ve, int mode) /* doesn't account for text */
 {
 	VAR *v;
 
@@ -730,10 +666,7 @@
 }
 
 void
-cputime(k, ve, mode)
-	struct kinfo_proc2 *k;
-	VARENT *ve;
-	int mode;
+cputime(struct kinfo_proc2 *k, VARENT *ve, int mode)
 {
 	VAR *v;
 	long secs;
@@ -786,8 +719,7 @@
 }
 
 double
-getpcpu(k)
-	struct kinfo_proc2 *k;
+getpcpu(struct kinfo_proc2 *k)
 {
 	static int failure;
 
@@ -809,10 +741,7 @@
 }
 
 void
-pcpu(k, ve, mode)
-	struct kinfo_proc2 *k;
-	VARENT *ve;
-	int mode;
+pcpu(struct kinfo_proc2 *k, VARENT *ve, int mode)
 {
 	VAR *v;
 
@@ -821,8 +750,7 @@
 }
 
 double
-getpmem(k)
-	struct kinfo_proc2 *k;
+getpmem(struct kinfo_proc2 *k)
 {
 	static int failure;
 	double fracmem;
@@ -843,10 +771,7 @@
 }
 
 void
-pmem(k, ve, mode)
-	struct kinfo_proc2 *k;
-	VARENT *ve;
-	int mode;
+pmem(struct kinfo_proc2 *k, VARENT *ve, int mode)
 {
 	VAR *v;
 
@@ -855,10 +780,7 @@
 }
 
 void
-pagein(k, ve, mode)
-	struct kinfo_proc2 *k;
-	VARENT *ve;
-	int mode;
+pagein(struct kinfo_proc2 *k, VARENT *ve, int mode)
 {
 	VAR *v;
 
@@ -867,10 +789,7 @@
 }
 
 void
-maxrss(k, ve, mode)
-	struct kinfo_proc2 *k;
-	VARENT *ve;
-	int mode;
+maxrss(struct kinfo_proc2 *k, VARENT *ve, int mode)
 {
 	VAR *v;
 
@@ -881,10 +800,7 @@
 }
 
 void
-tsize(k, ve, mode)
-	struct kinfo_proc2 *k;
-	VARENT *ve;
-	int mode;
+tsize(struct kinfo_proc2 *k, VARENT *ve, int mode)
 {
 	VAR *v;
 
@@ -897,10 +813,7 @@
  * structures.
  */
 static void
-printval(bp, v, mode)
-	void *bp;
-	VAR *v;
-	int mode;
+printval(void *bp, VAR *v, int mode)
 {
 	static char ofmt[32] = "%";
 	int width, vok, fmtlen;
@@ -1111,10 +1024,7 @@
 }
 
 void
-pvar(k, ve, mode)
-	struct kinfo_proc2 *k;
-	VARENT *ve;
-	int mode;
+pvar(struct kinfo_proc2 *k, VARENT *ve, int mode)
 {
 	VAR *v;
 
Index: procfs_ops.c
===================================================================
RCS file: /cvsroot/basesrc/bin/ps/procfs_ops.c,v
retrieving revision 1.9
diff -u -r1.9 procfs_ops.c
--- procfs_ops.c	2000/05/26 03:04:28	1.9
+++ procfs_ops.c	2001/09/16 19:33:49
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_ops.c,v 1.9 2000/05/26 03:04:28 simonb Exp $	*/
+/* $NetBSD: procfs_ops.c,v 1.9 2000/05/26 03:04:28 simonb Exp $ */
 
 /*
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -44,14 +44,14 @@
 #include <sys/stat.h>
 #include <sys/resource.h> /* for rusage */
 
+#include <err.h>
 #include <fcntl.h>
 #include <dirent.h>
-#include <stdlib.h>
-#include <unistd.h>
+#include <kvm.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
-#include <err.h>
-#include <kvm.h>
+#include <unistd.h>
 
 #include "ps.h"
 
@@ -72,13 +72,11 @@
 	}								\
 }
 
-static int verify_procfs_fd __P((int, const char *));
-static int parsekinfo __P((const char *, struct kinfo_proc2 *));
+static int verify_procfs_fd(int, const char *);
+static int parsekinfo(const char *, struct kinfo_proc2 *);
 
 static int
-verify_procfs_fd(fd, path)
-	int     fd;
-	const char *path;
+verify_procfs_fd(int fd, const char *path)
 {
 	struct statfs procfsstat;
 
@@ -99,9 +97,7 @@
 }
 
 static int
-parsekinfo(path, ki)
-	const char *path;
-	struct kinfo_proc2 *ki;
+parsekinfo(const char *path, struct kinfo_proc2 *ki)
 {
 	char    fullpath[MAXPATHLEN];
 	int     dirfd, fd, nbytes, devmajor, devminor;
@@ -196,17 +192,17 @@
 }
 
 struct kinfo_proc2 *
-getkinfo_procfs(op, arg, cnt)
-	int     op, arg;
-	int    *cnt;
+getkinfo_procfs(int op, int arg, int *cnt)
 {
 	struct stat statbuf;
-	int     procdirfd, nbytes, knum = 0, maxknum = 0;
-	char   *direntbuff;
-	struct kinfo_proc2 *ki;
-	int     mib[4];
-	size_t  len;
 	struct statfs procfsstat;
+	struct kinfo_proc2 *ki;
+	int knum, maxknum, mib[4], nbytes, procdirfd;
+	char *direntbuff;
+	size_t len;
+
+	knum = 0;
+	maxknum = 0;
 
 	/* First, make sure that /proc is a procfs filesystem. */
 	if (statfs("/proc", &procfsstat)) {
@@ -345,11 +341,9 @@
  * argv[0], second element is all the other args separated by spaces
  */
 char **
-procfs_getargv(kp, nchr)
-	const struct kinfo_proc2 *kp;
-	int nchr;
+procfs_getargv(const struct kinfo_proc2 *kp, int nchr)
 {
-	char    fullpath[MAXPATHLEN], *buf, *name, *args, **argv;
+	char fullpath[MAXPATHLEN], *buf, *name, *args, **argv;
 	int fd, num;
 	ssize_t len;
 	size_t idx;
@@ -404,4 +398,3 @@
 
 	return argv;
 }
-
Index: ps.c
===================================================================
RCS file: /cvsroot/basesrc/bin/ps/ps.c,v
retrieving revision 1.44
diff -u -r1.44 ps.c
--- ps.c	2001/07/30 16:22:49	1.44
+++ ps.c	2001/09/16 19:33:50
@@ -1,4 +1,4 @@
-/*	$NetBSD: ps.c,v 1.44 2001/07/30 16:22:49 wiz Exp $	*/
+/* $NetBSD: ps.c,v 1.44 2001/07/30 16:22:49 wiz Exp $ */
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -130,13 +130,12 @@
 
 enum sort { DEFAULT, SORTMEM, SORTCPU } sortby = DEFAULT;
 
-static struct kinfo_proc2
-		*getkinfo_kvm __P((kvm_t *, int, int, int *));
-static char	*kludge_oldps_options __P((char *));
-static int	 pscomp __P((const void *, const void *));
-static void	 scanvars __P((void));
-static void	 usage __P((void));
-int		 main __P((int, char *[]));
+static struct kinfo_proc2 *getkinfo_kvm(kvm_t *, int, int, int *);
+static char *kludge_oldps_options(char *);
+static int pscomp(const void *, const void *);
+static void scanvars(void);
+static void usage(void);
+int main(int, char *[]);
 
 char dfmt[] = "pid tt state time command";
 char jfmt[] = "user pid ppid pgid sess jobc state tt time command";
@@ -149,9 +148,7 @@
 kvm_t *kd;
 
 int
-main(argc, argv)
-	int argc;
-	char *argv[];
+main(int argc, char *argv[])
 {
 	struct varent *vent;
 	struct winsize ws;
@@ -160,6 +157,7 @@
 	char *nlistf, *memf, *swapf, errbuf[_POSIX2_LINE_MAX];
 	char *ttname;
 
+	setprogname(argv[0]);
 	if ((ioctl(STDOUT_FILENO, TIOCGWINSZ, (char *)&ws) == -1 &&
 	     ioctl(STDERR_FILENO, TIOCGWINSZ, (char *)&ws) == -1 &&
 	     ioctl(STDIN_FILENO,  TIOCGWINSZ, (char *)&ws) == -1) ||
@@ -445,16 +443,14 @@
 }
 
 static struct kinfo_proc2 *
-getkinfo_kvm(kd, what, flag, nentriesp)
-	kvm_t *kd;
-	int what, flag, *nentriesp;
+getkinfo_kvm(kvm_t *kd, int what, int flag, int *nentriesp)
 {
 	return (kvm_getproc2(kd, what, flag, sizeof(struct kinfo_proc2),
 	    nentriesp));
 }
 
 static void
-scanvars()
+scanvars(void)
 {
 	struct varent *vent;
 	VAR *v;
@@ -469,8 +465,7 @@
 }
 
 static int
-pscomp(a, b)
-	const void *a, *b;
+pscomp(const void *a, const void *b)
 {
 	struct kinfo_proc2 *ka = (struct kinfo_proc2 *)a;
 	struct kinfo_proc2 *kb = (struct kinfo_proc2 *)b;
@@ -501,8 +496,7 @@
  * feature is available with the option 'T', which takes no argument.
  */
 static char *
-kludge_oldps_options(s)
-	char *s;
+kludge_oldps_options(char *s)
 {
 	size_t len;
 	char *newopts, *ns, *cp;
@@ -553,14 +547,17 @@
 }
 
 static void
-usage()
+usage(void)
 {
+	const char *progname = getprogname();
 
 	(void)fprintf(stderr,
-	    "usage:\t%s\n\t   %s\n\t%s\n",
-	    "ps [-aChjKlmrSTuvwx] [-O|o fmt] [-p pid] [-t tty]",
+	    "usage:\t%s%s\n\t   %s\n\t%s%s\n",
+	    progname,
+	    " [-aChjKlmrSTuvwx] [-O|o fmt] [-p pid] [-t tty]",
 	    "[-M core] [-N system] [-W swap] [-U username]",
-	    "ps [-L]");
+	    progname,
+	    " [-L]");
 	exit(1);
 	/* NOTREACHED */
 }
Index: ps.h
===================================================================
RCS file: /cvsroot/basesrc/bin/ps/ps.h,v
retrieving revision 1.17
diff -u -r1.17 ps.h
--- ps.h	2000/06/07 04:58:02	1.17
+++ ps.h	2001/09/16 19:33:50
@@ -1,4 +1,4 @@
-/*	$NetBSD: ps.h,v 1.17 2000/06/07 04:58:02 simonb Exp $	*/
+/* $NetBSD: ps.h,v 1.17 2000/06/07 04:58:02 simonb Exp $ */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -35,6 +35,9 @@
  *	@(#)ps.h	8.1 (Berkeley) 5/31/93
  */
 
+#ifndef _PS_H_
+#define _PS_H_
+
 #define	UNLIMITED	0	/* unlimited terminal width */
 
 #define PRINTMODE	0	/* print values */
@@ -60,7 +63,7 @@
 #define	INF127	0x04		/* 127 = infinity: if > 127, print 127. */
 	u_int	flag;
 				/* output routine */
-	void	(*oproc) __P((struct kinfo_proc2 *, struct varent *, int));
+	void	(*oproc)(struct kinfo_proc2 *, struct varent *, int);
 	short	width;		/* printing width */
 	/*
 	 * The following (optional) elements are hooks for passing information
@@ -79,3 +82,5 @@
 } VAR;
 
 #include "extern.h"
+
+#endif /* !_PS_H_ */
>Release-Note:
>Audit-Trail:
>Unformatted: