summaryrefslogtreecommitdiffstats
path: root/bin/ps
diff options
context:
space:
mode:
authorgad <gad@FreeBSD.org>2004-06-22 02:06:42 +0000
committergad <gad@FreeBSD.org>2004-06-22 02:06:42 +0000
commitf9a5adc8b6fababa9bc8c441edc25ac43f853d26 (patch)
tree0746c7bce4332c4ea33c2d883d05a57e18ae36c3 /bin/ps
parent09466dade0e65526a2c25d08006f905436813799 (diff)
downloadFreeBSD-src-f9a5adc8b6fababa9bc8c441edc25ac43f853d26.zip
FreeBSD-src-f9a5adc8b6fababa9bc8c441edc25ac43f853d26.tar.gz
Add 'const' to a few places.
PR: bin/65803 Submitted by: Cyrille Lefevre
Diffstat (limited to 'bin/ps')
-rw-r--r--bin/ps/extern.h2
-rw-r--r--bin/ps/fmt.c22
2 files changed, 13 insertions, 11 deletions
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)
OpenPOWER on IntegriCloud