Fix compiler warnings
Add WARNS=1
This commit is contained in:
parent
e3680b0e26
commit
78295c8bc1
@ -1,6 +1,7 @@
|
||||
# $NetBSD: Makefile,v 1.16 1995/10/26 00:48:59 jtc Exp $
|
||||
# $NetBSD: Makefile,v 1.17 1997/07/20 20:37:53 christos Exp $
|
||||
# @(#)Makefile 8.1 (Berkeley) 6/2/93
|
||||
|
||||
WARNS= 1
|
||||
PROG= ps
|
||||
SRCS= fmt.c keyword.c nlist.c print.c ps.c
|
||||
DPADD= ${LIBM} ${LIBKVM}
|
||||
|
@ -3,6 +3,9 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <vis.h>
|
||||
#include <sys/resource.h>
|
||||
#include "ps.h"
|
||||
#include "extern.h"
|
||||
|
||||
void
|
||||
fmt_puts(s, leftp)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: keyword.c,v 1.14 1996/10/02 18:07:23 ws Exp $ */
|
||||
/* $NetBSD: keyword.c,v 1.15 1997/07/20 20:37:54 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993, 1994
|
||||
@ -33,11 +33,12 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)keyword.c 8.5 (Berkeley) 4/2/94";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: keyword.c,v 1.14 1996/10/02 18:07:23 ws Exp $";
|
||||
__RCSID("$NetBSD: keyword.c,v 1.15 1997/07/20 20:37:54 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -312,7 +313,7 @@ parsefmt(p)
|
||||
if (!(v = findvar(cp)))
|
||||
continue;
|
||||
if ((vent = malloc(sizeof(struct varent))) == NULL)
|
||||
err(1, NULL);
|
||||
err(1, "%s", "");
|
||||
vent->var = v;
|
||||
vent->next = NULL;
|
||||
if (vhead == NULL)
|
||||
@ -332,7 +333,6 @@ findvar(p)
|
||||
{
|
||||
VAR *v, key;
|
||||
char *hp;
|
||||
int vcmp();
|
||||
|
||||
key.name = p;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nlist.c,v 1.11 1995/03/21 09:08:03 cgd Exp $ */
|
||||
/* $NetBSD: nlist.c,v 1.12 1997/07/20 20:37:55 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993, 1994
|
||||
@ -33,11 +33,12 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)nlist.c 8.4 (Berkeley) 4/2/94";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: nlist.c,v 1.11 1995/03/21 09:08:03 cgd Exp $";
|
||||
__RCSID("$NetBSD: nlist.c,v 1.12 1997/07/20 20:37:55 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: print.c,v 1.32 1997/03/19 05:45:27 mycroft Exp $ */
|
||||
/* $NetBSD: print.c,v 1.33 1997/07/20 20:37:56 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993, 1994
|
||||
@ -33,11 +33,12 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)print.c 8.6 (Berkeley) 4/16/94";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: print.c,v 1.32 1997/03/19 05:45:27 mycroft Exp $";
|
||||
__RCSID("$NetBSD: print.c,v 1.33 1997/07/20 20:37:56 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -79,6 +80,7 @@ extern kvm_t *kd;
|
||||
extern int needenv, needcomm, commandonly;
|
||||
|
||||
static char *cmdpart __P((char *));
|
||||
static void printval __P((char *, VAR *));
|
||||
|
||||
#define min(a,b) ((a) <= (b) ? (a) : (b))
|
||||
#define max(a,b) ((a) >= (b) ? (a) : (b))
|
||||
@ -134,7 +136,7 @@ command(ki, ve)
|
||||
left = -1;
|
||||
if (needenv) {
|
||||
argv = kvm_getenvv(kd, ki->ki_p, termwidth);
|
||||
if (p = argv) {
|
||||
if ((p = argv) != NULL) {
|
||||
while (*p) {
|
||||
fmt_puts(*p, &left);
|
||||
p++;
|
||||
@ -145,7 +147,7 @@ command(ki, ve)
|
||||
if (needcomm) {
|
||||
if (!commandonly) {
|
||||
argv = kvm_getargv(kd, ki->ki_p, termwidth);
|
||||
if (p = argv) {
|
||||
if ((p = argv) != NULL) {
|
||||
while (*p) {
|
||||
fmt_puts(*p, &left);
|
||||
p++;
|
||||
@ -717,7 +719,8 @@ printval(bp, v)
|
||||
if (v->flag & LJUST)
|
||||
*cp++ = '-';
|
||||
*cp++ = '*';
|
||||
while (*cp++ = *fcp++);
|
||||
while ((*cp++ = *fcp++) != '\0')
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Note that the "INF127" check is nonsensical for types
|
||||
|
19
bin/ps/ps.c
19
bin/ps/ps.c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ps.c,v 1.18 1997/04/21 05:28:43 mrg Exp $ */
|
||||
/* $NetBSD: ps.c,v 1.19 1997/07/20 20:37:57 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993, 1994
|
||||
@ -33,17 +33,17 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"@(#) Copyright (c) 1990, 1993, 1994\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
__COPYRIGHT("@(#) Copyright (c) 1990, 1993, 1994\n\
|
||||
The Regents of the University of California. All rights reserved.\n");
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)ps.c 8.4 (Berkeley) 4/2/94";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: ps.c,v 1.18 1997/04/21 05:28:43 mrg Exp $";
|
||||
__RCSID("$NetBSD: ps.c,v 1.19 1997/07/20 20:37:57 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -93,6 +93,7 @@ static int pscomp __P((const void *, const void *));
|
||||
static void saveuser __P((KINFO *));
|
||||
static void scanvars __P((void));
|
||||
static void usage __P((void));
|
||||
int main __P((int, char *[]));
|
||||
|
||||
char dfmt[] = "pid tt state time command";
|
||||
char jfmt[] = "user pid ppid pgid sess jobc state tt time command";
|
||||
@ -307,7 +308,7 @@ main(argc, argv)
|
||||
if ((kp = kvm_getprocs(kd, what, flag, &nentries)) == 0)
|
||||
errx(1, "%s", kvm_geterr(kd));
|
||||
if ((kinfo = malloc(nentries * sizeof(*kinfo))) == NULL)
|
||||
err(1, NULL);
|
||||
err(1, "%s", "");
|
||||
for (i = nentries; --i >= 0; ++kp) {
|
||||
kinfo[i].ki_p = kp;
|
||||
if (needuser)
|
||||
@ -434,7 +435,7 @@ kludge_oldps_options(s)
|
||||
|
||||
len = strlen(s);
|
||||
if ((newopts = ns = malloc(len + 3)) == NULL)
|
||||
err(1, NULL);
|
||||
err(1, "%s", "");
|
||||
/*
|
||||
* options begin with '-'
|
||||
*/
|
||||
@ -466,8 +467,8 @@ kludge_oldps_options(s)
|
||||
* if there's a trailing number, and not a preceding 'p' (pid) or
|
||||
* 't' (tty) flag, then assume it's a pid and insert a 'p' flag.
|
||||
*/
|
||||
if (isdigit(*cp) && (cp == s || cp[-1] != 't' && cp[-1] != 'p' &&
|
||||
(cp - 1 == s || cp[-2] != 't')))
|
||||
if (isdigit(*cp) && (cp == s || (cp[-1] != 't' && cp[-1] != 'p' &&
|
||||
(cp - 1 == s || cp[-2] != 't'))))
|
||||
*ns++ = 'p';
|
||||
/* and append the number */
|
||||
(void)strcpy(ns, cp); /* XXX strcpy is safe */
|
||||
|
Loading…
Reference in New Issue
Block a user