Deleted Added
full compact
rpc_main.c (99979) rpc_main.c (100441)
1/*
2 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
3 * unrestricted use provided that this legend is included on all tape
4 * media and as a part of the software program in whole or part. Users
5 * may copy or modify Sun RPC without charge, but are not authorized
6 * to license or distribute it to anyone else except as part of a product or
7 * program developed by the user.
1/*
2 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
3 * unrestricted use provided that this legend is included on all tape
4 * media and as a part of the software program in whole or part. Users
5 * may copy or modify Sun RPC without charge, but are not authorized
6 * to license or distribute it to anyone else except as part of a product or
7 * program developed by the user.
8 *
8 *
9 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
10 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
11 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
9 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
10 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
11 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
12 *
12 *
13 * Sun RPC is provided with no support and without any obligation on the
14 * part of Sun Microsystems, Inc. to assist in its use, correction,
15 * modification or enhancement.
13 * Sun RPC is provided with no support and without any obligation on the
14 * part of Sun Microsystems, Inc. to assist in its use, correction,
15 * modification or enhancement.
16 *
16 *
17 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
18 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
19 * OR ANY PART THEREOF.
17 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
18 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
19 * OR ANY PART THEREOF.
20 *
20 *
21 * In no event will Sun Microsystems, Inc. be liable for any lost revenue
22 * or profits or other special, indirect and consequential damages, even if
23 * Sun has been advised of the possibility of such damages.
21 * In no event will Sun Microsystems, Inc. be liable for any lost revenue
22 * or profits or other special, indirect and consequential damages, even if
23 * Sun has been advised of the possibility of such damages.
24 *
24 *
25 * Sun Microsystems, Inc.
26 * 2550 Garcia Avenue
27 * Mountain View, California 94043
28 */
29
30
31#ident "@(#)rpc_main.c 1.21 94/04/25 SMI"
32
25 * Sun Microsystems, Inc.
26 * 2550 Garcia Avenue
27 * Mountain View, California 94043
28 */
29
30
31#ident "@(#)rpc_main.c 1.21 94/04/25 SMI"
32
33#ifndef lint
34#if 0
33#if 0
34#ifndef lint
35static char sccsid[] = "@(#)rpc_main.c 1.30 89/03/30 (C) 1987 SMI";
36#endif
35static char sccsid[] = "@(#)rpc_main.c 1.30 89/03/30 (C) 1987 SMI";
36#endif
37static const char rcsid[] =
38 "$FreeBSD: head/usr.bin/rpcgen/rpc_main.c 99979 2002-07-14 17:54:00Z alfred $";
39#endif
40
37#endif
38
39#include <sys/cdefs.h>
40__FBSDID("$FreeBSD: head/usr.bin/rpcgen/rpc_main.c 100441 2002-07-21 12:55:04Z charnier $");
41
41/*
42 * rpc_main.c, Top level of the RPC protocol compiler.
43 * Copyright (C) 1987, Sun Microsystems, Inc.
44 */
45
46#include <err.h>
47#include <ctype.h>
48#include <stdio.h>

--- 11 unchanged lines hidden (view full) ---

60extern int write_sample_clnt( definition * );
61extern void write_sample_clnt_main( void );
62extern void add_sample_msg( void );
63static void c_output( char *, char *, int, char * );
64static void h_output( char *, char *, int, char * );
65static void l_output( char *, char *, int, char * );
66static void t_output( char *, char *, int, char * );
67static void clnt_output( char *, char *, int, char * );
42/*
43 * rpc_main.c, Top level of the RPC protocol compiler.
44 * Copyright (C) 1987, Sun Microsystems, Inc.
45 */
46
47#include <err.h>
48#include <ctype.h>
49#include <stdio.h>

--- 11 unchanged lines hidden (view full) ---

61extern int write_sample_clnt( definition * );
62extern void write_sample_clnt_main( void );
63extern void add_sample_msg( void );
64static void c_output( char *, char *, int, char * );
65static void h_output( char *, char *, int, char * );
66static void l_output( char *, char *, int, char * );
67static void t_output( char *, char *, int, char * );
68static void clnt_output( char *, char *, int, char * );
68
69void c_initialize( void );
70
71#if !defined(__FreeBSD__) && !defined(__NetBSD__)
72char * rindex();
73#endif
74
75static void usage(void);
76static void options_usage(void);

--- 162 unchanged lines hidden (view full) ---

239 char *res;
240 char *p;
241 char *file;
242
243 if ((file = rindex(path, '/')) == NULL)
244 file = path;
245 else
246 file++;
69void c_initialize( void );
70
71#if !defined(__FreeBSD__) && !defined(__NetBSD__)
72char * rindex();
73#endif
74
75static void usage(void);
76static void options_usage(void);

--- 162 unchanged lines hidden (view full) ---

239 char *res;
240 char *p;
241 char *file;
242
243 if ((file = rindex(path, '/')) == NULL)
244 file = path;
245 else
246 file++;
247 res = alloc(strlen(file) + strlen(ext) + 1);
248 if (res == NULL) {
249 abort();
250 }
247 res = xmalloc(strlen(file) + strlen(ext) + 1);
251 p = strrchr(file, '.');
252 if (p == NULL) {
253 p = file + strlen(file);
254 }
255 (void) strcpy(res, file);
256 (void) strcpy(res + (p - file), ext);
257 return (res);
258}

--- 83 unchanged lines hidden (view full) ---

342 addarg(define);
343 if (infile)
344 addarg(infile);
345 addarg((char *)NULL);
346 (void) close(1);
347 (void) dup2(pd[1], 1);
348 (void) close(pd[0]);
349 execv(arglist[0], arglist);
248 p = strrchr(file, '.');
249 if (p == NULL) {
250 p = file + strlen(file);
251 }
252 (void) strcpy(res, file);
253 (void) strcpy(res + (p - file), ext);
254 return (res);
255}

--- 83 unchanged lines hidden (view full) ---

339 addarg(define);
340 if (infile)
341 addarg(infile);
342 addarg((char *)NULL);
343 (void) close(1);
344 (void) dup2(pd[1], 1);
345 (void) close(pd[0]);
346 execv(arglist[0], arglist);
350 warn("execv");
351 exit(1);
347 err(1, "execv");
352 case -1:
348 case -1:
353 warn("fork");
354 exit(1);
349 err(1, "fork");
355 }
356 (void) close(pd[1]);
357 fin = fdopen(pd[0], "r");
358 if (fin == NULL) {
359 warn("%s", infilename);
360 crash();
361 }
362}

--- 110 unchanged lines hidden (view full) ---

473
474char *generate_guard(pathname)
475 char* pathname;
476{
477 char* filename, *guard, *tmp;
478
479 filename = strrchr(pathname, '/'); /* find last component */
480 filename = ((filename == 0) ? pathname : filename+1);
350 }
351 (void) close(pd[1]);
352 fin = fdopen(pd[0], "r");
353 if (fin == NULL) {
354 warn("%s", infilename);
355 crash();
356 }
357}

--- 110 unchanged lines hidden (view full) ---

468
469char *generate_guard(pathname)
470 char* pathname;
471{
472 char* filename, *guard, *tmp;
473
474 filename = strrchr(pathname, '/'); /* find last component */
475 filename = ((filename == 0) ? pathname : filename+1);
481 guard = strdup(filename);
476 guard = xstrdup(filename);
482 /* convert to upper case */
483 tmp = guard;
484 while (*tmp) {
485 if (islower(*tmp))
486 *tmp = toupper(*tmp);
487 tmp++;
488 }
489 guard = extendfile(guard, "_H_RPCGEN");

--- 379 unchanged lines hidden (view full) ---

869 }else{
870 servername = " ";
871 clientname = " ";
872 }
873 servprogname = extendfile(cmd->infile, "_server");
874 clntprogname = extendfile(cmd->infile, "_client");
875
876 if (allfiles){
477 /* convert to upper case */
478 tmp = guard;
479 while (*tmp) {
480 if (islower(*tmp))
481 *tmp = toupper(*tmp);
482 tmp++;
483 }
484 guard = extendfile(guard, "_H_RPCGEN");

--- 379 unchanged lines hidden (view full) ---

864 }else{
865 servername = " ";
866 clientname = " ";
867 }
868 servprogname = extendfile(cmd->infile, "_server");
869 clntprogname = extendfile(cmd->infile, "_client");
870
871 if (allfiles){
877 mkfilename = alloc(strlen("makefile.") +
878 strlen(cmd->infile) + 1);
872 mkfilename = xmalloc(strlen("makefile.") +
873 strlen(cmd->infile) + 1);
879 temp = (char *)rindex(cmd->infile, '.');
880 strcat(mkfilename, "makefile.");
881 (void) strncat(mkfilename, cmd->infile,
882 (temp - cmd->infile));
883 } else
884 mkfilename = cmd->outfile;
885
886

--- 372 unchanged lines hidden (view full) ---

1259 return (0);
1260 }
1261 return (1);
1262}
1263
1264static void
1265usage()
1266{
874 temp = (char *)rindex(cmd->infile, '.');
875 strcat(mkfilename, "makefile.");
876 (void) strncat(mkfilename, cmd->infile,
877 (temp - cmd->infile));
878 } else
879 mkfilename = cmd->outfile;
880
881

--- 372 unchanged lines hidden (view full) ---

1254 return (0);
1255 }
1256 return (1);
1257}
1258
1259static void
1260usage()
1261{
1267 f_print(stderr, "%s\n%s\n%s\n%s\n%s\n",
1262 f_print(stderr, "%s\n%s\n%s\n%s\n%s\n",
1268 "usage: rpcgen infile",
1269 " rpcgen [-abCLNTM] [-Dname[=value]] [-i size]\
1270[-I -P [-K seconds]] [-Y path] infile",
1271 " rpcgen [-c | -h | -l | -m | -t | -Sc | -Ss | -Sm]\
1272[-o outfile] [infile]",
1273 " rpcgen [-s nettype]* [-o outfile] [infile]",
1274 " rpcgen [-n netid]* [-o outfile] [infile]");
1275 options_usage();

--- 42 unchanged lines hidden ---
1263 "usage: rpcgen infile",
1264 " rpcgen [-abCLNTM] [-Dname[=value]] [-i size]\
1265[-I -P [-K seconds]] [-Y path] infile",
1266 " rpcgen [-c | -h | -l | -m | -t | -Sc | -Ss | -Sm]\
1267[-o outfile] [infile]",
1268 " rpcgen [-s nettype]* [-o outfile] [infile]",
1269 " rpcgen [-n netid]* [-o outfile] [infile]");
1270 options_usage();

--- 42 unchanged lines hidden ---