Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/lib/libwrap/percent_x.c,v retrieving revision 1.4.66.2 retrieving revision 1.5 diff -u -p -r1.4.66.2 -r1.5 --- src/lib/libwrap/percent_x.c 2012/04/23 23:40:41 1.4.66.2 +++ src/lib/libwrap/percent_x.c 2012/03/21 10:10:37 1.5 @@ -1,4 +1,4 @@ -/* $NetBSD: percent_x.c,v 1.4.66.2 2012/04/23 23:40:41 riz Exp $ */ +/* $NetBSD: percent_x.c,v 1.5 2012/03/21 10:10:37 matt Exp $ */ /* * percent_x() takes a string and performs % expansions. It aborts the @@ -17,7 +17,7 @@ #if 0 static char sccsid[] = "@(#) percent_x.c 1.4 94/12/28 17:42:37"; #else -__RCSID("$NetBSD: percent_x.c,v 1.4.66.2 2012/04/23 23:40:41 riz Exp $"); +__RCSID("$NetBSD: percent_x.c,v 1.5 2012/03/21 10:10:37 matt Exp $"); #endif #endif @@ -35,19 +35,17 @@ __RCSID("$NetBSD: percent_x.c,v 1.4.66.2 /* percent_x - do % expansion, abort if result buffer is too small */ -char *percent_x(result, result_len, string, request) -char *result; -int result_len; -char *string; -struct request_info *request; +char * +percent_x(char *result, int result_len, char *string, + struct request_info *request) { char *bp = result; char *end = result + result_len - 1; /* end of result buffer */ char *expansion; - int expansion_len; - static char ok_chars[] = "1234567890!@%-_=+:,./\ -abcdefghijklmnopqrstuvwxyz\ -ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + size_t expansion_len; + static const char ok_chars[] = "1234567890!@%-_=+:,./" + "abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; char *str = string; char *cp; int ch; @@ -72,7 +70,8 @@ ABCDEFGHIJKLMNOPQRSTUVWXYZ"; ch == 'p' ? eval_pid(request) : ch == 's' ? eval_server(request) : ch == 'u' ? eval_user(request) : - ch == '%' ? "%" : (tcpd_warn("unrecognized %%%c", ch), ""); + ch == '%' ? __UNCONST("%") + : (tcpd_warn("unrecognized %%%c", ch), __UNCONST("")); for (cp = expansion; *(cp += strspn(cp, ok_chars)); /* */ ) *cp = '_'; expansion_len = cp - expansion;