⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 config.awk

📁 unix/linux下的路由守护程序
💻 AWK
📖 第 1 页 / 共 2 页
字号:
				} else {					protocols[deps[dep]] = 0;				}			}		}	}	for (i = 2; i <= NF; i++) {		p = $i;		if (upper[p]) {			p = upper[p];		}		if (!length(proto[p])) {			printf "Invalid protocol on line %d at '%s'\n", NR, $i ;			error++ ;			next ;		}		protocols[proto[p]] = 1;		if (depends[proto[p]]) {			split(depends[proto[p]], deps, " ") ;			for (dep in deps) {				if (substr(deps[dep], 1, 1) == "%") {					options[substr(deps[dep], 2)] = 1;				} else {					protocols[deps[dep]] = 1;				}			}		}	}	next ;}##	Specify compilation options#$1 == "options" {	#	OPTION	#	OPTION=sljf	#	OPTION="lsjf"	#	OPTION="lsjf sls"	#	OPTION=""lsjf sljf""	# Skip leading blanks	for (i = length($1) + 1; \	     substr($0, i, 1) == " " || substr($0, i, 1) == "	"; \	     i++) ;	for (line = substr($0, i); length(line); line = substr(line, i)) {		s = index(line, " ");		t = index(line, "	");		if (t > 0 && t < s) {			s = t;		}		if (s == 0) {			s = length(line) + 1;		}		e = index(line, "=");		if (e > 0 && e < s) {			# Has a parameter			option = substr(line, 1, e - 1);			if (substr(line, e+1, 1) == "\"") {				# Quoted				ee = index(substr(line, e + 3), "\"") ;				if (substr(line, e + 3 + ee, 1) == "\"") {					ee = ee + 1 ;				}				options[option] = substr(line, e + 2, ee)"";				i = e + 2 + ee + 2;			} else {				options[option] = substr(line, e + 1, s - e)"";				i = s + 1;			}			} else {			options[substr(line, 1, s - 1)] = 1;			i = s + 1;		}		for (; substr(line, i, 1) == " " || substr(line, i, 1) == "	"; i++) ;	}	next ;}##	Specify the paths#substr($1,1,5) == "path_" && NF == 2 {	p = substr($1,6)	if (!length(path[p])) {		printf "invalid path specification on line %d: %s\n", NR, $1;		error = 1;		next ;	}	path[p] = $2;	next ;}##	Variables#NF >= 1 {	if (!length(variable[$1])) {		printf "invalid variable on line %d: %s\n", NR, $0;		error = 1;		next ;	}	if (NF > 1) {		arg = $2 ;		for (i = 3 ; i <= NF; i++) {			arg = arg" "$i ;		}	} else {		arg = "" ;	}	value[$1] = arg;	next ;}{	printf "invalid input on line %d: %s\n", NR, $0 ;	error = 1;	exit ;}END {	if (error) {		exit error ;	}	#	#	Output the initial part of the script	#	printf "#!/bin/sh\n\n" > CONFIG_SCRIPT ;	printf "# THIS SCRIPT IS CREATED AUTOMATICALLY - DO NOT EDIT\n\n" > CONFIG_SCRIPT ;	if (!length(value["objdir"]) && length(OBJDIR)) {		value["objdir"] = OBJDIR ;	}	if (length(SRCDIR)) {		value["srcdir"] = SRCDIR ;	}			#	#	Build the conditional list	#	for (protocol in protocols) {		conds["PROTO_"protocol] = protocols[protocol] ;	}	for (option in options) {		conds[option] = options[option] ;	}		#	#	Build the defines list	#	for (protocol in protocols) {		if (protocols[protocol]) {			options["PROTO_"protocol] = 1 ;		}	}	printf "/* THIS FILE IS CREATED AUTOMATICALLY - DO NOT EDIT */\n\n" > DEFINES_H ;	option_list = "" ;	for (option in options) {		if (options[option]) {#			if (options[option] == 1+0) {#				printf "#define\t%s\n", option > DEFINES_H ;				#			} else {				printf "#define\t%s\t%s\n", option, options[option] > DEFINES_H ;#			}		}	}	#	#	Output Sed commands for paths	#	limit = value["sed_limit"] ;	printf "%s ", value["sed"] > CONFIG_SCRIPT	for (p in path) {		if ((limit -= 1) <= 0) {			limit = value["sed_limit"] ;			printf "| \\\n%s ", value["sed"] > CONFIG_SCRIPT		}		printf "\\\n\t-e 's~@(_path_%s)~%s~g' ", p, path[p] > CONFIG_SCRIPT	}		#	#	Output the make variables	#	for (i in var) {		if ((limit -= 1) <= 0) {			limit = value["sed_limit"] ;			printf "| \\\n%s ", value["sed"] > CONFIG_SCRIPT		}		printf "\\\n\t-e 's~@(%s)~%s~g' ", VAR[i], value[var[i]] > CONFIG_SCRIPT	}	#	#	Output any interesting options	#	for (option in options) {		if (options[option] && options[option] != 1+0) {		    if ((limit -= 1) <= 0) {			limit = value["sed_limit"] ;			printf "| \\\n%s ", value["sed"] > CONFIG_SCRIPT		    }			printf "\\\n\t-e 's~@(%s)~%s~g' ", option, options[option] > CONFIG_SCRIPT		}	}		#	#	Output the SED commands to remove unused sections of	#	the Makefile	#	for (cond in conds) {		if ((limit -= 2) <= 0) {			limit = value["sed_limit"] ;			printf "| \\\n%s ", value["sed"] > CONFIG_SCRIPT		}		printf "\\\n\t-e '/^@BEGIN:[ \t]%s[ \t]*$/", cond > CONFIG_SCRIPT		if (conds[cond]) {			printf "d;" > CONFIG_SCRIPT		} else {			printf "," > CONFIG_SCRIPT		}		printf "/^@END:[ \t]%s[ \t]*$/d' ", cond > CONFIG_SCRIPT		printf "\\\n\t-e '/^@BEGIN:[ \t]NOT %s[ \t]*$/", cond > CONFIG_SCRIPT		if (!conds[cond]) {			printf "d;" > CONFIG_SCRIPT		} else {			printf "," > CONFIG_SCRIPT		}		printf "/^@END:[ \t]NOT %s[ \t]*$/d' ", cond > CONFIG_SCRIPT	}	printf "\n" > CONFIG_SCRIPT}## ------------------------------------------------------------------------# # 	GateD, Release 3.5# # 	Copyright (c) 1990,1991,1992,1993,1994,1995 by Cornell University.# 	    All rights reserved.# # 	THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY# 	EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT# 	LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY# 	AND FITNESS FOR A PARTICULAR PURPOSE.# # 	Royalty-free licenses to redistribute GateD Release# 	3 in whole or in part may be obtained by writing to:# # 	    GateDaemon Project# 	    Information Technologies/Network Resources# 	    200 CCC# 	    Cornell University# 	    Ithaca, NY  14853-2601  USA# # 	GateD is based on Kirton's EGP, UC Berkeley's routing# 	daemon	 (routed), and DCN's HELLO routing Protocol.# 	Development of GateD has been supported in part by the# 	National Science Foundation.# # 	Please forward bug fixes, enhancements and questions to the# 	gated mailing list: gated-people@gated.cornell.edu.# # ------------------------------------------------------------------------# #       Portions of this software may fall under the following#       copyrights:# # 	Copyright (c) 1988 Regents of the University of California.# 	All rights reserved.# # 	Redistribution and use in source and binary forms are# 	permitted provided that the above copyright notice and# 	this paragraph are duplicated in all such forms and that# 	any documentation, advertising materials, and other# 	materials related to such distribution and use# 	acknowledge that the software was developed by the# 	University of California, Berkeley.  The name of the# 	University may not be used to endorse or promote# 	products derived from this software without specific# 	prior written permission.  THIS SOFTWARE IS PROVIDED# 	``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,# 	INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF# 	MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.#

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -