From f9a5adc8b6fababa9bc8c441edc25ac43f853d26 Mon Sep 17 00:00:00 2001 From: gad Date: Tue, 22 Jun 2004 02:06:42 +0000 Subject: Add 'const' to a few places. PR: bin/65803 Submitted by: Cyrille Lefevre --- bin/ps/extern.h | 2 +- bin/ps/fmt.c | 22 ++++++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) (limited to 'bin/ps') diff --git a/bin/ps/extern.h b/bin/ps/extern.h index 3642fc9..dd72e20 100644 --- a/bin/ps/extern.h +++ b/bin/ps/extern.h @@ -50,7 +50,7 @@ int donlist(void); void elapsed(KINFO *, VARENT *); void emulname(KINFO *, VARENT *); VARENT *find_varentry(VAR *); -const char *fmt_argv(char **, char *, size_t); +const char *fmt_argv(const char **, const char *, size_t); double getpcpu(const KINFO *); void kvar(KINFO *, VARENT *); void label(KINFO *, VARENT *); diff --git a/bin/ps/fmt.c b/bin/ps/fmt.c index d6e0109..f7c0914 100644 --- a/bin/ps/fmt.c +++ b/bin/ps/fmt.c @@ -51,16 +51,17 @@ __FBSDID("$FreeBSD$"); #include "ps.h" -static char *cmdpart(char *); -static char *shquote(char **); +static const char *cmdpart(const char *); +static const char *shquote(const char **); -static char * -shquote(char **argv) +static const char * +shquote(const char **argv) { long arg_max; static size_t buf_size; size_t len; - char **p, *dst, *src; + const char **p, *src; + char *dst; static char *buf = NULL; if (buf == NULL) { @@ -96,19 +97,20 @@ shquote(char **argv) return (buf); } -static char * -cmdpart(char *arg0) +static const char * +cmdpart(const char *arg0) { - char *cp; + const char *cp; return ((cp = strrchr(arg0, '/')) != NULL ? cp + 1 : arg0); } const char * -fmt_argv(char **argv, char *cmd, size_t maxlen) +fmt_argv(const char **argv, const char *cmd, size_t maxlen) { size_t len; - char *ap, *cp; + const char *ap; + char *cp; if (argv == NULL || argv[0] == NULL) { if (cmd == NULL) -- cgit v1.1