Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin Remove K&R __P macros.



details:   https://anonhg.NetBSD.org/src/rev/b8b46fdf51da
branches:  trunk
changeset: 817695:b8b46fdf51da
user:      sevan <sevan%NetBSD.org@localhost>
date:      Sat Sep 03 02:24:04 2016 +0000

description:
Remove K&R __P macros.
Remove main() function prototype if present.
Mark usage() as __dead if not already.
Binaries generated with & without these patches were compared with diff -r.

diffstat:

 usr.bin/innetgr/innetgr.c   |   7 +++----
 usr.bin/mklocale/lex.l      |   6 +++---
 usr.bin/mklocale/yacc.y     |  33 +++++++++++++++------------------
 usr.bin/netgroup/netgroup.c |   7 +++----
 usr.bin/passwd/extern.h     |  32 ++++++++++++++++----------------
 usr.bin/passwd/passwd.c     |  14 +++++++-------
 usr.bin/tftp/tftp.c         |  20 ++++++++++----------
 usr.bin/vgrind/extern.h     |   8 ++++----
 8 files changed, 61 insertions(+), 66 deletions(-)

diffs (292 lines):

diff -r 6d4864233970 -r b8b46fdf51da usr.bin/innetgr/innetgr.c
--- a/usr.bin/innetgr/innetgr.c Fri Sep 02 20:25:14 2016 +0000
+++ b/usr.bin/innetgr/innetgr.c Sat Sep 03 02:24:04 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: innetgr.c,v 1.8 2012/03/20 20:34:57 matt Exp $ */
+/*     $NetBSD: innetgr.c,v 1.9 2016/09/03 02:24:04 sevan Exp $        */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,15 +30,14 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: innetgr.c,v 1.8 2012/03/20 20:34:57 matt Exp $");
+__RCSID("$NetBSD: innetgr.c,v 1.9 2016/09/03 02:24:04 sevan Exp $");
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <netgroup.h>
 
-static void usage __P((void)) __dead;
-int main __P((int, char *[]));
+static void usage(void) __dead;
 
 static void
 usage(void)
diff -r 6d4864233970 -r b8b46fdf51da usr.bin/mklocale/lex.l
--- a/usr.bin/mklocale/lex.l    Fri Sep 02 20:25:14 2016 +0000
+++ b/usr.bin/mklocale/lex.l    Sat Sep 03 02:24:04 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lex.l,v 1.18 2010/06/13 04:14:57 tnozaki Exp $ */
+/*     $NetBSD: lex.l,v 1.19 2016/09/03 02:24:04 sevan Exp $   */
 
 %{
 /*-
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)lex.l      8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: lex.l,v 1.18 2010/06/13 04:14:57 tnozaki Exp $");
+__RCSID("$NetBSD: lex.l,v 1.19 2016/09/03 02:24:04 sevan Exp $");
 #endif
 #endif /* not lint */
 
@@ -57,7 +57,7 @@
 #include "ldef.h"
 #include "yacc.h"
 
-int yylex __P((void));
+int yylex(void);
 %}
 
 ODIGIT [0-7]
diff -r 6d4864233970 -r b8b46fdf51da usr.bin/mklocale/yacc.y
--- a/usr.bin/mklocale/yacc.y   Fri Sep 02 20:25:14 2016 +0000
+++ b/usr.bin/mklocale/yacc.y   Sat Sep 03 02:24:04 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: yacc.y,v 1.31 2010/06/13 04:14:57 tnozaki Exp $        */
+/*     $NetBSD: yacc.y,v 1.32 2016/09/03 02:24:04 sevan Exp $  */
 
 %{
 /*-
@@ -43,7 +43,7 @@
 static char sccsid[] = "@(#)yacc.y     8.1 (Berkeley) 6/6/93";
 static char rcsid[] = "$FreeBSD$";
 #else
-__RCSID("$NetBSD: yacc.y,v 1.31 2010/06/13 04:14:57 tnozaki Exp $");
+__RCSID("$NetBSD: yacc.y,v 1.32 2016/09/03 02:24:04 sevan Exp $");
 #endif
 #endif /* not lint */
 
@@ -81,22 +81,21 @@
 #endif
 __nbrune_t     charsetmask = (__nbrune_t)0xffffffff;
 
-void set_map __P((rune_map *, rune_list *, u_int32_t));
-void set_digitmap __P((rune_map *, rune_list *));
-void add_map __P((rune_map *, rune_list *, u_int32_t));
+void set_map(rune_map *, rune_list *, u_int32_t);
+void set_digitmap(rune_map *, rune_list *);
+void add_map(rune_map *, rune_list *, u_int32_t);
 
-int            main __P((int, char *[]));
-void           usage __P((void));
-int            yyerror __P((const char *s));
-void           *xmalloc __P((unsigned int sz));
-u_int32_t      *xlalloc __P((unsigned int sz));
-u_int32_t      *xrelalloc __P((u_int32_t *old, unsigned int sz));
-void           dump_tables __P((void));
-int            yyparse __P((void));
-extern int     yylex __P((void));
+void           usage(void) __dead;
+int            yyerror(const char *s);
+void           *xmalloc(unsigned int sz);
+u_int32_t      *xlalloc(unsigned int sz);
+u_int32_t      *xrelalloc(u_int32_t *old, unsigned int sz);
+void           dump_tables(void);
+int            yyparse(void);
+extern int     yylex(void);
 
 /* mklocaledb.c */
-extern void mklocaledb __P((const char *, FILE *, FILE *));
+extern void mklocaledb(const char *, FILE *, FILE *);
 
 %}
 
@@ -261,9 +260,7 @@
 FILE *ofile;
 
 int
-main(ac, av)
-       int ac;
-       char *av[];
+main(int ac, char *av[])
 {
     int x;
     const char *locale_type;
diff -r 6d4864233970 -r b8b46fdf51da usr.bin/netgroup/netgroup.c
--- a/usr.bin/netgroup/netgroup.c       Fri Sep 02 20:25:14 2016 +0000
+++ b/usr.bin/netgroup/netgroup.c       Sat Sep 03 02:24:04 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netgroup.c,v 1.7 2012/03/20 20:34:58 matt Exp $        */
+/*     $NetBSD: netgroup.c,v 1.8 2016/09/03 02:24:04 sevan Exp $       */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,15 +30,14 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: netgroup.c,v 1.7 2012/03/20 20:34:58 matt Exp $");
+__RCSID("$NetBSD: netgroup.c,v 1.8 2016/09/03 02:24:04 sevan Exp $");
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <netgroup.h>
 
-static void usage __P((void)) __dead;
-int main __P((int, char *[]));
+static void usage(void) __dead;
 
 static void
 usage(void)
diff -r 6d4864233970 -r b8b46fdf51da usr.bin/passwd/extern.h
--- a/usr.bin/passwd/extern.h   Fri Sep 02 20:25:14 2016 +0000
+++ b/usr.bin/passwd/extern.h   Sat Sep 03 02:24:04 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: extern.h,v 1.14 2011/09/16 15:39:27 joerg Exp $        */
+/*     $NetBSD: extern.h,v 1.15 2016/09/03 02:24:04 sevan Exp $        */
 
 /*
  * Copyright (c) 1994
@@ -62,24 +62,24 @@
 };
 
 #ifdef KERBEROS5
-int    krb5_init __P((const char *));
-int    krb5_arg __P((char, const char *));
-int    krb5_arg_end __P((void));
-void   krb5_end __P((void));
-int    krb5_chpw __P((const char *));
+int    krb5_init(const char *);
+int    krb5_arg(char, const char *);
+int    krb5_arg_end(void);
+void   krb5_end(void);
+int    krb5_chpw(const char *);
 #endif
 #ifdef YP
-int    yp_init __P((const char *));
-int    yp_arg __P((char, const char *));
-int    yp_arg_end __P((void));
-void   yp_end __P((void));
-int    yp_chpw __P((const char *));
+int    yp_init(const char *);
+int    yp_arg(char, const char *);
+int    yp_arg_end(void);
+void   yp_end(void);
+int    yp_chpw(const char *);
 #endif
 /* local */
-int    local_init __P((const char *));
-int    local_arg __P((char, const char *));
-int    local_arg_end __P((void));
-void   local_end __P((void));
-int    local_chpw __P((const char *));
+int    local_init(const char *);
+int    local_arg(char, const char *);
+int    local_arg_end(void);
+void   local_end(void);
+int    local_chpw(const char *);
 
 #endif /* USE_PAM */
diff -r 6d4864233970 -r b8b46fdf51da usr.bin/passwd/passwd.c
--- a/usr.bin/passwd/passwd.c   Fri Sep 02 20:25:14 2016 +0000
+++ b/usr.bin/passwd/passwd.c   Sat Sep 03 02:24:04 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: passwd.c,v 1.30 2009/04/17 20:25:08 dyoung Exp $       */
+/*     $NetBSD: passwd.c,v 1.31 2016/09/03 02:24:04 sevan Exp $        */
 
 /*
  * Copyright (c) 1988, 1993, 1994
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "from: @(#)passwd.c    8.3 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: passwd.c,v 1.30 2009/04/17 20:25:08 dyoung Exp $");
+__RCSID("$NetBSD: passwd.c,v 1.31 2016/09/03 02:24:04 sevan Exp $");
 #endif
 #endif /* not lint */
 
@@ -200,12 +200,12 @@
        const char *argv0;
        const char *args;
        const char *usage;
-       int (*pw_init) __P((const char *));
-       int (*pw_arg) __P((char, const char *));
-       int (*pw_arg_end) __P((void));
-       void (*pw_end) __P((void));
+       int (*pw_init)(const char *);
+       int (*pw_arg)(char, const char *);
+       int (*pw_arg_end)(void);
+       void (*pw_end)(void);
 
-       int (*pw_chpw) __P((const char*));
+       int (*pw_chpw)(const char*);
        int invalid;
 #define        INIT_INVALID 1
 #define ARG_INVALID 2
diff -r 6d4864233970 -r b8b46fdf51da usr.bin/tftp/tftp.c
--- a/usr.bin/tftp/tftp.c       Fri Sep 02 20:25:14 2016 +0000
+++ b/usr.bin/tftp/tftp.c       Sat Sep 03 02:24:04 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tftp.c,v 1.34 2012/07/16 09:20:26 he Exp $     */
+/*     $NetBSD: tftp.c,v 1.35 2016/09/03 02:24:04 sevan Exp $  */
 
 /*
  * Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)tftp.c     8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: tftp.c,v 1.34 2012/07/16 09:20:26 he Exp $");
+__RCSID("$NetBSD: tftp.c,v 1.35 2016/09/03 02:24:04 sevan Exp $");
 #endif
 #endif /* not lint */
 
@@ -73,14 +73,14 @@
 int    timeout;
 jmp_buf        timeoutbuf;
 
-static void nak __P((int, struct sockaddr *));
-static int makerequest __P((int, const char *, struct tftphdr *, const char *, off_t));
-static void printstats __P((const char *, unsigned long));
-static void startclock __P((void));
-static void stopclock __P((void));
-__dead static void timer __P((int));
-static void tpacket __P((const char *, struct tftphdr *, int));
-static int cmpport __P((struct sockaddr *, struct sockaddr *));
+static void nak(int, struct sockaddr *);
+static int makerequest(int, const char *, struct tftphdr *, const char *, off_t);
+static void printstats(const char *, unsigned long);
+static void startclock(void);
+static void stopclock(void);
+__dead static void timer(int);
+static void tpacket(const char *, struct tftphdr *, int);
+static int cmpport(struct sockaddr *, struct sockaddr *);
 
 static void get_options(struct tftphdr *, int);
 static int tftp_igmp_join(void);
diff -r 6d4864233970 -r b8b46fdf51da usr.bin/vgrind/extern.h
--- a/usr.bin/vgrind/extern.h   Fri Sep 02 20:25:14 2016 +0000
+++ b/usr.bin/vgrind/extern.h   Sat Sep 03 02:24:04 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: extern.h,v 1.6 2014/07/15 13:17:15 christos Exp $      */
+/*     $NetBSD: extern.h,v 1.7 2016/09/03 02:24:04 sevan Exp $ */
 
 /*
  * Copyright (c) 1980, 1993
@@ -55,8 +55,8 @@
 #include <sys/cdefs.h>
 
 __BEGIN_DECLS
-extern int      STRNCMP __P((char *, char *, int));
-extern char    *convexp __P((char *));
-extern char    *expmatch __P((char *, char *, char *));
+extern int      STRNCMP(char *, char *, int);
+extern char    *convexp(char *);
+extern char    *expmatch(char *, char *, char *);
 __END_DECLS
 



Home | Main Index | Thread Index | Old Index