CVS commit: src/usr.bin/rpcgen
Module Name:src Committed By: dholland Date: Sat Jan 23 02:33:09 UTC 2016 Modified Files: src/usr.bin/rpcgen: rpc_cout.c rpc_hout.c rpc_parse.c rpc_tblout.c Log Message: u_int -> unsigned int, in some of the output. In the bulk of the output making this change would require reworking a bunch of the internals to allow spaces in type names, which at the moment doesn't seem worthwhile. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/usr.bin/rpcgen/rpc_cout.c cvs rdiff -u -r1.24 -r1.25 src/usr.bin/rpcgen/rpc_hout.c cvs rdiff -u -r1.21 -r1.22 src/usr.bin/rpcgen/rpc_parse.c cvs rdiff -u -r1.14 -r1.15 src/usr.bin/rpcgen/rpc_tblout.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/rpcgen/rpc_cout.c diff -u src/usr.bin/rpcgen/rpc_cout.c:1.37 src/usr.bin/rpcgen/rpc_cout.c:1.38 --- src/usr.bin/rpcgen/rpc_cout.c:1.37 Sun Sep 20 16:57:13 2015 +++ src/usr.bin/rpcgen/rpc_cout.c Sat Jan 23 02:33:09 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rpc_cout.c,v 1.37 2015/09/20 16:57:13 kamil Exp $ */ +/* $NetBSD: rpc_cout.c,v 1.38 2016/01/23 02:33:09 dholland Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)rpc_cout.c 1.13 89/02/22 (C) 1987 SMI"; #else -__RCSID("$NetBSD: rpc_cout.c,v 1.37 2015/09/20 16:57:13 kamil Exp $"); +__RCSID("$NetBSD: rpc_cout.c,v 1.38 2016/01/23 02:33:09 dholland Exp $"); #endif #endif @@ -203,9 +203,9 @@ static void print_ifsizeof(const char *prefix, const char *type) { if (streq(type, "bool")) { - f_print(fout, ", (u_int)sizeof(bool_t), (xdrproc_t)xdr_bool"); + f_print(fout, ", (unsigned int)sizeof(bool_t), (xdrproc_t)xdr_bool"); } else { - f_print(fout, ", (u_int)sizeof("); + f_print(fout, ", (unsigned int)sizeof("); if (undefined(type) && prefix) { f_print(fout, "%s ", prefix); } @@ -272,10 +272,10 @@ print_ifstat(int indent, const char *pre } print_ifarg("(char **)(void *)"); if (*objname == '&') { -f_print(fout, "%s.%s_val, (u_int *)%s.%s_len", +f_print(fout, "%s.%s_val, (unsigned int *)%s.%s_len", objname, name, objname, name); } else { -f_print(fout, "&%s->%s_val, (u_int *)&%s->%s_len", +f_print(fout, "&%s->%s_val, (unsigned int *)&%s->%s_len", objname, name, objname, name); } } Index: src/usr.bin/rpcgen/rpc_hout.c diff -u src/usr.bin/rpcgen/rpc_hout.c:1.24 src/usr.bin/rpcgen/rpc_hout.c:1.25 --- src/usr.bin/rpcgen/rpc_hout.c:1.24 Sun Sep 20 15:45:07 2015 +++ src/usr.bin/rpcgen/rpc_hout.c Sat Jan 23 02:33:09 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rpc_hout.c,v 1.24 2015/09/20 15:45:07 kamil Exp $ */ +/* $NetBSD: rpc_hout.c,v 1.25 2016/01/23 02:33:09 dholland Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)rpc_hout.c 1.12 89/02/22 (C) 1987 SMI"; #else -__RCSID("$NetBSD: rpc_hout.c,v 1.24 2015/09/20 15:45:07 kamil Exp $"); +__RCSID("$NetBSD: rpc_hout.c,v 1.25 2016/01/23 02:33:09 dholland Exp $"); #endif #endif @@ -447,7 +447,7 @@ ptypedef(definition *def) switch (rel) { case REL_ARRAY: f_print(fout, "struct {\n"); - f_print(fout, "\tu_int %s_len;\n", name); + f_print(fout, "\tunsigned int %s_len;\n", name); f_print(fout, "\t%s%s *%s_val;\n", prefix, old, name); f_print(fout, "} %s", name); break; @@ -511,7 +511,7 @@ pdeclaration(const char *name, declarati case REL_ARRAY: f_print(fout, "struct {\n"); tabify(fout, tab); - f_print(fout, "\tu_int %s_len;\n", dec->name); + f_print(fout, "\tunsigned int %s_len;\n", dec->name); tabify(fout, tab); f_print(fout, "\t%s%s *%s_val;\n", prefix, type, dec->name); tabify(fout, tab); Index: src/usr.bin/rpcgen/rpc_parse.c diff -u src/usr.bin/rpcgen/rpc_parse.c:1.21 src/usr.bin/rpcgen/rpc_parse.c:1.22 --- src/usr.bin/rpcgen/rpc_parse.c:1.21 Sat May 9 23:29:51 2015 +++ src/usr.bin/rpcgen/rpc_parse.c Sat Jan 23 02:33:09 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rpc_parse.c,v 1.21 2015/05/09 23:29:51 dholland Exp $ */ +/* $NetBSD: rpc_parse.c,v 1.22 2016/01/23 02:33:09 dholland Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)rpc_parse.c 1.8 89/02/22 (C) 1987 SMI"; #else -__RCSID("$NetBSD: rpc_parse.c,v 1.21 2015/05/09 23:29:51 dholland Exp $"); +__RCSID("$NetBSD: rpc_parse.c,v 1.22 2016/01/23 02:33:09 dholland Exp $"); #endif #endif @@ -440,7 +440,7 @@ get_declaration(declaration *dec, defkin } dec->rel = REL_ARRAY; if (peekscan(TOK_RANGLE, &tok)) { -dec->array_max = "(u_int)~0"; +dec->array_max = "(unsigned i
CVS commit: src/usr.bin/rpcgen
Module Name:src Committed By: christos Date: Sun Nov 8 01:59:31 UTC 2015 Modified Files: src/usr.bin/rpcgen: rpc_svcout.c Log Message: Delete extra declaration of svc_fdset... And some commented out code. This badly needs some modernization. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/usr.bin/rpcgen/rpc_svcout.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/rpcgen/rpc_svcout.c diff -u src/usr.bin/rpcgen/rpc_svcout.c:1.30 src/usr.bin/rpcgen/rpc_svcout.c:1.31 --- src/usr.bin/rpcgen/rpc_svcout.c:1.30 Sun Sep 20 11:52:11 2015 +++ src/usr.bin/rpcgen/rpc_svcout.c Sat Nov 7 20:59:31 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rpc_svcout.c,v 1.30 2015/09/20 15:52:11 kamil Exp $ */ +/* $NetBSD: rpc_svcout.c,v 1.31 2015/11/08 01:59:31 christos Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)rpc_svcout.c 1.29 89/03/30 (C) 1987 SMI"; #else -__RCSID("$NetBSD: rpc_svcout.c,v 1.30 2015/09/20 15:52:11 kamil Exp $"); +__RCSID("$NetBSD: rpc_svcout.c,v 1.31 2015/11/08 01:59:31 christos Exp $"); #endif #endif @@ -652,7 +652,6 @@ write_timeout_func(void) f_print(fout, "closedown(void)\n"); f_print(fout, "{\n"); f_print(fout, "\tif (_rpcsvcdirty == 0) {\n"); - f_print(fout, "\t\textern fd_set svc_fdset;\n"); f_print(fout, "\t\tstatic int size;\n"); f_print(fout, "\t\tint i, openfd;\n"); if (tirpcflag && pmflag) { @@ -738,8 +737,6 @@ write_pm_most(char *infile, int netflag) } if (timerflag) f_print(fout, "\t\tint pmclose;\n"); -/* not necessary, defined in /usr/include/stdlib */ -/* f_print(fout, "\t\textern char *getenv();\n");*/ f_print(fout, "\n"); f_print(fout, "\t\t_rpcpmstart = 1;\n"); if (logflag)
CVS commit: src/usr.bin/rpcgen
Module Name:src Committed By: kamil Date: Sun Sep 20 16:57:13 UTC 2015 Modified Files: src/usr.bin/rpcgen: rpc_cout.c rpc_main.c rpc_util.c Log Message: Prefer error messages resolved from errno over handwritten ones. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/usr.bin/rpcgen/rpc_cout.c cvs rdiff -u -r1.43 -r1.44 src/usr.bin/rpcgen/rpc_main.c cvs rdiff -u -r1.17 -r1.18 src/usr.bin/rpcgen/rpc_util.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/rpcgen/rpc_cout.c diff -u src/usr.bin/rpcgen/rpc_cout.c:1.36 src/usr.bin/rpcgen/rpc_cout.c:1.37 --- src/usr.bin/rpcgen/rpc_cout.c:1.36 Sat May 9 23:16:51 2015 +++ src/usr.bin/rpcgen/rpc_cout.c Sun Sep 20 16:57:13 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rpc_cout.c,v 1.36 2015/05/09 23:16:51 dholland Exp $ */ +/* $NetBSD: rpc_cout.c,v 1.37 2015/09/20 16:57:13 kamil Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)rpc_cout.c 1.13 89/02/22 (C) 1987 SMI"; #else -__RCSID("$NetBSD: rpc_cout.c,v 1.36 2015/05/09 23:16:51 dholland Exp $"); +__RCSID("$NetBSD: rpc_cout.c,v 1.37 2015/09/20 16:57:13 kamil Exp $"); #endif #endif @@ -478,8 +478,7 @@ emit_struct(definition *def) nsizestr = realloc(sizestr, strlen(sizestr) + strlen(ptemp) + 1); if (nsizestr == NULL) { - - errx(EXIT_FAILURE, "Out of memory"); + err(EXIT_FAILURE, "realloc"); } sizestr = nsizestr; sizestr = strcat(sizestr, ptemp); /* build up length of Index: src/usr.bin/rpcgen/rpc_main.c diff -u src/usr.bin/rpcgen/rpc_main.c:1.43 src/usr.bin/rpcgen/rpc_main.c:1.44 --- src/usr.bin/rpcgen/rpc_main.c:1.43 Sun Sep 20 16:39:04 2015 +++ src/usr.bin/rpcgen/rpc_main.c Sun Sep 20 16:57:13 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rpc_main.c,v 1.43 2015/09/20 16:39:04 kamil Exp $ */ +/* $NetBSD: rpc_main.c,v 1.44 2015/09/20 16:57:13 kamil Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = "@(#)rpc_main.c 1.30 89/03/30 (C) 1987 SMI"; #else -__RCSID("$NetBSD: rpc_main.c,v 1.43 2015/09/20 16:39:04 kamil Exp $"); +__RCSID("$NetBSD: rpc_main.c,v 1.44 2015/09/20 16:57:13 kamil Exp $"); #endif #endif @@ -278,7 +278,7 @@ extendfile(const char *path, const char res = alloc(strlen(file) + strlen(ext) + 1); if (res == NULL) { - errx(1, "Out of memory"); + err(EXIT_FAILURE, "Out of memory"); } p = strrchr(file, '.'); if (p == NULL) { Index: src/usr.bin/rpcgen/rpc_util.c diff -u src/usr.bin/rpcgen/rpc_util.c:1.17 src/usr.bin/rpcgen/rpc_util.c:1.18 --- src/usr.bin/rpcgen/rpc_util.c:1.17 Sat May 9 23:28:43 2015 +++ src/usr.bin/rpcgen/rpc_util.c Sun Sep 20 16:57:13 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rpc_util.c,v 1.17 2015/05/09 23:28:43 dholland Exp $ */ +/* $NetBSD: rpc_util.c,v 1.18 2015/09/20 16:57:13 kamil Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)rpc_util.c 1.11 89/02/22 (C) 1987 SMI"; #else -__RCSID("$NetBSD: rpc_util.c,v 1.17 2015/05/09 23:28:43 dholland Exp $"); +__RCSID("$NetBSD: rpc_util.c,v 1.18 2015/09/20 16:57:13 kamil Exp $"); #endif #endif @@ -432,7 +432,7 @@ make_argname(const char *pname, const ch len = strlen(pname) + strlen(vname) + strlen(ARGEXT) + 3; name = malloc(len); if (!name) { - errx(EXIT_FAILURE, "Out of memory"); + err(EXIT_FAILURE, "malloc"); } snprintf(name, len, "%s_%s_%s", locase(pname), vname, ARGEXT); return (name); @@ -447,7 +447,7 @@ add_type(int len, const char *type) bas_type *ptr; if ((ptr = malloc(sizeof(bas_type))) == NULL) { - errx(EXIT_FAILURE, "Out of memory"); + err(EXIT_FAILURE, "malloc"); } ptr->name = type; ptr->length = len;
CVS commit: src/usr.bin/rpcgen
Module Name:src Committed By: kamil Date: Sun Sep 20 16:39:04 UTC 2015 Modified Files: src/usr.bin/rpcgen: rpc_main.c Log Message: Correct #ifdef/#endif header file guards generator for files with names other than alphanumerical. For example, for a file named config-subscriber.x we were generating a symbol '_CONFIG-SUBSCRIBER_H'. Since now all non alphanumerical characters will be converted to '_' and we will prevent from generating symbols starting with "__", what's reserved for the internal compiler code parsers and generators. To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/usr.bin/rpcgen/rpc_main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/rpcgen/rpc_main.c diff -u src/usr.bin/rpcgen/rpc_main.c:1.42 src/usr.bin/rpcgen/rpc_main.c:1.43 --- src/usr.bin/rpcgen/rpc_main.c:1.42 Sat May 9 23:12:57 2015 +++ src/usr.bin/rpcgen/rpc_main.c Sun Sep 20 16:39:04 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rpc_main.c,v 1.42 2015/05/09 23:12:57 dholland Exp $ */ +/* $NetBSD: rpc_main.c,v 1.43 2015/09/20 16:39:04 kamil Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = "@(#)rpc_main.c 1.30 89/03/30 (C) 1987 SMI"; #else -__RCSID("$NetBSD: rpc_main.c,v 1.42 2015/05/09 23:12:57 dholland Exp $"); +__RCSID("$NetBSD: rpc_main.c,v 1.43 2015/09/20 16:39:04 kamil Exp $"); #endif #endif @@ -495,21 +495,56 @@ static char * generate_guard(const char *pathname) { const char *filename; - char *guard, *tmp, *tmp2; + char *guard, *tmp, *tmp2, *extdot; filename = strrchr(pathname, '/'); /* find last component */ filename = ((filename == 0) ? pathname : filename + 1); guard = strdup(filename); - /* convert to upper case */ - tmp = guard; - while (*tmp) { - *tmp = toupper((unsigned char)*tmp); - tmp++; + if (guard == NULL) { + err(EXIT_FAILURE, "strdup"); } + extdot = strrchr(guard, '.'); + /* + * Convert to valid C symbol name and make it upper case. + * Map non alphanumerical characters to '_'. + * + * Leave extension as it is. It will be handled in extendfile(). + */ + for (tmp = guard; *tmp; tmp++) { + if (islower((unsigned char)*tmp)) + *tmp = toupper((unsigned char)*tmp); + else if (isupper((unsigned char)*tmp)) + continue; + else if (isdigit((unsigned char)*tmp)) + continue; + else if (*tmp == '_') + continue; + else if (tmp == extdot) + break; + else + *tmp = '_'; + } + + /* + * Can't have a '_' or '.' at the front of a symbol name, beacuse it + * will end up as "__". + * + * Prefix it with "RPCGEN_". + */ + if (guard[0] == '_' || guard[0] == '.') { + if (asprintf(&tmp2, "RPCGEN_%s", guard) == -1) { + err(EXIT_FAILURE, "asprintf"); + } + free(guard); + guard = tmp2; + } + + /* Replace the file extension */ tmp2 = extendfile(guard, "_H_RPCGEN"); free(guard); guard = tmp2; + return (guard); }
CVS commit: src/usr.bin/rpcgen
Module Name:src Committed By: kamil Date: Sun Sep 20 15:52:11 UTC 2015 Modified Files: src/usr.bin/rpcgen: rpc_svcout.c Log Message: Correct newstyle code generation For newstyle we used to generate oldstyle code. This bug has been fixed in FreeBSD on 13 Dec 1995 by wpaul. https://github.com/freebsd/freebsd/commit/15a1e09c3d41cb01afc70a2ea4d20c5a0d09348a Reviewed by , To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/usr.bin/rpcgen/rpc_svcout.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/rpcgen/rpc_svcout.c diff -u src/usr.bin/rpcgen/rpc_svcout.c:1.29 src/usr.bin/rpcgen/rpc_svcout.c:1.30 --- src/usr.bin/rpcgen/rpc_svcout.c:1.29 Sat May 9 21:44:47 2015 +++ src/usr.bin/rpcgen/rpc_svcout.c Sun Sep 20 15:52:11 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rpc_svcout.c,v 1.29 2015/05/09 21:44:47 christos Exp $ */ +/* $NetBSD: rpc_svcout.c,v 1.30 2015/09/20 15:52:11 kamil Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)rpc_svcout.c 1.29 89/03/30 (C) 1987 SMI"; #else -__RCSID("$NetBSD: rpc_svcout.c,v 1.29 2015/05/09 21:44:47 christos Exp $"); +__RCSID("$NetBSD: rpc_svcout.c,v 1.30 2015/09/20 15:52:11 kamil Exp $"); #endif #endif @@ -449,9 +449,12 @@ write_program(definition *def, const cha "\t\t%s = (char *(*)(char *, struct svc_req *))", ROUTINE); - if (newstyle) /* new style: calls internal routine */ + if (newstyle) { /* new style: calls internal routine */ f_print(fout, "_"); - pvname_svc(proc->proc_name, vp->vers_num); +pvname(proc->proc_name, vp->vers_num); + } else { +pvname_svc(proc->proc_name, vp->vers_num); + } f_print(fout, ";\n"); f_print(fout, "\t\tbreak;\n\n"); }
CVS commit: src/usr.bin/rpcgen
Module Name:src Committed By: kamil Date: Sun Sep 20 15:45:07 UTC 2015 Modified Files: src/usr.bin/rpcgen: rpc_hout.c Log Message: Fix NULL pointer dereference After the last function improvements there is invalid plist dereference at the beginning of the second for () external loop. Move the proper check inside the internal secound for () loop, after plist reinitialization. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/usr.bin/rpcgen/rpc_hout.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/rpcgen/rpc_hout.c diff -u src/usr.bin/rpcgen/rpc_hout.c:1.23 src/usr.bin/rpcgen/rpc_hout.c:1.24 --- src/usr.bin/rpcgen/rpc_hout.c:1.23 Sat May 9 23:12:57 2015 +++ src/usr.bin/rpcgen/rpc_hout.c Sun Sep 20 15:45:07 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rpc_hout.c,v 1.23 2015/05/09 23:12:57 dholland Exp $ */ +/* $NetBSD: rpc_hout.c,v 1.24 2015/09/20 15:45:07 kamil Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)rpc_hout.c 1.12 89/02/22 (C) 1987 SMI"; #else -__RCSID("$NetBSD: rpc_hout.c,v 1.23 2015/05/09 23:12:57 dholland Exp $"); +__RCSID("$NetBSD: rpc_hout.c,v 1.24 2015/09/20 15:45:07 kamil Exp $"); #endif #endif @@ -193,10 +193,11 @@ pargdef(definition *def) } did = 0; for (vers = def->def.pr.versions; vers != NULL; vers = vers->next) { - if (!newstyle || plist->arg_num < 2) { - continue; /* old style or single args */ - } for (plist = vers->procs; plist != NULL; plist = plist->next) { + if (!newstyle || plist->arg_num < 2) { +continue; /* old style or single args */ + } + if (!did) { cplusplusstart(); did = 1;
CVS commit: src/usr.bin/rpcgen
Module Name:src Committed By: joerg Date: Wed May 13 20:13:22 UTC 2015 Modified Files: src/usr.bin/rpcgen: rpc_util.h Log Message: Mark error as dead. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/usr.bin/rpcgen/rpc_util.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/rpcgen/rpc_util.h diff -u src/usr.bin/rpcgen/rpc_util.h:1.11 src/usr.bin/rpcgen/rpc_util.h:1.12 --- src/usr.bin/rpcgen/rpc_util.h:1.11 Sat May 9 23:28:43 2015 +++ src/usr.bin/rpcgen/rpc_util.h Wed May 13 20:13:21 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rpc_util.h,v 1.11 2015/05/09 23:28:43 dholland Exp $ */ +/* $NetBSD: rpc_util.h,v 1.12 2015/05/13 20:13:21 joerg Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -114,7 +114,7 @@ int isvectordef(const char *, relation); char *locase(const char *); void pvname_svc(const char *, const char *); void pvname(const char *, const char *); -__printflike(1, 2) void error(const char *, ...); +__dead __printflike(1, 2) void error(const char *, ...); void crash(void); void record_open(const char *); void expected1(tok_kind) __dead;
CVS commit: src/usr.bin/rpcgen
Module Name:src Committed By: dholland Date: Sat May 9 23:29:52 UTC 2015 Modified Files: src/usr.bin/rpcgen: rpc_parse.c Log Message: Remove pointless casts. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/usr.bin/rpcgen/rpc_parse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/rpcgen/rpc_parse.c diff -u src/usr.bin/rpcgen/rpc_parse.c:1.20 src/usr.bin/rpcgen/rpc_parse.c:1.21 --- src/usr.bin/rpcgen/rpc_parse.c:1.20 Sat May 9 23:28:43 2015 +++ src/usr.bin/rpcgen/rpc_parse.c Sat May 9 23:29:51 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rpc_parse.c,v 1.20 2015/05/09 23:28:43 dholland Exp $ */ +/* $NetBSD: rpc_parse.c,v 1.21 2015/05/09 23:29:51 dholland Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)rpc_parse.c 1.8 89/02/22 (C) 1987 SMI"; #else -__RCSID("$NetBSD: rpc_parse.c,v 1.20 2015/05/09 23:28:43 dholland Exp $"); +__RCSID("$NetBSD: rpc_parse.c,v 1.21 2015/05/09 23:29:51 dholland Exp $"); #endif #endif @@ -484,7 +484,7 @@ get_prog_declaration(declaration *dec, d sprintf(name, "%s%d", ARGNAME, num); /* default name of * argument */ - dec->name = (char *) strdup(name); + dec->name = strdup(name); if (streq(dec->type, "void")) { return; @@ -498,7 +498,7 @@ get_prog_declaration(declaration *dec, d } dec->rel = REL_POINTER; if (peekscan(TOK_IDENT, &tok)) /* optional name of argument */ - dec->name = (char *) strdup(tok.str); + dec->name = strdup(tok.str); } if (peekscan(TOK_LANGLE, &tok)) { if (!streq(dec->type, "string")) {
CVS commit: src/usr.bin/rpcgen
Module Name:src Committed By: dholland Date: Sat May 9 23:28:43 UTC 2015 Modified Files: src/usr.bin/rpcgen: rpc_parse.c rpc_scan.c rpc_util.c rpc_util.h Log Message: Make error() printflike instead of using sprintf before calling it. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/usr.bin/rpcgen/rpc_parse.c cvs rdiff -u -r1.14 -r1.15 src/usr.bin/rpcgen/rpc_scan.c cvs rdiff -u -r1.16 -r1.17 src/usr.bin/rpcgen/rpc_util.c cvs rdiff -u -r1.10 -r1.11 src/usr.bin/rpcgen/rpc_util.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/rpcgen/rpc_parse.c diff -u src/usr.bin/rpcgen/rpc_parse.c:1.19 src/usr.bin/rpcgen/rpc_parse.c:1.20 --- src/usr.bin/rpcgen/rpc_parse.c:1.19 Sat May 9 23:12:57 2015 +++ src/usr.bin/rpcgen/rpc_parse.c Sat May 9 23:28:43 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rpc_parse.c,v 1.19 2015/05/09 23:12:57 dholland Exp $ */ +/* $NetBSD: rpc_parse.c,v 1.20 2015/05/09 23:28:43 dholland Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)rpc_parse.c 1.8 89/02/22 (C) 1987 SMI"; #else -__RCSID("$NetBSD: rpc_parse.c,v 1.19 2015/05/09 23:12:57 dholland Exp $"); +__RCSID("$NetBSD: rpc_parse.c,v 1.20 2015/05/09 23:28:43 dholland Exp $"); #endif #endif @@ -377,21 +377,16 @@ static void check_type_name(const char *name, int new_type) { int i; - chartmp[100]; for (i = 0; reserved_words[i] != NULL; i++) { if (strcmp(name, reserved_words[i]) == 0) { - sprintf(tmp, - "Illegal (reserved) name '%s' in type definition", name); - error(tmp); + error("Illegal (reserved) name '%s' in type definition", name); } } if (new_type) { for (i = 0; reserved_types[i] != NULL; i++) { if (strcmp(name, reserved_types[i]) == 0) { -sprintf(tmp, -"Illegal (reserved) name '%s' in type definition", name); -error(tmp); +error("Illegal (reserved) name '%s' in type definition", name); } } } Index: src/usr.bin/rpcgen/rpc_scan.c diff -u src/usr.bin/rpcgen/rpc_scan.c:1.14 src/usr.bin/rpcgen/rpc_scan.c:1.15 --- src/usr.bin/rpcgen/rpc_scan.c:1.14 Sat May 9 23:12:57 2015 +++ src/usr.bin/rpcgen/rpc_scan.c Sat May 9 23:28:43 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rpc_scan.c,v 1.14 2015/05/09 23:12:57 dholland Exp $ */ +/* $NetBSD: rpc_scan.c,v 1.15 2015/05/09 23:28:43 dholland Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)rpc_scan.c 1.11 89/02/22 (C) 1987 SMI"; #else -__RCSID("$NetBSD: rpc_scan.c,v 1.14 2015/05/09 23:12:57 dholland Exp $"); +__RCSID("$NetBSD: rpc_scan.c,v 1.15 2015/05/09 23:28:43 dholland Exp $"); #endif #endif @@ -283,17 +283,11 @@ get_token(token *tokp) default: if (!(isalpha((unsigned char)*where) || *where == '_')) { - charbuf[100]; - char *p; - - s_print(buf, "Illegal character in file: "); - p = buf + strlen(buf); if (isprint((unsigned char)*where)) { -s_print(p, "%c", *where); +error("Illegal character '%c' in file", *where); } else { -s_print(p, "%d", *where); +error("Illegal character %d in file", *where); } - error(buf); } findkind(&where, tokp); break; Index: src/usr.bin/rpcgen/rpc_util.c diff -u src/usr.bin/rpcgen/rpc_util.c:1.16 src/usr.bin/rpcgen/rpc_util.c:1.17 --- src/usr.bin/rpcgen/rpc_util.c:1.16 Sat May 9 23:16:51 2015 +++ src/usr.bin/rpcgen/rpc_util.c Sat May 9 23:28:43 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rpc_util.c,v 1.16 2015/05/09 23:16:51 dholland Exp $ */ +/* $NetBSD: rpc_util.c,v 1.17 2015/05/09 23:28:43 dholland Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)rpc_util.c 1.11 89/02/22 (C) 1987 SMI"; #else -__RCSID("$NetBSD: rpc_util.c,v 1.16 2015/05/09 23:16:51 dholland Exp $"); +__RCSID("$NetBSD: rpc_util.c,v 1.17 2015/05/09 23:28:43 dholland Exp $"); #endif #endif @@ -254,11 +254,17 @@ pvname(const char *pname, const char *vn /* * print a useful (?) error message, and then die */ -void -error(const char *msg) +__printflike(1, 2) void +error(const char *msg, ...) { + va_list ap; + printwhere(); - f_print(stderr, "%s:%d: %s", infilename, linenum, msg); + fprintf(stderr, "%s:%d: ", infilename, linenum); + va_start(ap, msg); + vfprintf(stderr, msg, ap); + va_end(ap); + fprintf(stderr, "\n"); errx(EXIT_FAILURE, "Cannot recover from this error"); } /* @@ -288,17 +294,13 @@ record_open(const char *file) } } -static char expectbuf[100]; - /* * error, token encountered was not the expected one */ void expected1(tok_kind exp1) { -
CVS commit: src/usr.bin/rpcgen
Module Name:src Committed By: dholland Date: Sat May 9 23:19:34 UTC 2015 Modified Files: src/usr.bin/rpcgen: rpc_util.h Log Message: Use proper (enough) parentheses in macro expansion. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/usr.bin/rpcgen/rpc_util.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/rpcgen/rpc_util.h diff -u src/usr.bin/rpcgen/rpc_util.h:1.9 src/usr.bin/rpcgen/rpc_util.h:1.10 --- src/usr.bin/rpcgen/rpc_util.h:1.9 Sat May 9 21:44:47 2015 +++ src/usr.bin/rpcgen/rpc_util.h Sat May 9 23:19:34 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rpc_util.h,v 1.9 2015/05/09 21:44:47 christos Exp $ */ +/* $NetBSD: rpc_util.h,v 1.10 2015/05/09 23:19:34 dholland Exp $ */ /* * 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,8 +35,8 @@ * rpc_util.h, Useful definitions for the RPC protocol compiler */ -#define alloc(size) (void *)malloc((unsigned)(size)) -#define ALLOC(object) (object *) malloc(sizeof(object)) +#define alloc(size) ((char *)malloc((size_t)(size))) +#define ALLOC(object) ((object *)malloc(sizeof(object))) #define s_print (void) sprintf #define f_print (void) fprintf
CVS commit: src/usr.bin/rpcgen
Module Name:src Committed By: dholland Date: Sat May 9 23:16:51 UTC 2015 Modified Files: src/usr.bin/rpcgen: rpc_cout.c rpc_util.c Log Message: Use errx when malloc fails, and also don't cast the return value of malloc/realloc. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/usr.bin/rpcgen/rpc_cout.c cvs rdiff -u -r1.15 -r1.16 src/usr.bin/rpcgen/rpc_util.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/rpcgen/rpc_cout.c diff -u src/usr.bin/rpcgen/rpc_cout.c:1.35 src/usr.bin/rpcgen/rpc_cout.c:1.36 --- src/usr.bin/rpcgen/rpc_cout.c:1.35 Sat May 9 23:14:22 2015 +++ src/usr.bin/rpcgen/rpc_cout.c Sat May 9 23:16:51 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rpc_cout.c,v 1.35 2015/05/09 23:14:22 dholland Exp $ */ +/* $NetBSD: rpc_cout.c,v 1.36 2015/05/09 23:16:51 dholland Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)rpc_cout.c 1.13 89/02/22 (C) 1987 SMI"; #else -__RCSID("$NetBSD: rpc_cout.c,v 1.35 2015/05/09 23:14:22 dholland Exp $"); +__RCSID("$NetBSD: rpc_cout.c,v 1.36 2015/05/09 23:16:51 dholland Exp $"); #endif #endif @@ -476,7 +476,7 @@ emit_struct(definition *def) else { char *nsizestr; - nsizestr = (char *) realloc(sizestr, strlen(sizestr) + strlen(ptemp) + 1); + nsizestr = realloc(sizestr, strlen(sizestr) + strlen(ptemp) + 1); if (nsizestr == NULL) { errx(EXIT_FAILURE, "Out of memory"); @@ -711,11 +711,10 @@ upcase(const char *str) char *ptr, *hptr; - ptr = (char *) malloc(strlen(str) + 1); + ptr = malloc(strlen(str) + 1); if (ptr == NULL) { - f_print(stderr, "malloc failed\n"); - exit(1); - }; + errx(EXIT_FAILURE, "Out of memory"); + } hptr = ptr; while (*str != '\0') Index: src/usr.bin/rpcgen/rpc_util.c diff -u src/usr.bin/rpcgen/rpc_util.c:1.15 src/usr.bin/rpcgen/rpc_util.c:1.16 --- src/usr.bin/rpcgen/rpc_util.c:1.15 Sat May 9 23:12:57 2015 +++ src/usr.bin/rpcgen/rpc_util.c Sat May 9 23:16:51 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rpc_util.c,v 1.15 2015/05/09 23:12:57 dholland Exp $ */ +/* $NetBSD: rpc_util.c,v 1.16 2015/05/09 23:16:51 dholland Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)rpc_util.c 1.11 89/02/22 (C) 1987 SMI"; #else -__RCSID("$NetBSD: rpc_util.c,v 1.15 2015/05/09 23:12:57 dholland Exp $"); +__RCSID("$NetBSD: rpc_util.c,v 1.16 2015/05/09 23:16:51 dholland Exp $"); #endif #endif @@ -432,8 +432,7 @@ make_argname(const char *pname, const ch len = strlen(pname) + strlen(vname) + strlen(ARGEXT) + 3; name = malloc(len); if (!name) { - fprintf(stderr, "failed in malloc"); - exit(1); + errx(EXIT_FAILURE, "Out of memory"); } snprintf(name, len, "%s_%s_%s", locase(pname), vname, ARGEXT); return (name); @@ -448,8 +447,7 @@ add_type(int len, const char *type) bas_type *ptr; if ((ptr = malloc(sizeof(bas_type))) == NULL) { - fprintf(stderr, "failed in malloc"); - exit(1); + errx(EXIT_FAILURE, "Out of memory"); } ptr->name = type; ptr->length = len;
CVS commit: src/usr.bin/rpcgen
Module Name:src Committed By: dholland Date: Sat May 9 23:14:22 UTC 2015 Modified Files: src/usr.bin/rpcgen: rpc_cout.c Log Message: one crash -> errx Christos missed To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/usr.bin/rpcgen/rpc_cout.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/rpcgen/rpc_cout.c diff -u src/usr.bin/rpcgen/rpc_cout.c:1.34 src/usr.bin/rpcgen/rpc_cout.c:1.35 --- src/usr.bin/rpcgen/rpc_cout.c:1.34 Sat May 9 23:12:57 2015 +++ src/usr.bin/rpcgen/rpc_cout.c Sat May 9 23:14:22 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rpc_cout.c,v 1.34 2015/05/09 23:12:57 dholland Exp $ */ +/* $NetBSD: rpc_cout.c,v 1.35 2015/05/09 23:14:22 dholland Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)rpc_cout.c 1.13 89/02/22 (C) 1987 SMI"; #else -__RCSID("$NetBSD: rpc_cout.c,v 1.34 2015/05/09 23:12:57 dholland Exp $"); +__RCSID("$NetBSD: rpc_cout.c,v 1.35 2015/05/09 23:14:22 dholland Exp $"); #endif #endif @@ -479,8 +479,7 @@ emit_struct(definition *def) nsizestr = (char *) realloc(sizestr, strlen(sizestr) + strlen(ptemp) + 1); if (nsizestr == NULL) { - f_print(stderr, "Fatal error : no memory\n"); - crash(); + errx(EXIT_FAILURE, "Out of memory"); } sizestr = nsizestr; sizestr = strcat(sizestr, ptemp); /* build up length of
CVS commit: src/usr.bin/rpcgen
Module Name:src Committed By: dholland Date: Sat May 9 23:12:57 UTC 2015 Modified Files: src/usr.bin/rpcgen: rpc_cout.c rpc_hout.c rpc_main.c rpc_parse.c rpc_scan.c rpc_util.c Log Message: Polish the error messages. Don't use warn/err to print error messages about the input, as prepending the program name to those both isn't helpful and confuses programs that try to parse compile logs. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/usr.bin/rpcgen/rpc_cout.c cvs rdiff -u -r1.22 -r1.23 src/usr.bin/rpcgen/rpc_hout.c cvs rdiff -u -r1.41 -r1.42 src/usr.bin/rpcgen/rpc_main.c cvs rdiff -u -r1.18 -r1.19 src/usr.bin/rpcgen/rpc_parse.c cvs rdiff -u -r1.13 -r1.14 src/usr.bin/rpcgen/rpc_scan.c cvs rdiff -u -r1.14 -r1.15 src/usr.bin/rpcgen/rpc_util.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/rpcgen/rpc_cout.c diff -u src/usr.bin/rpcgen/rpc_cout.c:1.33 src/usr.bin/rpcgen/rpc_cout.c:1.34 --- src/usr.bin/rpcgen/rpc_cout.c:1.33 Sun Dec 15 00:40:17 2013 +++ src/usr.bin/rpcgen/rpc_cout.c Sat May 9 23:12:57 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rpc_cout.c,v 1.33 2013/12/15 00:40:17 christos Exp $ */ +/* $NetBSD: rpc_cout.c,v 1.34 2015/05/09 23:12:57 dholland Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)rpc_cout.c 1.13 89/02/22 (C) 1987 SMI"; #else -__RCSID("$NetBSD: rpc_cout.c,v 1.33 2013/12/15 00:40:17 christos Exp $"); +__RCSID("$NetBSD: rpc_cout.c,v 1.34 2015/05/09 23:12:57 dholland Exp $"); #endif #endif @@ -112,7 +112,7 @@ emit(definition *def) break; case DEF_PROGRAM: case DEF_CONST: - errx(1, "Internal error %s, %d: Case %d not handled", + errx(1, "Internal error at %s:%d: Case %d not handled", __FILE__, __LINE__, def->def_kind); break; } @@ -660,7 +660,7 @@ emit_inline(declaration *decl, int flag) break; case REL_ARRAY: case REL_POINTER: - errx(1, "Internal error %s, %d: Case %d not handled", + errx(1, "Internal error at %s:%d: Case %d not handled", __FILE__, __LINE__, decl->rel); } } Index: src/usr.bin/rpcgen/rpc_hout.c diff -u src/usr.bin/rpcgen/rpc_hout.c:1.22 src/usr.bin/rpcgen/rpc_hout.c:1.23 --- src/usr.bin/rpcgen/rpc_hout.c:1.22 Sun Dec 15 00:40:17 2013 +++ src/usr.bin/rpcgen/rpc_hout.c Sat May 9 23:12:57 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rpc_hout.c,v 1.22 2013/12/15 00:40:17 christos Exp $ */ +/* $NetBSD: rpc_hout.c,v 1.23 2015/05/09 23:12:57 dholland Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)rpc_hout.c 1.12 89/02/22 (C) 1987 SMI"; #else -__RCSID("$NetBSD: rpc_hout.c,v 1.22 2013/12/15 00:40:17 christos Exp $"); +__RCSID("$NetBSD: rpc_hout.c,v 1.23 2015/05/09 23:12:57 dholland Exp $"); #endif #endif @@ -281,7 +281,7 @@ define_printed(proc_list *stop, version_ } } } - errx(1, "Internal error %s, %d: procedure not found", + errx(1, "Internal error at %s:%d: procedure not found", __FILE__, __LINE__); /* NOTREACHED */ } Index: src/usr.bin/rpcgen/rpc_main.c diff -u src/usr.bin/rpcgen/rpc_main.c:1.41 src/usr.bin/rpcgen/rpc_main.c:1.42 --- src/usr.bin/rpcgen/rpc_main.c:1.41 Sat May 9 22:58:22 2015 +++ src/usr.bin/rpcgen/rpc_main.c Sat May 9 23:12:57 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rpc_main.c,v 1.41 2015/05/09 22:58:22 dholland Exp $ */ +/* $NetBSD: rpc_main.c,v 1.42 2015/05/09 23:12:57 dholland Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = "@(#)rpc_main.c 1.30 89/03/30 (C) 1987 SMI"; #else -__RCSID("$NetBSD: rpc_main.c,v 1.41 2015/05/09 22:58:22 dholland Exp $"); +__RCSID("$NetBSD: rpc_main.c,v 1.42 2015/05/09 23:12:57 dholland Exp $"); #endif #endif @@ -300,11 +300,11 @@ open_output(const char *infile, const ch return; } if (infile != NULL && streq(outfile, infile)) { - errx(EXIT_FAILURE, "output would overwrite `%s'", infile); + errx(EXIT_FAILURE, "Output would overwrite `%s'", infile); } fout = fopen(outfile, "w"); if (fout == NULL) { - err(EXIT_FAILURE, "Can't to open `%s'", outfile); + err(EXIT_FAILURE, "Can't open `%s'", outfile); } record_open(outfile); @@ -359,7 +359,7 @@ open_input(const char *infile, const cha retval = spawnvp(P_WAIT, arglist[0], arglist); if (retval != 0) { - err(EXIT_FAILURE, "C PreProcessor failed"); + err(EXIT_FAILURE, "C preprocessor failed"); } fnsplit(infile, drive, dir, name, ext); fnmerge(cppfile, drive, dir, name, ".i"); @@ -832,7 +832,7 @@ static void addarg(const char *cp) { if (argcount >= ARGLISTLEN) { - errx(EXIT_FAILURE, "too many defines"); + errx(EXIT_FAILURE, "Internal e
CVS commit: src/usr.bin/rpcgen
Module Name:src Committed By: dholland Date: Sat May 9 22:58:22 UTC 2015 Modified Files: src/usr.bin/rpcgen: rpc_main.c Log Message: #if 0 code should still compile :-) To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/usr.bin/rpcgen/rpc_main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/rpcgen/rpc_main.c diff -u src/usr.bin/rpcgen/rpc_main.c:1.40 src/usr.bin/rpcgen/rpc_main.c:1.41 --- src/usr.bin/rpcgen/rpc_main.c:1.40 Sat May 9 21:44:47 2015 +++ src/usr.bin/rpcgen/rpc_main.c Sat May 9 22:58:22 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rpc_main.c,v 1.40 2015/05/09 21:44:47 christos Exp $ */ +/* $NetBSD: rpc_main.c,v 1.41 2015/05/09 22:58:22 dholland Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = "@(#)rpc_main.c 1.30 89/03/30 (C) 1987 SMI"; #else -__RCSID("$NetBSD: rpc_main.c,v 1.40 2015/05/09 21:44:47 christos Exp $"); +__RCSID("$NetBSD: rpc_main.c,v 1.41 2015/05/09 22:58:22 dholland Exp $"); #endif #endif @@ -870,7 +870,8 @@ checkfiles(const char *infile, const cha if (stat(outfile, &buf) < 0) return; /* file does not exist */ else { - errx("`%s' already exists and may be overwritten", + errx(EXIT_FAILURE, + "`%s' already exists and may be overwritten", outfile); } }
CVS commit: src/usr.bin/rpcgen
Module Name:src Committed By: christos Date: Sat May 9 21:44:48 UTC 2015 Modified Files: src/usr.bin/rpcgen: rpc_main.c rpc_parse.h rpc_scan.h rpc_svcout.c rpc_util.c rpc_util.h Log Message: modernize: - make crash() called atexit - use err/errx - remove __P To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/usr.bin/rpcgen/rpc_main.c cvs rdiff -u -r1.5 -r1.6 src/usr.bin/rpcgen/rpc_parse.h cvs rdiff -u -r1.9 -r1.10 src/usr.bin/rpcgen/rpc_scan.h cvs rdiff -u -r1.28 -r1.29 src/usr.bin/rpcgen/rpc_svcout.c cvs rdiff -u -r1.13 -r1.14 src/usr.bin/rpcgen/rpc_util.c cvs rdiff -u -r1.8 -r1.9 src/usr.bin/rpcgen/rpc_util.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/rpcgen/rpc_main.c diff -u src/usr.bin/rpcgen/rpc_main.c:1.39 src/usr.bin/rpcgen/rpc_main.c:1.40 --- src/usr.bin/rpcgen/rpc_main.c:1.39 Sun Dec 15 04:18:31 2013 +++ src/usr.bin/rpcgen/rpc_main.c Sat May 9 17:44:47 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rpc_main.c,v 1.39 2013/12/15 09:18:31 wiz Exp $ */ +/* $NetBSD: rpc_main.c,v 1.40 2015/05/09 21:44:47 christos Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = "@(#)rpc_main.c 1.30 89/03/30 (C) 1987 SMI"; #else -__RCSID("$NetBSD: rpc_main.c,v 1.39 2013/12/15 09:18:31 wiz Exp $"); +__RCSID("$NetBSD: rpc_main.c,v 1.40 2015/05/09 21:44:47 christos Exp $"); #endif #endif @@ -128,6 +128,7 @@ int logflag; /* Use syslog instead int tblflag; /* Support for dispatch table file */ int BSDflag; /* use BSD cplusplus macros */ int callerflag; /* Generate svc_caller() function */ +int docleanup = 1; /* cause atexit to remove files */ #define INLINE 3 /*length at which to start doing an inline */ @@ -187,6 +188,7 @@ main(int argc, char *argv[]) (void) memset((char *) &cmd, 0, sizeof(struct commandline)); clear_args(); + atexit(crash); if (!parseargs(argc, argv, &cmd)) usage(); @@ -255,6 +257,7 @@ main(int argc, char *argv[]) (void) unlink(dos_cppfile); } #endif + docleanup = 0; exit(nonfatalerrors); /* NOTREACHED */ } @@ -297,15 +300,11 @@ open_output(const char *infile, const ch return; } if (infile != NULL && streq(outfile, infile)) { - f_print(stderr, "%s: output would overwrite %s\n", cmdname, - infile); - crash(); + errx(EXIT_FAILURE, "output would overwrite `%s'", infile); } fout = fopen(outfile, "w"); if (fout == NULL) { - f_print(stderr, "%s: unable to open ", cmdname); - perror(outfile); - crash(); + err(EXIT_FAILURE, "Can't to open `%s'", outfile); } record_open(outfile); @@ -360,22 +359,18 @@ open_input(const char *infile, const cha retval = spawnvp(P_WAIT, arglist[0], arglist); if (retval != 0) { - fprintf(stderr, "%s: C PreProcessor failed\n", cmdname); - crash(); + err(EXIT_FAILURE, "C PreProcessor failed"); } fnsplit(infile, drive, dir, name, ext); fnmerge(cppfile, drive, dir, name, ".i"); fin = fopen(cppfile, "r"); if (fin == NULL) { - f_print(stderr, "%s: ", cmdname); - perror(cppfile); - crash(); + err(EXIT_FAILURE, "Can't open `%s'", cppfile); } dos_cppfile = strdup(cppfile); if (dos_cppfile == NULL) { - fprintf(stderr, "%s: out of memory\n", cmdname); - crash(); + err(EXIT_FAILURE, "Can't copy `%s'", cppfile); } } #else @@ -391,17 +386,15 @@ open_input(const char *infile, const cha (void) dup2(pd[1], 1); (void) close(pd[0]); execvp(arglist[0], __UNCONST(arglist)); - err(1, "$RPCGEN_CPP: %s", CPP); + err(EXIT_FAILURE, "$RPCGEN_CPP: %s", CPP); case -1: - err(1, "fork"); + err(EXIT_FAILURE, "fork"); } (void) close(pd[1]); fin = fdopen(pd[0], "r"); #endif if (fin == NULL) { - f_print(stderr, "%s: ", cmdname); - perror(infilename); - crash(); + err(EXIT_FAILURE, "Can't open `%s'", infilename); } } /* valid tirpc nettypes */ @@ -543,7 +536,7 @@ h_output(const char *infile, const char else { guard = strdup("STDIN_"); if (guard == NULL) { - err(1, "strdup"); + err(EXIT_FAILURE, "strdup"); } } @@ -608,6 +601,7 @@ s_output(int argc, char *argv[], char *i f_print(fout, "#include \n"); f_print(fout, "#include \n"); f_print(fout, "#include \n"); + f_print(fout, "#include \n"); f_print(fout, "#include \n"); f_print(fout, "#include \n"); f_print(fout, "#include \n"); @@ -780,6 +774,7 @@ clnt_output(const char *infile, const ch open_output(infile, outfilename); add_sample_msg(); f_print(fout, "#include \n"); + f_print(fout, "#include \n"); if (infile && (include = extendfile(infile, ".h"))) { f_print(fout, "#include \"%s\"\n", include); free(include); @@ -837,8 +832,7 @@ static void addarg(const char *cp) { if (argcount >= ARGLISTLEN) { - f_print(stderr, "rpcgen: too many defines\n"); - crash(); + errx(EXIT_FAILURE, "too many define
CVS commit: src/usr.bin/rpcgen
Module Name:src Committed By: dholland Date: Sat May 9 18:48:14 UTC 2015 Modified Files: src/usr.bin/rpcgen: rpc_svcout.c Log Message: Also check the other emitted getrlimit call for failure. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/usr.bin/rpcgen/rpc_svcout.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/rpcgen/rpc_svcout.c diff -u src/usr.bin/rpcgen/rpc_svcout.c:1.27 src/usr.bin/rpcgen/rpc_svcout.c:1.28 --- src/usr.bin/rpcgen/rpc_svcout.c:1.27 Sat May 9 15:12:12 2015 +++ src/usr.bin/rpcgen/rpc_svcout.c Sat May 9 18:48:14 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rpc_svcout.c,v 1.27 2015/05/09 15:12:12 christos Exp $ */ +/* $NetBSD: rpc_svcout.c,v 1.28 2015/05/09 18:48:14 dholland Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)rpc_svcout.c 1.29 89/03/30 (C) 1987 SMI"; #else -__RCSID("$NetBSD: rpc_svcout.c,v 1.27 2015/05/09 15:12:12 christos Exp $"); +__RCSID("$NetBSD: rpc_svcout.c,v 1.28 2015/05/09 18:48:14 dholland Exp $"); #endif #endif @@ -820,7 +820,11 @@ write_rpc_svc_fg(char *infile, const cha /* 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 {
CVS commit: src/usr.bin/rpcgen
Module Name:src Committed By: christos Date: Sat May 9 15:12:12 UTC 2015 Modified Files: src/usr.bin/rpcgen: rpc_svcout.c Log Message: CID 1225082: Check getrlimit() return To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/usr.bin/rpcgen/rpc_svcout.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/rpcgen/rpc_svcout.c diff -u src/usr.bin/rpcgen/rpc_svcout.c:1.26 src/usr.bin/rpcgen/rpc_svcout.c:1.27 --- src/usr.bin/rpcgen/rpc_svcout.c:1.26 Sun Dec 15 01:07:39 2013 +++ src/usr.bin/rpcgen/rpc_svcout.c Sat May 9 11:12:12 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rpc_svcout.c,v 1.26 2013/12/15 06:07:39 christos Exp $ */ +/* $NetBSD: rpc_svcout.c,v 1.27 2015/05/09 15:12:12 christos Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)rpc_svcout.c 1.29 89/03/30 (C) 1987 SMI"; #else -__RCSID("$NetBSD: rpc_svcout.c,v 1.26 2013/12/15 06:07:39 christos Exp $"); +__RCSID("$NetBSD: rpc_svcout.c,v 1.27 2015/05/09 15:12:12 christos Exp $"); #endif #endif @@ -646,7 +646,7 @@ write_timeout_func(void) f_print(fout, "static void closedown(void);\n"); f_print(fout, "\n"); f_print(fout, "static void\n"); - f_print(fout, "closedown()\n"); + f_print(fout, "closedown(void)\n"); f_print(fout, "{\n"); f_print(fout, "\tif (_rpcsvcdirty == 0) {\n"); f_print(fout, "\t\textern fd_set svc_fdset;\n"); @@ -663,7 +663,8 @@ write_timeout_func(void) 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"); f_print(fout, "\t\t\t\treturn;\n"); } else {
CVS commit: src/usr.bin/rpcgen
Module Name:src Committed By: wiz Date: Sun Dec 15 09:18:31 UTC 2013 Modified Files: src/usr.bin/rpcgen: rpc_main.c Log Message: Sync usage and option descriptions with manpage. To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/usr.bin/rpcgen/rpc_main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/rpcgen/rpc_main.c diff -u src/usr.bin/rpcgen/rpc_main.c:1.38 src/usr.bin/rpcgen/rpc_main.c:1.39 --- src/usr.bin/rpcgen/rpc_main.c:1.38 Sun Dec 15 00:40:17 2013 +++ src/usr.bin/rpcgen/rpc_main.c Sun Dec 15 09:18:31 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rpc_main.c,v 1.38 2013/12/15 00:40:17 christos Exp $ */ +/* $NetBSD: rpc_main.c,v 1.39 2013/12/15 09:18:31 wiz Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = "@(#)rpc_main.c 1.30 89/03/30 (C) 1987 SMI"; #else -__RCSID("$NetBSD: rpc_main.c,v 1.38 2013/12/15 00:40:17 christos Exp $"); +__RCSID("$NetBSD: rpc_main.c,v 1.39 2013/12/15 09:18:31 wiz Exp $"); #endif #endif @@ -1102,12 +1102,12 @@ static void usage(void) { f_print(stderr, "usage: %s infile\n", cmdname); - f_print(stderr, "\t%s [-a][-b][-C][-Dname[=value]] -i size [-I [-K seconds]] [-A] [-M] [-N] [-T] infile\n", + f_print(stderr, "\t%s [-AaBbILMNTv] [-Dname[=value]] [-i size] [-K seconds] [-Y pathname] infile\n", cmdname); - f_print(stderr, "\t%s [-L] [-M] [-c | -h | -l | -m | -t | -Sc | -Ss] [-o outfile] [infile]\n", + f_print(stderr, "\t%s [-c | -h | -l | -m | -t | -Sc | -Ss] [-o outfile] [infile]\n", cmdname); - f_print(stderr, "\t%s [-s nettype]* [-o outfile] [infile]\n", cmdname); - f_print(stderr, "\t%s [-n netid]* [-o outfile] [infile]\n", cmdname); + f_print(stderr, "\t%s [-s nettype] [-o outfile] [infile]\n", cmdname); + f_print(stderr, "\t%s [-n netid] [-o outfile] [infile]\n", cmdname); options_usage(); exit(1); } @@ -1118,25 +1118,27 @@ options_usage(void) f_print(stderr, "options:\n"); f_print(stderr, "-A\t\tgenerate svc_caller() function\n"); f_print(stderr, "-a\t\tgenerate all files, including samples\n"); + f_print(stderr, "-B\t\tgenerate BSD c++ macros\n"); f_print(stderr, "-b\t\tbackward compatibility mode (generates code for SunOS 4.1)\n"); f_print(stderr, "-c\t\tgenerate XDR routines\n"); f_print(stderr, "-Dname[=value]\tdefine a symbol (same as #define)\n"); f_print(stderr, "-h\t\tgenerate header file\n"); - f_print(stderr, "-i size\t\tsize at which to start generating inline code\n"); f_print(stderr, "-I\t\tgenerate code for inetd support in server (for SunOS 4.1)\n"); + f_print(stderr, "-i size\t\tsize at which to start generating inline code\n"); f_print(stderr, "-K seconds\tserver exits after K seconds of inactivity\n"); - f_print(stderr, "-l\t\tgenerate client side stubs\n"); f_print(stderr, "-L\t\tserver errors will be printed to syslog\n"); - f_print(stderr, "-m\t\tgenerate server side stubs\n"); + f_print(stderr, "-l\t\tgenerate client side stubs\n"); f_print(stderr, "-M\t\tgenerate thread-safe stubs\n"); - f_print(stderr, "-n netid\tgenerate server code that supports named netid\n"); + f_print(stderr, "-m\t\tgenerate server side stubs\n"); f_print(stderr, "-N\t\tsupports multiple arguments and call-by-value\n"); + f_print(stderr, "-n netid\tgenerate server code that supports named netid\n"); f_print(stderr, "-o outfile\tname of the output file\n"); f_print(stderr, "-s nettype\tgenerate server code that supports named nettype\n"); f_print(stderr, "-Sc\t\tgenerate sample client code that uses remote procedures\n"); f_print(stderr, "-Ss\t\tgenerate sample server code that defines remote procedures\n"); - f_print(stderr, "-t\t\tgenerate RPC dispatch table\n"); f_print(stderr, "-T\t\tgenerate code to support RPC dispatch tables\n"); + f_print(stderr, "-t\t\tgenerate RPC dispatch table\n"); + f_print(stderr, "-v\t\tdisplay version number\n"); f_print(stderr, "-Y path\t\tdirectory name to find C preprocessor (cpp)\n"); exit(1);
CVS commit: src/usr.bin/rpcgen
Module Name:src Committed By: wiz Date: Sun Dec 15 09:18:14 UTC 2013 Modified Files: src/usr.bin/rpcgen: rpcgen.1 Log Message: Standardize SYNOPSIS. Sort option descriptions and remove duplicates. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/usr.bin/rpcgen/rpcgen.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/rpcgen/rpcgen.1 diff -u src/usr.bin/rpcgen/rpcgen.1:1.23 src/usr.bin/rpcgen/rpcgen.1:1.24 --- src/usr.bin/rpcgen/rpcgen.1:1.23 Sun Dec 15 00:40:17 2013 +++ src/usr.bin/rpcgen/rpcgen.1 Sun Dec 15 09:18:14 2013 @@ -1,4 +1,4 @@ -.\" $NetBSD: rpcgen.1,v 1.23 2013/12/15 00:40:17 christos Exp $ +.\" $NetBSD: rpcgen.1,v 1.24 2013/12/15 09:18:14 wiz Exp $ .\" from: @(#)rpcgen.new.1 1.1 90/11/09 TIRPC 1.0; from 40.10 of 10/10/89 .\" Copyright (c) 1988,1990 Sun Microsystems, Inc. - All Rights Reserved. .Dd December 14, 2013 @@ -11,19 +11,10 @@ .Nm .Ar infile .Nm -.Op Fl A -.Op Fl a -.Op Fl B -.Op Fl b +.Op Fl AaBbILMNTv .Op Fl D Ar name Op =value -.Op Fl I .Op Fl i Ar size .Op Fl K Ar secs -.Op Fl L -.Op Fl M -.Op Fl N -.Op Fl T -.Op Fl v .Op Fl Y Ar pathname .Ar infile .Nm @@ -228,12 +219,12 @@ allows customization of routines. .Sh OPTIONS .Bl -tag -width indent -.It Fl a -Generate all the files including sample code for client and server side. .It Fl A Generate an .Fn svc_caller function. +.It Fl a +Generate all the files including sample code for client and server side. .It Fl B Generate BSD cplusplus macros (__BEGIN_DECLS, __END_DECLS). .It Fl b @@ -269,9 +260,6 @@ option can be used in conjunction to pro header file which supports .Tn RPC dispatch tables. -.It Fl i Ar size -Size to decide when to start generating inline code. -The default size is 3. .It Fl I Support .Xr inetd 8 @@ -284,6 +272,9 @@ in the background, unless .Dv RCP_SVC_FG is defined, or the server is compiled without .Fl I . +.It Fl i Ar size +Size to decide when to start generating inline code. +The default size is 3. .It Fl K Ar secs By default, services created using .Nm @@ -311,23 +302,11 @@ For such servers, .Nm should be used with .Dq Fl K No -1 . +.It Fl L +Server errors will be sent to syslog instead of stderr. .It Fl l Compile into client-side stubs. .Xr inetd 8 . -.It Fl I -Compile stubs meant for use in programs started by -.Xr inetd 8 . -.It Fl L -Server errors will be sent to syslog instead of stderr. -.It Fl m -Compile into server-side stubs, -but do not generate a -.Fn main -routine. -This option is useful for doing callback-routines -and for users who need to write their own -.Fn main -routine to do initialization. .It Fl M Generate thread-safe stubs. This alters the calling pattern of client and @@ -337,6 +316,15 @@ that all components for a particular ser wrappers, etc.) must be built either with or without the .Fl M flag. +.It Fl m +Compile into server-side stubs, +but do not generate a +.Fn main +routine. +This option is useful for doing callback-routines +and for users who need to write their own +.Fn main +routine to do initialization. .It Fl N Use the newstyle of .Nm . @@ -368,12 +356,6 @@ standard output is used .Fl m Fl n Fl s modes only .Pc -.It Fl n Ar netid -Specify the transport for the server-side stubs. -.Ar netid -should be defined in -.Xr netconfig 5 . -This option can be repeated in order to support more than one transport. .It Fl s Ar nettype Compile into server-side stubs for all the transports belonging to the class @@ -411,14 +393,14 @@ You would need to fill in the actual code for the remote procedures. .\" .It Fl S\&m .\" Generate a sample Makefile that can be used to compile the application. -.It Fl t -Compile into -.Tn RPC -dispatch table. .It Fl T Generate the code to support .Tn RPC dispatch tables. +.It Fl t +Compile into +.Tn RPC +dispatch table. .It Fl v Display the version number. .It Fl Y Ar pathname
CVS commit: src/usr.bin/rpcgen
Module Name:src Committed By: christos Date: Sun Dec 15 06:07:39 UTC 2013 Modified Files: src/usr.bin/rpcgen: rpc_svcout.c Log Message: Put back the extra prototype for main(); some programs #define main to something else, so we need the extra prototype. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/usr.bin/rpcgen/rpc_svcout.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/rpcgen/rpc_svcout.c diff -u src/usr.bin/rpcgen/rpc_svcout.c:1.25 src/usr.bin/rpcgen/rpc_svcout.c:1.26 --- src/usr.bin/rpcgen/rpc_svcout.c:1.25 Sat Dec 14 19:40:17 2013 +++ src/usr.bin/rpcgen/rpc_svcout.c Sun Dec 15 01:07:39 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rpc_svcout.c,v 1.25 2013/12/15 00:40:17 christos Exp $ */ +/* $NetBSD: rpc_svcout.c,v 1.26 2013/12/15 06:07:39 christos Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)rpc_svcout.c 1.29 89/03/30 (C) 1987 SMI"; #else -__RCSID("$NetBSD: rpc_svcout.c,v 1.25 2013/12/15 00:40:17 christos Exp $"); +__RCSID("$NetBSD: rpc_svcout.c,v 1.26 2013/12/15 06:07:39 christos Exp $"); #endif #endif @@ -118,6 +118,8 @@ write_most(char *infile /* our name */, if (nomain) return; + f_print(fout, "\n\n"); + f_print(fout, "int main(int, char *[]);\n"); f_print(fout, "\nint\n"); f_print(fout, "main(int argc, char *argv[])\n"); f_print(fout, "{\n");
CVS commit: src/usr.bin/rpcgen
Module Name:src Committed By: christos Date: Sun Dec 15 00:40:17 UTC 2013 Modified Files: src/usr.bin/rpcgen: rpc_clntout.c rpc_cout.c rpc_hout.c rpc_main.c rpc_parse.c rpc_sample.c rpc_scan.c rpc_svcout.c rpc_tblout.c rpc_util.c rpc_util.h rpcgen.1 Log Message: - remove support for pre-ansi output - add -B (BSD) support for c++ output macros - group functions to make output better looking To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/usr.bin/rpcgen/rpc_clntout.c cvs rdiff -u -r1.32 -r1.33 src/usr.bin/rpcgen/rpc_cout.c cvs rdiff -u -r1.21 -r1.22 src/usr.bin/rpcgen/rpc_hout.c cvs rdiff -u -r1.37 -r1.38 src/usr.bin/rpcgen/rpc_main.c cvs rdiff -u -r1.17 -r1.18 src/usr.bin/rpcgen/rpc_parse.c cvs rdiff -u -r1.12 -r1.13 src/usr.bin/rpcgen/rpc_sample.c \ src/usr.bin/rpcgen/rpc_scan.c src/usr.bin/rpcgen/rpc_util.c cvs rdiff -u -r1.24 -r1.25 src/usr.bin/rpcgen/rpc_svcout.c cvs rdiff -u -r1.13 -r1.14 src/usr.bin/rpcgen/rpc_tblout.c cvs rdiff -u -r1.7 -r1.8 src/usr.bin/rpcgen/rpc_util.h cvs rdiff -u -r1.22 -r1.23 src/usr.bin/rpcgen/rpcgen.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/rpcgen/rpc_clntout.c diff -u src/usr.bin/rpcgen/rpc_clntout.c:1.14 src/usr.bin/rpcgen/rpc_clntout.c:1.15 --- src/usr.bin/rpcgen/rpc_clntout.c:1.14 Sun Aug 11 04:03:10 2013 +++ src/usr.bin/rpcgen/rpc_clntout.c Sat Dec 14 19:40:17 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rpc_clntout.c,v 1.14 2013/08/11 08:03:10 dholland Exp $ */ +/* $NetBSD: rpc_clntout.c,v 1.15 2013/12/15 00:40:17 christos Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)rpc_clntout.c 1.11 89/02/22 (C) 1987 SMI"; #else -__RCSID("$NetBSD: rpc_clntout.c,v 1.14 2013/08/11 08:03:10 dholland Exp $"); +__RCSID("$NetBSD: rpc_clntout.c,v 1.15 2013/12/15 00:40:17 christos Exp $"); #endif #endif @@ -53,10 +53,10 @@ __RCSID("$NetBSD: rpc_clntout.c,v 1.14 2 #include "rpc_parse.h" #include "rpc_util.h" -static void write_program __P((definition *)); -static const char *ampr __P((const char *)); -static const char *aster __P((const char *)); -static void printbody __P((proc_list *)); +static void write_program(definition *); +static const char *ampr(const char *); +static const char *aster(const char *); +static void printbody(proc_list *); #define DEFAULT_TIMEOUT 25 /* in seconds */ static char RESULT[] = "clnt_res"; @@ -119,84 +119,36 @@ printarglist(proc_list *proc, const char if (!newstyle) { /* old style: always pass argument by * reference */ - if (Cflag) { /* C++ style heading */ - f_print(fout, "("); - ptype(proc->args.decls->decl.prefix, proc->args.decls->decl.type, 1); - f_print(fout, "*argp, "); - if (Mflag) { -if (streq(proc->res_type, "void")) - f_print(fout, "char "); -else - ptype(proc->res_prefix, proc->res_type, 0); -f_print(fout, "%s%s, ", aster(proc->res_type), -result); - } - f_print(fout, "%s%s)\n", addargtype, addargname); - } else { - f_print(fout, "(argp, "); - if (Mflag) -f_print(fout, "%s, ", result); - f_print(fout, "%s)\n", addargname); - f_print(fout, "\t"); - ptype(proc->args.decls->decl.prefix, proc->args.decls->decl.type, 1); - f_print(fout, "*argp;\n"); - if (Mflag) { -f_print(fout, "\t"); -if (streq(proc->res_type, "void")) - f_print(fout, "char "); -else - ptype(proc->res_prefix, proc->res_type, 0); -f_print(fout, "%s%s;\n", aster(proc->res_type), -result); - } + f_print(fout, "("); + ptype(proc->args.decls->decl.prefix, proc->args.decls->decl.type, 1); + f_print(fout, "*argp, "); + if (Mflag) { + if (streq(proc->res_type, "void")) +f_print(fout, "char "); + else +ptype(proc->res_prefix, proc->res_type, 0); + f_print(fout, "%s%s, ", aster(proc->res_type), + result); } + f_print(fout, "%s%s)\n", addargtype, addargname); } else { f_print(fout, "("); if (!streq(proc->args.decls->decl.type, "void")) { /* new style, 1 or multiple arguments */ - if (!Cflag) { -for (l = proc->args.decls; l != NULL; -l = l->next) - f_print(fout, "%s, ", l->decl.name); - } else {/* C++ style header */ -for (l = proc->args.decls; l != NULL; -l = l->next) - pdeclaration(proc->args.argname, - &l->decl, 0, ", "); - } + for (l = proc->args.decls; l != NULL; l = l->next) +pdeclaration(proc->args.argname, +&l->decl, 0, ", "); } - if (!Cflag) { - if (Mflag) { -f_print(fout, "\t"); -if (streq(proc->res_type, "void")) - f_print(fout, "char "); -else - ptype(proc->res_prefix, proc->res_type, 0); -f_print(fout, "%s%s;\n", aster(proc->res_type), -result); - } - f_print(fout, "%s)\n", addargname); - if (!st
CVS commit: src/usr.bin/rpcgen
Module Name:src Committed By: christos Date: Mon Aug 12 20:36:30 UTC 2013 Modified Files: src/usr.bin/rpcgen: rpc_cout.c Log Message: CID 1062241: simplify free for coverity To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/usr.bin/rpcgen/rpc_cout.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/rpcgen/rpc_cout.c diff -u src/usr.bin/rpcgen/rpc_cout.c:1.31 src/usr.bin/rpcgen/rpc_cout.c:1.32 --- src/usr.bin/rpcgen/rpc_cout.c:1.31 Sun Aug 11 04:03:10 2013 +++ src/usr.bin/rpcgen/rpc_cout.c Mon Aug 12 16:36:30 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rpc_cout.c,v 1.31 2013/08/11 08:03:10 dholland Exp $ */ +/* $NetBSD: rpc_cout.c,v 1.32 2013/08/12 20:36:30 christos Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)rpc_cout.c 1.13 89/02/22 (C) 1987 SMI"; #else -__RCSID("$NetBSD: rpc_cout.c,v 1.31 2013/08/11 08:03:10 dholland Exp $"); +__RCSID("$NetBSD: rpc_cout.c,v 1.32 2013/08/12 20:36:30 christos Exp $"); #endif #endif @@ -696,8 +696,7 @@ emit_single_in_line(declaration *decl, i free(freeable); freed = 1; upp_case = "INT32"; - } - if (strcmp(upp_case, "U_INT") == 0) { + } else if (strcmp(upp_case, "U_INT") == 0) { free(freeable); freed = 1; upp_case = "U_INT32";
CVS commit: src/usr.bin/rpcgen
Module Name:src Committed By: ginsbach Date: Wed May 6 14:30:51 UTC 2009 Modified Files: src/usr.bin/rpcgen: rpc_parse.c rpc_scan.c rpc_scan.h Log Message: Add support for hyper and quad keywords. (See Sun ONC+ Developer's Guide and RFC-4506 for additional details.) [From FreeBSD and OpenSolaris] To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/usr.bin/rpcgen/rpc_parse.c cvs rdiff -u -r1.10 -r1.11 src/usr.bin/rpcgen/rpc_scan.c cvs rdiff -u -r1.7 -r1.8 src/usr.bin/rpcgen/rpc_scan.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/rpcgen/rpc_parse.c diff -u src/usr.bin/rpcgen/rpc_parse.c:1.15 src/usr.bin/rpcgen/rpc_parse.c:1.16 --- src/usr.bin/rpcgen/rpc_parse.c:1.15 Tue Apr 4 21:27:42 2006 +++ src/usr.bin/rpcgen/rpc_parse.c Wed May 6 14:30:51 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: rpc_parse.c,v 1.15 2006/04/04 21:27:42 christos Exp $ */ +/* $NetBSD: rpc_parse.c,v 1.16 2009/05/06 14:30:51 ginsbach Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)rpc_parse.c 1.8 89/02/22 (C) 1987 SMI"; #else -__RCSID("$NetBSD: rpc_parse.c,v 1.15 2006/04/04 21:27:42 christos Exp $"); +__RCSID("$NetBSD: rpc_parse.c,v 1.16 2009/05/06 14:30:51 ginsbach Exp $"); #endif #endif @@ -578,6 +578,10 @@ *typep = "long"; (void) peekscan(TOK_INT, &tok); break; + case TOK_HYPER: + *typep = "longlong_t"; + (void) peekscan(TOK_INT, &tok); + break; case TOK_VOID: if (dkind != DEF_UNION && dkind != DEF_PROGRAM) { error("voids allowed only inside union and program definitions with one argument"); @@ -591,6 +595,7 @@ case TOK_FLOAT: case TOK_DOUBLE: case TOK_BOOL: + case TOK_QUAD: *typep = tok.str; break; default: @@ -620,6 +625,11 @@ *typep = "u_long"; (void) peekscan(TOK_INT, &tok); break; + case TOK_HYPER: + get_token(&tok); + *typep = "u_longlong_t"; + (void) peekscan(TOK_INT, &tok); + break; case TOK_INT: get_token(&tok); *typep = "u_int"; Index: src/usr.bin/rpcgen/rpc_scan.c diff -u src/usr.bin/rpcgen/rpc_scan.c:1.10 src/usr.bin/rpcgen/rpc_scan.c:1.11 --- src/usr.bin/rpcgen/rpc_scan.c:1.10 Mon Mar 20 17:01:26 2006 +++ src/usr.bin/rpcgen/rpc_scan.c Wed May 6 14:30:51 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: rpc_scan.c,v 1.10 2006/03/20 17:01:26 elad Exp $ */ +/* $NetBSD: rpc_scan.c,v 1.11 2009/05/06 14:30:51 ginsbach Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)rpc_scan.c 1.11 89/02/22 (C) 1987 SMI"; #else -__RCSID("$NetBSD: rpc_scan.c,v 1.10 2006/03/20 17:01:26 elad Exp $"); +__RCSID("$NetBSD: rpc_scan.c,v 1.11 2009/05/06 14:30:51 ginsbach Exp $"); #endif #endif @@ -414,8 +414,10 @@ {TOK_UNSIGNED, "unsigned"}, {TOK_SHORT, "short"}, {TOK_LONG, "long"}, + {TOK_HYPER, "hyper"}, {TOK_FLOAT, "float"}, {TOK_DOUBLE, "double"}, + {TOK_QUAD, "quadruple"}, {TOK_STRING, "string"}, {TOK_PROGRAM, "program"}, {TOK_VERSION, "version"}, Index: src/usr.bin/rpcgen/rpc_scan.h diff -u src/usr.bin/rpcgen/rpc_scan.h:1.7 src/usr.bin/rpcgen/rpc_scan.h:1.8 --- src/usr.bin/rpcgen/rpc_scan.h:1.7 Mon Oct 27 00:12:43 2003 +++ src/usr.bin/rpcgen/rpc_scan.h Wed May 6 14:30:51 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: rpc_scan.h,v 1.7 2003/10/27 00:12:43 lukem Exp $ */ +/* $NetBSD: rpc_scan.h,v 1.8 2009/05/06 14:30:51 ginsbach Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -70,9 +70,11 @@ TOK_INT, TOK_SHORT, TOK_LONG, + TOK_HYPER, TOK_UNSIGNED, TOK_FLOAT, TOK_DOUBLE, + TOK_QUAD, TOK_OPAQUE, TOK_CHAR, TOK_STRING,
CVS commit: src/usr.bin/rpcgen
Module Name:src Committed By: lukem Date: Mon Apr 13 06:42:26 UTC 2009 Modified Files: src/usr.bin/rpcgen: rpc_main.c Log Message: fix -Wshadow issue To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/usr.bin/rpcgen/rpc_main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/rpcgen/rpc_main.c diff -u src/usr.bin/rpcgen/rpc_main.c:1.32 src/usr.bin/rpcgen/rpc_main.c:1.33 --- src/usr.bin/rpcgen/rpc_main.c:1.32 Sat Mar 8 19:49:08 2008 +++ src/usr.bin/rpcgen/rpc_main.c Mon Apr 13 06:42:25 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: rpc_main.c,v 1.32 2008/03/08 19:49:08 christos Exp $ */ +/* $NetBSD: rpc_main.c,v 1.33 2009/04/13 06:42:25 lukem Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = "@(#)rpc_main.c 1.30 89/03/30 (C) 1987 SMI"; #else -__RCSID("$NetBSD: rpc_main.c,v 1.32 2008/03/08 19:49:08 christos Exp $"); +__RCSID("$NetBSD: rpc_main.c,v 1.33 2009/04/13 06:42:25 lukem Exp $"); #endif #endif @@ -855,16 +855,16 @@ } static void -putarg(where, cp) +putarg(pwhere, cp) char *cp; - int where; + int pwhere; { - if (where >= ARGLISTLEN) { + if (pwhere >= ARGLISTLEN) { f_print(stderr, "rpcgen: arglist coding error\n"); crash(); /* NOTREACHED */ } - arglist[where] = cp; + arglist[pwhere] = cp; } /*