rpc_util.c (17142) | rpc_util.c (27935) |
---|---|
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 * --- 16 unchanged lines hidden (view full) --- 25 * Sun Microsystems, Inc. 26 * 2550 Garcia Avenue 27 * Mountain View, California 94043 28 */ 29 30#ident "@(#)rpc_util.c 1.14 93/07/05 SMI" 31 32#ifndef lint | 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 * --- 16 unchanged lines hidden (view full) --- 25 * Sun Microsystems, Inc. 26 * 2550 Garcia Avenue 27 * Mountain View, California 94043 28 */ 29 30#ident "@(#)rpc_util.c 1.14 93/07/05 SMI" 31 32#ifndef lint |
33#if 0 |
|
33static char sccsid[] = "@(#)rpc_util.c 1.11 89/02/22 (C) 1987 SMI"; 34#endif | 34static char sccsid[] = "@(#)rpc_util.c 1.11 89/02/22 (C) 1987 SMI"; 35#endif |
36static const char rcsid[] = 37 "$Id$"; 38#endif |
|
35 36/* 37 * rpc_util.c, Utility routines for the RPC protocol compiler 38 * Copyright (C) 1989, Sun Microsystems, Inc. 39 */ | 39 40/* 41 * rpc_util.c, Utility routines for the RPC protocol compiler 42 * Copyright (C) 1989, Sun Microsystems, Inc. 43 */ |
44#include <err.h> 45#include <ctype.h> |
|
40#include <stdio.h> 41#include <string.h> | 46#include <stdio.h> 47#include <string.h> |
42#include <ctype.h> | |
43#include <unistd.h> 44#include "rpc_scan.h" 45#include "rpc_parse.h" 46#include "rpc_util.h" 47 48#define ARGEXT "argument" 49 50char curline[MAXLINESIZE]; /* current read line */ --- 219 unchanged lines hidden (view full) --- 270/* 271 * print a useful (?) error message, and then die 272 */ 273void 274error(msg) 275 char *msg; 276{ 277 printwhere(); | 48#include <unistd.h> 49#include "rpc_scan.h" 50#include "rpc_parse.h" 51#include "rpc_util.h" 52 53#define ARGEXT "argument" 54 55char curline[MAXLINESIZE]; /* current read line */ --- 219 unchanged lines hidden (view full) --- 275/* 276 * print a useful (?) error message, and then die 277 */ 278void 279error(msg) 280 char *msg; 281{ 282 printwhere(); |
278 f_print(stderr, "%s, line %d: ", infilename, linenum); 279 f_print(stderr, "%s\n", msg); | 283 warnx("%s, line %d: %s", infilename, linenum, msg); |
280 crash(); 281} 282 283/* 284 * Something went wrong, unlink any files that we may have created and then 285 * die. 286 */ 287void --- 9 unchanged lines hidden (view full) --- 297 298void 299record_open(file) 300 char *file; 301{ 302 if (nfiles < NFILES) { 303 outfiles[nfiles++] = file; 304 } else { | 284 crash(); 285} 286 287/* 288 * Something went wrong, unlink any files that we may have created and then 289 * die. 290 */ 291void --- 9 unchanged lines hidden (view full) --- 301 302void 303record_open(file) 304 char *file; 305{ 306 if (nfiles < NFILES) { 307 outfiles[nfiles++] = file; 308 } else { |
305 f_print(stderr, "too many files!\n"); | 309 warnx("too many files"); |
306 crash(); 307 } 308} 309 310static char expectbuf[100]; 311static char *toktostr(); 312 313/* --- 140 unchanged lines hidden (view full) --- 454char * 455make_argname(pname, vname) 456 char *pname; 457 char *vname; 458{ 459 char *name; 460 461 name = malloc(strlen(pname) + strlen(vname) + strlen(ARGEXT) + 3); | 310 crash(); 311 } 312} 313 314static char expectbuf[100]; 315static char *toktostr(); 316 317/* --- 140 unchanged lines hidden (view full) --- 458char * 459make_argname(pname, vname) 460 char *pname; 461 char *vname; 462{ 463 char *name; 464 465 name = malloc(strlen(pname) + strlen(vname) + strlen(ARGEXT) + 3); |
462 if (!name) { 463 fprintf(stderr, "failed in malloc"); 464 exit(1); 465 } | 466 if (!name) 467 errx(1, "failed in malloc"); |
466 sprintf(name, "%s_%s_%s", locase(pname), vname, ARGEXT); 467 return (name); 468} 469 470bas_type *typ_list_h; 471bas_type *typ_list_t; 472 473void 474add_type(len, type) 475int len; 476char *type; 477{ 478 bas_type *ptr; 479 | 468 sprintf(name, "%s_%s_%s", locase(pname), vname, ARGEXT); 469 return (name); 470} 471 472bas_type *typ_list_h; 473bas_type *typ_list_t; 474 475void 476add_type(len, type) 477int len; 478char *type; 479{ 480 bas_type *ptr; 481 |
480 if ((ptr = (bas_type *) malloc(sizeof (bas_type))) == 481 (bas_type *)NULL) { 482 fprintf(stderr, "failed in malloc"); 483 exit(1); 484 } | 482 if ((ptr = (bas_type *) malloc(sizeof (bas_type))) == (bas_type *)NULL) 483 errx(1, "failed in malloc"); |
485 486 ptr->name = type; 487 ptr->length = len; 488 ptr->next = NULL; 489 if (typ_list_t == NULL) 490 { 491 492 typ_list_t = ptr; --- 25 unchanged lines hidden --- | 484 485 ptr->name = type; 486 ptr->length = len; 487 ptr->next = NULL; 488 if (typ_list_t == NULL) 489 { 490 491 typ_list_t = ptr; --- 25 unchanged lines hidden --- |