Plan 9 from Bell Labs’s /usr/web/sources/contrib/uriel/changes/2006/0128/23

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


Better error messages.
 [jmk] --rw-rw-r-- M 1428987 glenda sys 4930 Jan 28 12:57 sys/src/cmd/venti/config.c
	/n/sourcesdump/2006/0128/plan9/sys/src/cmd/venti/config.c:113,123 - 
	/n/sourcesdump/2006/0129/plan9/sys/src/cmd/venti/config.c:113,123
	  			config->naparts++;
	  		}else if(i == 2 && strcmp(flds[0], "index") == 0){
	  			if(!nameOk(flds[1])){
	- 				setErr(EAdmin, "illegal index name %s in config file %s", flds[1], config);
	+ 				setErr(EAdmin, "illegal index name %s in config file %s", flds[1], file);
	  				break;
	  			}
	  			if(config->index != nil){
	- 				setErr(EAdmin, "duplicate indices in config file %s", config);
	+ 				setErr(EAdmin, "duplicate indices in config file %s", file);
	  				break;
	  			}
	  			config->index = estrdup(flds[1]);
	/n/sourcesdump/2006/0128/plan9/sys/src/cmd/venti/config.c:124,134 - 
	/n/sourcesdump/2006/0129/plan9/sys/src/cmd/venti/config.c:124,134
	  		}else if(i == 2 && strcmp(flds[0], "bcmem") == 0){
	  			if(!numOk(flds[1])){
	  				setErr(EAdmin, "illegal size %s in config file %s",
	- 					flds[1], config);
	+ 					flds[1], file);
	  				break;
	  			}
	  			if(config->bcmem != 0){
	- 				setErr(EAdmin, "duplicate bcmem lines in config file %s", config);
	+ 				setErr(EAdmin, "duplicate bcmem lines in config file %s", file);
	  				break;
	  			}
	  			config->bcmem = unittoull(flds[1]);
	/n/sourcesdump/2006/0128/plan9/sys/src/cmd/venti/config.c:135,145 - 
	/n/sourcesdump/2006/0129/plan9/sys/src/cmd/venti/config.c:135,145
	  		}else if(i == 2 && strcmp(flds[0], "mem") == 0){
	  			if(!numOk(flds[1])){
	  				setErr(EAdmin, "illegal size %s in config file %s",
	- 					flds[1], config);
	+ 					flds[1], file);
	  				break;
	  			}
	  			if(config->mem != 0xFFFFFFFFUL){
	- 				setErr(EAdmin, "duplicate mem lines in config file %s", config);
	+ 				setErr(EAdmin, "duplicate mem lines in config file %s", file);
	  				break;
	  			}
	  			config->mem = unittoull(flds[1]);
	/n/sourcesdump/2006/0128/plan9/sys/src/cmd/venti/config.c:146,156 - 
	/n/sourcesdump/2006/0129/plan9/sys/src/cmd/venti/config.c:146,156
	  		}else if(i == 2 && strcmp(flds[0], "icmem") == 0){
	  			if(!numOk(flds[1])){
	  				setErr(EAdmin, "illegal size %s in config file %s",
	- 					flds[1], config);
	+ 					flds[1], file);
	  				break;
	  			}
	  			if(config->icmem != 0){
	- 				setErr(EAdmin, "duplicate icmem lines in config file %s", config);
	+ 				setErr(EAdmin, "duplicate icmem lines in config file %s", file);
	  				break;
	  			}
	  			config->icmem = unittoull(flds[1]);
	/n/sourcesdump/2006/0128/plan9/sys/src/cmd/venti/config.c:158,183 - 
	/n/sourcesdump/2006/0129/plan9/sys/src/cmd/venti/config.c:158,183
	  			config->queueWrites = 1;
	  		}else if(i == 2 && strcmp(flds[0], "httpaddr") == 0){
	  			if(!nameOk(flds[1])){
	- 				setErr(EAdmin, "illegal http address '%s' in configuration file %s", flds[1], config);
	+ 				setErr(EAdmin, "illegal http address '%s' in configuration file %s", flds[1], file);
	  				break;
	  			}
	  			if(config->haddr){
	- 				setErr(EAdmin, "duplicate httpaddr lines in configuration file %s", config);
	+ 				setErr(EAdmin, "duplicate httpaddr lines in configuration file %s", file);
	  				break;
	  			}
	  			config->haddr = estrdup(flds[1]);
	  		}else if(i == 2 && strcmp(flds[0], "addr") == 0){
	  			if(!nameOk(flds[1])){
	- 				setErr(EAdmin, "illegal venti address '%s' in configuration file %s", flds[1], config);
	+ 				setErr(EAdmin, "illegal venti address '%s' in configuration file %s", flds[1], file);
	  				break;
	  			}
	  			if(config->vaddr){
	- 				setErr(EAdmin, "duplicate addr lines in configuration file %s", config);
	+ 				setErr(EAdmin, "duplicate addr lines in configuration file %s", file);
	  				break;
	  			}
	  			config->vaddr = estrdup(flds[1]);
	  		}else{
	- 			setErr(EAdmin, "illegal line '%s' in configuration file %s", line, config);
	+ 			setErr(EAdmin, "illegal line '%s' in configuration file %s", line, file);
	  			break;
	  		}
	  		free(line);
 [jmk] --rw-rw-r-- M 1428987 glenda sys 2524 Jan 28 12:57 sys/src/cmd/venti/fmtindex.c
	/n/sourcesdump/2006/0128/plan9/sys/src/cmd/venti/fmtindex.c:43,49 - 
	/n/sourcesdump/2006/0129/plan9/sys/src/cmd/venti/fmtindex.c:43,49
	  	file = argv[0];
	  
	  	if(!runConfig(file, &conf))
	- 		fatal("can't intialization config %s: %R", file);
	+ 		fatal("can't run config %s: %R", file);
	  	if(conf.index == nil)
	  		fatal("no index specified in %s", file);
	  	if(!nameOk(conf.index))


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].