[Midnightbsd-cvs] src [11447] trunk/usr.bin/rpcgen: sync with freebsd

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Jul 7 12:38:55 EDT 2018


Revision: 11447
          http://svnweb.midnightbsd.org/src/?rev=11447
Author:   laffer1
Date:     2018-07-07 12:38:54 -0400 (Sat, 07 Jul 2018)
Log Message:
-----------
sync with freebsd

Modified Paths:
--------------
    trunk/usr.bin/rpcgen/Makefile
    trunk/usr.bin/rpcgen/rpc_clntout.c
    trunk/usr.bin/rpcgen/rpc_cout.c
    trunk/usr.bin/rpcgen/rpc_hout.c
    trunk/usr.bin/rpcgen/rpc_main.c
    trunk/usr.bin/rpcgen/rpc_parse.c
    trunk/usr.bin/rpcgen/rpc_parse.h
    trunk/usr.bin/rpcgen/rpc_sample.c
    trunk/usr.bin/rpcgen/rpc_scan.c
    trunk/usr.bin/rpcgen/rpc_scan.h
    trunk/usr.bin/rpcgen/rpc_svcout.c
    trunk/usr.bin/rpcgen/rpc_util.c

Modified: trunk/usr.bin/rpcgen/Makefile
===================================================================
--- trunk/usr.bin/rpcgen/Makefile	2018-07-07 16:38:04 UTC (rev 11446)
+++ trunk/usr.bin/rpcgen/Makefile	2018-07-07 16:38:54 UTC (rev 11447)
@@ -1,4 +1,5 @@
 # $MidnightBSD$
+# $FreeBSD: stable/10/usr.bin/rpcgen/Makefile 201386 2010-01-02 10:27:05Z ed $
 
 PROG=	rpcgen
 SRCS=	rpc_main.c  rpc_clntout.c rpc_cout.c rpc_hout.c rpc_parse.c \

Modified: trunk/usr.bin/rpcgen/rpc_clntout.c
===================================================================
--- trunk/usr.bin/rpcgen/rpc_clntout.c	2018-07-07 16:38:04 UTC (rev 11446)
+++ trunk/usr.bin/rpcgen/rpc_clntout.c	2018-07-07 16:38:54 UTC (rev 11447)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  * unrestricted use provided that this legend is included on all tape
@@ -35,7 +36,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/rpcgen/rpc_clntout.c 200462 2009-12-13 03:14:06Z delphij $");
 
 /*
  * rpc_clntout.c, Client-stub outputter for the RPC protocol compiler

Modified: trunk/usr.bin/rpcgen/rpc_cout.c
===================================================================
--- trunk/usr.bin/rpcgen/rpc_cout.c	2018-07-07 16:38:04 UTC (rev 11446)
+++ trunk/usr.bin/rpcgen/rpc_cout.c	2018-07-07 16:38:54 UTC (rev 11447)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  * unrestricted use provided that this legend is included on all tape
@@ -35,7 +36,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/rpcgen/rpc_cout.c 312386 2017-01-18 15:23:40Z pfg $");
 
 /*
  * rpc_cout.c, XDR routine outputter for the RPC protocol compiler
@@ -551,7 +552,8 @@
 	}
 
 	for (dl = def->def.st.decls; dl != NULL; dl = dl->next)
-		if (dl->decl.rel == REL_VECTOR){
+		if (dl->decl.rel == REL_VECTOR &&
+		    strcmp(dl->decl.type, "opaque") != 0){
 			f_print(fout, "\tint i;\n");
 			break;
 		}

Modified: trunk/usr.bin/rpcgen/rpc_hout.c
===================================================================
--- trunk/usr.bin/rpcgen/rpc_hout.c	2018-07-07 16:38:04 UTC (rev 11446)
+++ trunk/usr.bin/rpcgen/rpc_hout.c	2018-07-07 16:38:54 UTC (rev 11447)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  * unrestricted use provided that this legend is included on all tape
@@ -35,7 +36,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/rpcgen/rpc_hout.c 222080 2011-05-18 20:52:52Z benl $");
 
 /*
  * rpc_hout.c, Header file outputter for the RPC protocol compiler

Modified: trunk/usr.bin/rpcgen/rpc_main.c
===================================================================
--- trunk/usr.bin/rpcgen/rpc_main.c	2018-07-07 16:38:04 UTC (rev 11446)
+++ trunk/usr.bin/rpcgen/rpc_main.c	2018-07-07 16:38:54 UTC (rev 11447)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  * unrestricted use provided that this legend is included on all tape
@@ -36,7 +37,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/rpcgen/rpc_main.c 309505 2016-12-03 19:15:26Z ngie $");
 
 /*
  * rpc_main.c, Top level of the RPC protocol compiler.
@@ -64,10 +65,6 @@
 static char *generate_guard(const char *);
 static void c_initialize(void);
 
-#if !defined(__FreeBSD__) && !defined(__NetBSD__)
-char * rindex();
-#endif
-
 static void usage(void);
 static void options_usage(void);
 static int do_registers(int, const char **);
@@ -86,11 +83,11 @@
 static const char *allv[] = {
 	"rpcgen", "-s", "udp", "-s", "tcp",
 };
-static int allc = sizeof (allv)/sizeof (allv[0]);
+static int allc = nitems(allv);
 static const char *allnv[] = {
 	"rpcgen", "-s", "netpath",
 };
-static int allnc = sizeof (allnv)/sizeof (allnv[0]);
+static int allnc = nitems(allnv);
 
 /*
  * machinations for handling expanding argument list
@@ -228,7 +225,7 @@
 	const char *p;
 	const char *file;
 
-	if ((file = rindex(path, '/')) == NULL)
+	if ((file = strrchr(path, '/')) == NULL)
 		file = path;
 	else
 		file++;
@@ -439,7 +436,7 @@
 
 }
 
-const char rpcgen_table_dcl[] = "struct rpcgen_table {\n\
+static const char rpcgen_table_dcl[] = "struct rpcgen_table {\n\
 	char	*(*proc)(); \n\
 	xdrproc_t	xdr_arg; \n\
 	unsigned	len_arg; \n\
@@ -455,7 +452,7 @@
 	char *guard, *tmp, *stopat;
 
 	filename = strrchr(pathname, '/');  /* find last component */
-	filename = ((filename == 0) ? pathname : filename+1);
+	filename = ((filename == NULL) ? pathname : filename+1);
 	guard = xstrdup(filename);
 	stopat = strrchr(guard, '.');
 
@@ -819,7 +816,7 @@
 	if (allfiles){
 		mkftemp = xmalloc(strlen("makefile.") +
 		                     strlen(cmd->infile) + 1);
-		temp = (char *)rindex(cmd->infile, '.');
+		temp = strrchr(cmd->infile, '.');
 		strcpy(mkftemp, "makefile.");
 		(void) strncat(mkftemp, cmd->infile,
 			(temp - cmd->infile));
@@ -876,8 +873,8 @@
 	f_print(fout, "\t$(CC) -o $(CLIENT) $(OBJECTS_CLNT) \
 $(LDLIBS) \n\n");
 	f_print(fout, "$(SERVER) : $(OBJECTS_SVC) \n");
-	f_print(fout, "\t$(CC) -o $(SERVER) $(OBJECTS_SVC) $(LDLIBS)\n\n ");
-	f_print(fout, "clean:\n\t $(RM) -f core $(TARGETS) $(OBJECTS_CLNT) \
+	f_print(fout, "\t$(CC) -o $(SERVER) $(OBJECTS_SVC) $(LDLIBS)\n\n");
+	f_print(fout, "clean:\n\t rm -f core $(TARGETS) $(OBJECTS_CLNT) \
 $(OBJECTS_SVC) $(CLIENT) $(SERVER)\n\n");
 }
 

Modified: trunk/usr.bin/rpcgen/rpc_parse.c
===================================================================
--- trunk/usr.bin/rpcgen/rpc_parse.c	2018-07-07 16:38:04 UTC (rev 11446)
+++ trunk/usr.bin/rpcgen/rpc_parse.c	2018-07-07 16:38:54 UTC (rev 11447)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  * unrestricted use provided that this legend is included on all tape
@@ -35,7 +36,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/rpcgen/rpc_parse.c 313103 2017-02-02 19:50:28Z asomers $");
 
 /*
  * rpc_parse.c, Parser for the RPC protocol compiler
@@ -290,7 +291,6 @@
 	declaration dec;
 	case_list *cases;
 	case_list **tailp;
-	int flag;
 
 	defp->def_kind = DEF_UNION;
 	scan(TOK_IDENT, &tok);
@@ -309,7 +309,6 @@
 		cases->case_name = tok.str;
 		scan(TOK_COLON, &tok);
 		/* now peek at next token */
-		flag = 0;
 		if (peekscan(TOK_CASE, &tok)){
 			do {
 				scan2(TOK_IDENT, TOK_CHARCONST, &tok);
@@ -322,15 +321,7 @@
 				scan(TOK_COLON, &tok);
 			} while (peekscan(TOK_CASE, &tok));
 		}
-		else
-			if (flag)
-			{
 
-				*tailp = cases;
-				tailp = &cases->next;
-				cases = XALLOC(case_list);
-			};
-
 		get_declaration(&dec, DEF_UNION);
 		cases->case_decl = dec;
 		cases->contflag = 0; /* no continued case statement */

Modified: trunk/usr.bin/rpcgen/rpc_parse.h
===================================================================
--- trunk/usr.bin/rpcgen/rpc_parse.h	2018-07-07 16:38:04 UTC (rev 11446)
+++ trunk/usr.bin/rpcgen/rpc_parse.h	2018-07-07 16:38:54 UTC (rev 11447)
@@ -1,5 +1,6 @@
+/* $MidnightBSD$ */
 /*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/usr.bin/rpcgen/rpc_parse.h 152398 2005-11-13 21:17:24Z dwmalone $
  */
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for

Modified: trunk/usr.bin/rpcgen/rpc_sample.c
===================================================================
--- trunk/usr.bin/rpcgen/rpc_sample.c	2018-07-07 16:38:04 UTC (rev 11446)
+++ trunk/usr.bin/rpcgen/rpc_sample.c	2018-07-07 16:38:54 UTC (rev 11447)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  * unrestricted use provided that this legend is included on all tape
@@ -30,7 +31,7 @@
 /* #pragma ident	"@(#)rpc_sample.c	1.9	94/04/25 SMI" */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/rpcgen/rpc_sample.c 267444 2014-06-13 15:04:21Z bdrewery $");
 
 /*
  * rpc_sample.c, Sample client-server code outputter for the RPC protocol compiler
@@ -270,6 +271,7 @@
 	version_list *vp;
 
 	f_print(fout, "\n\n");
+	f_print(fout, "int\n");
 	f_print(fout, "main(int argc, char *argv[])\n{\n");
 
 	f_print(fout, "\tchar *host;");

Modified: trunk/usr.bin/rpcgen/rpc_scan.c
===================================================================
--- trunk/usr.bin/rpcgen/rpc_scan.c	2018-07-07 16:38:04 UTC (rev 11446)
+++ trunk/usr.bin/rpcgen/rpc_scan.c	2018-07-07 16:38:54 UTC (rev 11447)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  * unrestricted use provided that this legend is included on all tape
@@ -35,7 +36,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/rpcgen/rpc_scan.c 223922 2011-07-11 05:31:52Z delphij $");
 
 /*
  * rpc_scan.c, Scanner for the RPC protocol compiler

Modified: trunk/usr.bin/rpcgen/rpc_scan.h
===================================================================
--- trunk/usr.bin/rpcgen/rpc_scan.h	2018-07-07 16:38:04 UTC (rev 11446)
+++ trunk/usr.bin/rpcgen/rpc_scan.h	2018-07-07 16:38:54 UTC (rev 11447)
@@ -1,5 +1,6 @@
+/* $MidnightBSD$ */
 /*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/usr.bin/rpcgen/rpc_scan.h 152398 2005-11-13 21:17:24Z dwmalone $
  */
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for

Modified: trunk/usr.bin/rpcgen/rpc_svcout.c
===================================================================
--- trunk/usr.bin/rpcgen/rpc_svcout.c	2018-07-07 16:38:04 UTC (rev 11446)
+++ trunk/usr.bin/rpcgen/rpc_svcout.c	2018-07-07 16:38:54 UTC (rev 11447)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  * unrestricted use provided that this legend is included on all tape
@@ -35,7 +36,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/rpcgen/rpc_svcout.c 312386 2017-01-18 15:23:40Z pfg $");
 
 /*
  * rpc_svcout.c, Server-skeleton outputter for the RPC protocol compiler
@@ -54,7 +55,7 @@
 static char ROUTINE[] = "local";
 static char RETVAL[] = "retval";
 
-char _errbuf[256];	/* For all messages */
+static char _errbuf[256];	/* For all messages */
 
 void internal_proctype( proc_list * );
 static void write_real_program( definition * );
@@ -325,7 +326,7 @@
 
 /*
  * write out definition of internal function (e.g. _printmsg_1(...))
- *  which calls server's defintion of actual function (e.g. printmsg_1(...)).
+ *  which calls server's definition of actual function (e.g. printmsg_1(...)).
  *  Unpacks single user argument of printmsg_1 to call-by-value format
  *  expected by printmsg_1.
  */
@@ -728,7 +729,8 @@
 	if (tirpcflag) {
 		f_print(fout, "\t\t\tstruct rlimit rl;\n\n");
 		f_print(fout, "\t\t\trl.rlim_max = 0;\n");
-		f_print(fout, "\t\t\tgetrlimit(RLIMIT_NOFILE, &rl);\n");
+		f_print(fout, "\t\t\tif (getrlimit(RLIMIT_NOFILE, &rl) == -1)\n");
+		f_print(fout, "\t\t\t\treturn;\n");
 		f_print(fout, "\t\t\tif ((size = rl.rlim_max) == 0) {\n");
 		
 		if (mtflag)
@@ -902,7 +904,11 @@
 	/* get number of file descriptors */
 	if (tirpcflag) {
 		f_print(fout, "%srl.rlim_max = 0;\n", sp);
-		f_print(fout, "%sgetrlimit(RLIMIT_NOFILE, &rl);\n", sp);
+		f_print(fout, "%sif (getrlimit(RLIMIT_NOFILE, &rl) == -1) {\n",
+		    sp);
+		f_print(fout, "%s\tperror(\"getrlimit\");\n", sp);
+		f_print(fout, "%s\texit(1);\n", sp);
+		f_print(fout, "%s}\n", sp);
 		f_print(fout, "%sif ((size = rl.rlim_max) == 0)\n", sp);
 		f_print(fout, "%s\texit(1);\n", sp);
 	} else {

Modified: trunk/usr.bin/rpcgen/rpc_util.c
===================================================================
--- trunk/usr.bin/rpcgen/rpc_util.c	2018-07-07 16:38:04 UTC (rev 11446)
+++ trunk/usr.bin/rpcgen/rpc_util.c	2018-07-07 16:38:54 UTC (rev 11447)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  * unrestricted use provided that this legend is included on all tape
@@ -35,7 +36,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/rpcgen/rpc_util.c 241737 2012-10-19 14:49:42Z ed $");
 
 /*
  * rpc_util.c, Utility routines for the RPC protocol compiler
@@ -59,8 +60,8 @@
 const char *infilename;		/* input filename */
 
 #define	NFILES   7
-const char *outfiles[NFILES];	/* output file names */
-int nfiles;
+static const char *outfiles[NFILES]; /* output file names */
+static int nfiles;
 
 FILE *fout;			/* file pointer of current output */
 FILE *fin;			/* file pointer of current input */



More information about the Midnightbsd-cvs mailing list