diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1999-02-25 21:40:18 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1999-02-25 21:40:18 +0000 |
commit | 667b180a04ef7b68c9988503684d33e0845f6921 (patch) | |
tree | d5efab0c86538811d2bce641db7ad5e5f9365415 /lib/libc/gen | |
parent | aaebc7e14e876539291303c9b60fee65ef90dd2b (diff) |
constify getcap(3). This fixes a warning in libcurses and doesn't
really change the API since those parameters that was been constified
really are not modified by getcap(3) routines.
Diffstat (limited to 'lib/libc/gen')
-rw-r--r-- | lib/libc/gen/getcap.3 | 14 | ||||
-rw-r--r-- | lib/libc/gen/getcap.c | 45 |
2 files changed, 35 insertions, 24 deletions
diff --git a/lib/libc/gen/getcap.3 b/lib/libc/gen/getcap.3 index d3b826bf8b0..aae42b41438 100644 --- a/lib/libc/gen/getcap.3 +++ b/lib/libc/gen/getcap.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: getcap.3,v 1.5 1998/08/29 21:11:25 deraadt Exp $ +.\" $OpenBSD: getcap.3,v 1.6 1999/02/25 21:40:16 millert Exp $ .\" .\" Copyright (c) 1992, 1993 .\" The Regents of the University of California. All rights reserved. @@ -52,19 +52,19 @@ .Sh SYNOPSIS .Fd #include <stdlib.h> .Ft int -.Fn cgetent "char **buf" "char **db_array" "char *name" +.Fn cgetent "char **buf" "char **db_array" "const char *name" .Ft int .Fn cgetset "char *ent" .Ft int -.Fn cgetmatch "char *buf" "char *name" +.Fn cgetmatch "char *buf" "const char *name" .Ft char * -.Fn cgetcap "char *buf" "char *cap" "char type" +.Fn cgetcap "char *buf" "const char *cap" "int type" .Ft int -.Fn cgetnum "char *buf" "char *cap" "long *num" +.Fn cgetnum "char *buf" "const char *cap" "long *num" .Ft int -.Fn cgetstr "char *buf" "char *cap" "char **str" +.Fn cgetstr "char *buf" "const char *cap" "char **str" .Ft int -.Fn cgetustr "char *buf" "char *cap" "char **str" +.Fn cgetustr "char *buf" "const char *cap" "char **str" .Ft int .Fn cgetfirst "char **buf" "char **db_array" .Ft int diff --git a/lib/libc/gen/getcap.c b/lib/libc/gen/getcap.c index f65f660f425..2131dbda51d 100644 --- a/lib/libc/gen/getcap.c +++ b/lib/libc/gen/getcap.c @@ -35,7 +35,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: getcap.c,v 1.15 1998/08/14 21:39:25 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: getcap.c,v 1.16 1999/02/25 21:40:17 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/types.h> @@ -64,9 +64,9 @@ static size_t topreclen; /* toprec length */ static char *toprec; /* Additional record specified by cgetset() */ static int gottoprec; /* Flag indicating retrieval of toprecord */ -static int cdbget __P((DB *, char **, char *)); -static int getent __P((char **, u_int *, char **, int, char *, int, char *)); -static int nfcmp __P((char *, char *)); +static int cdbget __P((DB *, char **, const char *)); +static int getent __P((char **, u_int *, char **, int, const char *, int, char *)); +static int nfcmp __P((const char *, char *)); /* * Cgetset() allows the addition of a user specified buffer to be added @@ -75,7 +75,7 @@ static int nfcmp __P((char *, char *)); */ int cgetset(ent) - char *ent; + const char *ent; { if (ent == NULL) { if (toprec) @@ -108,10 +108,12 @@ cgetset(ent) */ char * cgetcap(buf, cap, type) - char *buf, *cap; + char *buf; + const char *cap; int type; { - register char *bp, *cp; + register char *bp; + register const char *cp; bp = buf; for (;;) { @@ -160,7 +162,8 @@ cgetcap(buf, cap, type) */ int cgetent(buf, db_array, name) - char **buf, **db_array, *name; + char **buf, **db_array; + const char *name; { u_int dummy; @@ -187,7 +190,8 @@ cgetent(buf, db_array, name) */ static int getent(cap, len, db_array, fd, name, depth, nfield) - char **cap, **db_array, *name, *nfield; + char **cap, **db_array, *nfield; + const char *name; u_int *len; int fd, depth; { @@ -558,11 +562,12 @@ tc_exp: { static int cdbget(capdbp, bp, name) DB *capdbp; - char **bp, *name; + char **bp; + const char *name; { DBT key, data; - key.data = name; + key.data = (void *)name; key.size = strlen(name); for (;;) { @@ -592,9 +597,11 @@ cdbget(capdbp, bp, name) */ int cgetmatch(buf, name) - char *buf, *name; + char *buf; + const char *name; { - register char *np, *bp; + register char *bp; + register const char *np; /* * Start search at beginning of record. @@ -792,7 +799,8 @@ cgetnext(bp, db_array) */ int cgetstr(buf, cap, str) - char *buf, *cap; + char *buf; + const char *cap; char **str; { register u_int m_room; @@ -929,7 +937,8 @@ cgetstr(buf, cap, str) */ int cgetustr(buf, cap, str) - char *buf, *cap, **str; + char *buf, **str; + const char *cap; { register u_int m_room; register char *bp, *mp; @@ -1010,7 +1019,8 @@ cgetustr(buf, cap, str) */ int cgetnum(buf, cap, num) - char *buf, *cap; + char *buf; + const char *cap; long *num; { register long n; @@ -1074,7 +1084,8 @@ cgetnum(buf, cap, num) */ static int nfcmp(nf, rec) - char *nf, *rec; + const char *nf; + char *rec; { char *cp, tmp; int ret; |