Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/tcpdchk Use a little const for quotes strings.
details: https://anonhg.NetBSD.org/src/rev/fee27ec085ce
branches: trunk
changeset: 778289:fee27ec085ce
user: matt <matt%NetBSD.org@localhost>
date: Wed Mar 21 10:11:34 2012 +0000
description:
Use a little const for quotes strings.
diffstat:
usr.sbin/tcpdchk/scaffold.c | 13 +++++-----
usr.sbin/tcpdchk/scaffold.h | 14 +++++-----
usr.sbin/tcpdchk/tcpdchk.c | 54 ++++++++++++++++++++-------------------------
3 files changed, 37 insertions(+), 44 deletions(-)
diffs (183 lines):
diff -r af1543e1470d -r fee27ec085ce usr.sbin/tcpdchk/scaffold.c
--- a/usr.sbin/tcpdchk/scaffold.c Wed Mar 21 10:10:36 2012 +0000
+++ b/usr.sbin/tcpdchk/scaffold.c Wed Mar 21 10:11:34 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: scaffold.c,v 1.10 2003/07/14 09:07:22 itojun Exp $ */
+/* $NetBSD: scaffold.c,v 1.11 2012/03/21 10:11:34 matt Exp $ */
/*
* Routines for testing only. Not really industrial strength.
@@ -11,7 +11,7 @@
#if 0
static char sccs_id[] = "@(#) scaffold.c 1.6 97/03/21 19:27:24";
#else
-__RCSID("$NetBSD: scaffold.c,v 1.10 2003/07/14 09:07:22 itojun Exp $");
+__RCSID("$NetBSD: scaffold.c,v 1.11 2012/03/21 10:11:34 matt Exp $");
#endif
#endif
@@ -134,8 +134,8 @@
/* ARGSUSED */
-void rfc931(request)
-struct request_info *request;
+void
+rfc931(struct request_info *request)
{
strlcpy(request->user, unknown, sizeof(request->user));
}
@@ -143,9 +143,8 @@
/* check_path - examine accessibility */
-int check_path(path, st)
-char *path;
-struct stat *st;
+int
+check_path(const char *path, struct stat *st)
{
struct stat stbuf;
char buf[BUFSIZ];
diff -r af1543e1470d -r fee27ec085ce usr.sbin/tcpdchk/scaffold.h
--- a/usr.sbin/tcpdchk/scaffold.h Wed Mar 21 10:10:36 2012 +0000
+++ b/usr.sbin/tcpdchk/scaffold.h Wed Mar 21 10:11:34 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: scaffold.h,v 1.4 2002/06/06 21:28:50 itojun Exp $ */
+/* $NetBSD: scaffold.h,v 1.5 2012/03/21 10:11:34 matt Exp $ */
/*
* @(#) scaffold.h 1.3 94/12/31 18:19:19
@@ -6,11 +6,11 @@
* Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
*/
-struct addrinfo *find_inet_addr __P((char *, int));
-int check_dns __P((char *));
-void shell_cmd __P((char *));
-void clean_exit __P((struct request_info *));
+struct addrinfo *find_inet_addr(char *, int);
+int check_dns(char *);
+void shell_cmd(char *);
+void clean_exit(struct request_info *);
#if 0
-void rfc931 __P((struct request_info *));
+void rfc931(struct request_info *);
#endif
-int check_path __P((char *, struct stat *));
+int check_path(const char *, struct stat *);
diff -r af1543e1470d -r fee27ec085ce usr.sbin/tcpdchk/tcpdchk.c
--- a/usr.sbin/tcpdchk/tcpdchk.c Wed Mar 21 10:10:36 2012 +0000
+++ b/usr.sbin/tcpdchk/tcpdchk.c Wed Mar 21 10:11:34 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tcpdchk.c,v 1.11 2003/07/13 12:07:16 itojun Exp $ */
+/* $NetBSD: tcpdchk.c,v 1.12 2012/03/21 10:11:34 matt Exp $ */
/*
* tcpdchk - examine all tcpd access control rules and inetd.conf entries
@@ -21,7 +21,7 @@
#if 0
static char sccsid[] = "@(#) tcpdchk.c 1.8 97/02/12 02:13:25";
#else
-__RCSID("$NetBSD: tcpdchk.c,v 1.11 2003/07/13 12:07:16 itojun Exp $");
+__RCSID("$NetBSD: tcpdchk.c,v 1.12 2012/03/21 10:11:34 matt Exp $");
#endif
#endif
@@ -65,33 +65,33 @@
/*
* Stolen from hosts_access.c...
*/
-static char sep[] = ", \t\n";
+static const char sep[] = ", \t\n";
#define BUFLEN 2048
int resident = 0;
int hosts_access_verbose = 0;
-char *hosts_allow_table = HOSTS_ALLOW;
-char *hosts_deny_table = HOSTS_DENY;
+const char *hosts_allow_table = HOSTS_ALLOW;
+const char *hosts_deny_table = HOSTS_DENY;
extern jmp_buf tcpd_buf;
/*
* Local stuff.
*/
-static void usage __P((void));
-static void parse_table __P((char *, struct request_info *));
-static void print_list __P((char *, char *));
-static void check_daemon_list __P((char *));
-static void check_client_list __P((char *));
-static void check_daemon __P((char *));
-static void check_user __P((char *));
+static void usage(void);
+static void parse_table(const char *, struct request_info *);
+static void print_list(char *, char *);
+static void check_daemon_list(char *);
+static void check_client_list(char *);
+static void check_daemon(char *);
+static void check_user(char *);
#ifdef INET6
-static int check_inet_addr __P((char *));
+static int check_inet_addr(char *);
#endif
-static int check_host __P((char *));
-static int reserved_name __P((char *));
+static int check_host(char *);
+static int reserved_name(char *);
-int main __P((int, char **));
+int main(int, char **);
#define PERMIT 1
#define DENY 0
@@ -104,9 +104,8 @@
static int allow_check;
static char *inetcf;
-int main(argc, argv)
-int argc;
-char **argv;
+int
+main(int argc, char **argv)
{
struct request_info request;
struct stat st;
@@ -195,7 +194,8 @@
/* usage - explain */
-static void usage()
+static void
+usage(void)
{
fprintf(stderr, "usage: %s [-a] [-d] [-i inet_conf] [-v]\n", myname);
fprintf(stderr, " -a: report rules with implicit \"ALLOW\" at end\n");
@@ -207,22 +207,16 @@
/* parse_table - like table_match(), but examines _all_ entries */
-static void parse_table(table, request)
-char *table;
-struct request_info *request;
+static void
+parse_table(const char *table, struct request_info *request)
{
FILE *fp;
- int real_verdict;
+ volatile int real_verdict;
char sv_list[BUFLEN]; /* becomes list of daemons */
char *cl_list; /* becomes list of requests */
char *sh_cmd; /* becomes optional shell command */
int verdict;
- struct tcpd_context saved_context;
-#ifdef __GNUC__
- /* XXX hack to avoid gcc warnings */
- (void) &real_verdict;
- (void) &saved_context;
-#endif
+ volatile struct tcpd_context saved_context;
saved_context = tcpd_context; /* stupid compilers */
Home |
Main Index |
Thread Index |
Old Index