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

📄 update-info

📁 gcc-2.95.3 Linux下最常用的C编译器
💻
📖 第 1 页 / 共 2 页
字号:
				echo "$PROMPT1"|tr -d '\012'				read Answer				case $Answer in					y) break;;					e)					if test "$FUNCTIONS"; then						Select_Sections						break					else						echo "Can't edit.  "\						"Functions are not loaded.">&2					fi;;					Y) Interactive=""; break;;					n) continue 2;;					N) break 2;;					*) echo "\"$Answer\" "\					"is an invalid response">&2;;					esac				done		fi		if echo "$Item_Status"|grep '^X'>/dev/null; then			# edit $TMP_MENU			Changed="y"			(			trap ' ' 1 2 3			Tmp_Var=`echo "$Item_Status"|tr -d '\012'`			Key=`awk -F':' ' FNR==1{ print $1}' $TMP_ITEM`			# add new sections to 'dir' file			if test "$Item_Num" -gt "$Item_Dir"; then				if test "$Item_Dir" -ne "0"; then					sed -e "1,${Item_Dir}d" -e 'i\' "$TMP_SECTIONS">>"$TMP_MENU"				else					sed -e 'i\' "$TMP_SECTIONS">>"$TMP_MENU"				fi			fi			# awk determines the insertion points for each section			awk -F":" "function Insert(Line){			if(Mode==2){				Mode=1;if(substr(\"$Tmp_Var\",Item++,1)==\"X\")					print Line				}			}			BEGIN{Mode=1;Item=1}			/$SECTION_TITLE/{Insert(FNR-1);if(Mode>=1)Mode=2}			/${MENU_ITEM}.*\)\./{if(\$1>Item_Name)Insert(FNR-1)}			/^$/{Insert(FNR-1)}			END{Insert(FNR)}" Item_Name="$Key" "$TMP_MENU"\			|sort -nr|sed -e "s%\$% r $TMP_ITEM%"|sed -e '$a\w' -e '$a\q'|ed -s "$TMP_MENU"			echo "$Item_Status"|tr -cd "X">>$TMP_COUNT			)			Inserts=`expr "$Inserts" + "1"`			echo "$Info_File installed into section(s):"\			|tr -d '\012'			echo "$Item_Status"|awk '/X/{printf(" %d", FNR)}'			echo			Item_Dir="$Item_Num"		else			echo "$Info_File not installed (no section selected)"		fi		done	# print summary	trap ' ' 1 2 3	if test "$Changed"; then		@F_INSERT_MISSING@		Inserts_Total=`wc -c<"$TMP_COUNT"|tr -d " "`		if test "$Inserts" -ne "$Inserts_Total"; then			echo "$Inserts $INSERT_MSG"		fi		echo "$Inserts_Total $INSERT_MSG2"	fielse	# Detect Invalid	cat</dev/null>"$TMP_SED"	comm -23 $TMP_FILE1 $TMP_FILE2>$TMP_LIST	for Info_Name in `cat $TMP_LIST`		do		if test "$Interactive"; then			# display invalid menu item(s)			awk "BEGIN{Mode=1}			/^([ 	])+([^ 	])+/{if(Mode==2)print}			/^$/{if(Mode==2)Mode=1}			/$SECTION_TITLE/{Section=\$0}			/^[^ 	]/{if(Mode==2)Mode=1}			/${MENU_ITEM}${Info_Name}\)\./{if(Mode==1){Mode++				print Section				print}}" $TMP_MENU			echo "delete menu item for $Info_Name? "			while true				do				echo\				"(y=yes, n=no, Y=yes to all, N=No to all):"\				|tr -d '\012'				read Answer				case "$Answer" in					y) break;;					Y) Interactive=""; break;;					n) continue 2;;					N) break 2;;					*) echo "\"$Answer\" "\					"is an invalid reponse">&2;;					esac				done		fi		# remove menu item from $TMP_MENU		Invalid=`expr "$Invalid" + "1"`		Changed="y"		(		trap ' ' 1 2 3		echo\		"invalid menu item for $Info_Name removed from section(s):"\		|tr -d '\012'		awk "function Delete(Last){		printf(\"%d,%dd\n\",First,Last-1)>>\"$TMP_SED\"}		BEGIN{Mode=1;Section=0}		/^$/{if(Mode==2){Delete(FNR);Mode=1}}		/$SECTION_TITLE/{Section++}		/^[^ 	]/{if(Mode==2){Delete(FNR);Mode=1}}		/${MENU_ITEM}${Info_Name}\)\./{if(Mode==1){			First=FNR;printf(\" %d\",Section);Mode=2}}		END{if(Mode==2)Delete(FNR+1)}" $TMP_MENU		echo		)		done	# display a summary	trap ' ' 1 2 3	if test "$Changed"; then		Invalid_Total=`wc -l<"$TMP_SED"|tr -d ' '`		@F_DELETE_INVALID@		if test "$Invalid" -ne "$Invalid_Total"; then			echo "$Invalid $DELETE_MSG"		fi		echo "$Invalid_Total $DELETE_MSG2"	fifiif test -z "$Changed"; then	echo "Nothing to do"firm -f $TMP_FILE_LISTeval "$Debug"exit 0# _file: 'update-info.f'_#update-info.f (GNU texinfo @TEXINFO_VERSION@) @UPDATE_INFO_VERSION@#Copyright (C) 1997 Free Software Foundation, Inc.#update-info comes with NO WARRANTY, to the extent permitted by law.#You may redistribute copies of update-info#under the terms of the GNU General Public License.#For more information about these matters, see the files named COPYING."#Author: Richard L. Hawes# update-info.f functions for update-info# ###SECTION 1### functions used to insert missing menu itemsSet_Item (){# set item status@SET_ITEM@}Add_Section (){# add a section@F_ADD_SECTION@}# ###SECTION 2### functions for menu selection of sectionsPrint (){# print a line without a linefeedecho "$*"|tr -d '\012'}Get_Answer (){# get an answer to question_gs_Valid="$1"_gs_Prompt="$2"set -fAnswer=""while test -z "$Answer"	do	Print "$_gs_Prompt"	if read Answer; then		:	else		Answer="$CONTROL_D"		echo	fi	if expr "$Answer" : "[$_gs_Valid]$">/dev/null; then		:	else		Print "\"$Answer\" is not a valid response! --">&2		Answer=""	fi	doneset +f}Do_Previous (){# go to previous screenif test "$Previous"; then	Next="$Top_Item"	Top_Item="$Previous"	if Previous=`expr "$Top_Item" - "$DISPLAY_NUM"`; then		if test "$Previous" -le "0"; then			Previous=""		fi	else		Previous=""	fielif test "$Next"; then	Last_Pageelse	Print "There is no previous page. ">&2fi}Do_Next (){# process go to nextif test "$Next"; then	Previous="$Top_Item"	Top_Item="$Next"	Set_Nextelif test "$Previous"; then	Top_Item="1"	Previous=""	Set_Nextelse	Print "There is no next page. ">&2fi}Do_Add_Section (){# process add section commandechoecho "Please enter the name of the new section:"if read Answer; then	Answer=`echo "$Answer"\	|sed -e 's/^\([ 	]\)\{1,\}//g' -e "$MENU_FILTER2"`	if test "$Answer"; then		Add_Section "$Answer"		Last_Page		clear	fielse	Answer=""fiif test -z "$Answer"; then	clear	Print "no section added. "fi}Do_Edit (){# process edit item commandif test -t "2"; then	_de_Done=""	cp "$TMP_ITEM" "$TMP_FILE1"	while test -z "$_de_Done"		do		eval $EDITOR "$TMP_FILE1"		clear		_de_Done="t"		if sed -n -e "$MENU_FILTER1" -e '1p' "$TMP_FILE1"\		|egrep "${MENU_ITEM}${Info_Name}\)\.">/dev/null; then			:		else			sed -n -e '1p' "$TMP_FILE1"			echo "Pattern mismatch: `echo\			"/${MENU_ITEM}${Info_Name}\)\./"\			|tr -d "\011"`">&2			echo			_de_Done=""		fi		if sed -n -e '2,$p' "$TMP_FILE1"|grep '^[^ 	]'>&2; then			echo "These lines must have leading spaces">&2			echo			_de_Done=""		fi		if test -z "$_de_Done"; then			Get_Answer "yn" "Invalid entry, cancel edits? (y or n):"			if test "y" = "$Answer"; then				clear				Print "Canceling edits -- invalid entry ">&2				_de_Done="t"			fi		else			sed -e "$MENU_FILTER1" -e "$MENU_FILTER2" -e '/^$/d'\			<"$TMP_FILE1">"$TMP_ITEM"		fi		doneelse	Print "editor cannot run with error path redirected "fi}Do_Number (){# process number_dn_Num="$1"if test "$_dn_Num" -ge 1 -a "$_dn_Num" -le "$Item_Num"; then	if test `echo "$Item_Status"|sed -n -e "${_dn_Num}p"` = "_"; then		Set_Item "$_dn_Num" "X"	else		Set_Item "$_dn_Num" "_"	fielse	Print "\"$_dn_Num\" is an invalid section number. ">&2fi}Do_Help (){# process menu helpechoecho "\Enter the following commands seperatedby spaces and terminated by<ENTER>:# : (section number) toggle sectiona : add a new sectione : edit item -- changes will not be  accepted if you change the  '(info_file_name).' or delete  the key parts: '*' 'Menu Name' ':'h : get this help screenn : next pagep : previous pageq : quit and do not put into menus : save and put into menu"Print "Press enter to continue:"read junkclear}Set_Next (){# determine value of NextNext=`expr "$DISPLAY_NUM" + "$Top_Item"`if test "$Next" -gt "$Item_Num"; then	Next=""fi}Last_Page (){# go to last page of menuTop_Item=`echo|awk "BEGIN{printf(\"%d\",int((${Item_Num}-1)/${DISPLAY_NUM})*${DISPLAY_NUM}+1)}"`if test "$Top_Item" -gt "$DISPLAY_NUM"; then	Previous=`expr "$Top_Item" '-' "$DISPLAY_NUM"`else	Previous=""fiSet_Next}Select_Sections (){# prompt user for which sectionsset -fTop_Item="1"Previous=""Set_Nextclearecho "Default sections are selected."Done=""while test -z "$Done"	do	awk "FNR==1{printf(\"%s\n\", substr(\$0,1,${COLUMNS}))}" $TMP_ITEM	Tmp_Var=`echo "$Item_Status"|tr -d '\012'`	awk "BEGIN{Max=$Top_Item+$DISPLAY_NUM}	FNR>=$Top_Item{if(FNR>=Max)exit	printf(\"%2d:%s %s\n\",FNR,substr(\"$Tmp_Var\",FNR,1),	substr(\$0,1,${COLUMNS}-5))}" "$TMP_SECTIONS"	echo "Enter 1-${Item_Num}, add, edit, help,"	if test "$Previous" -o "$Next"; then		Print "next, previous, "	fi	Print "quit, save :"	read Command_List||Command_List="$CONTROL_D"	Command_List=`echo "$Command_List"\	|tr '\011' ' '|tr ' ' '\012'|sed -e "/^$/d"`	clear	if test -z "$Command_List"; then		Help="y"	else		Help=""	fi	while test "$Command_List"		do		Command=`echo "$Command_List"|sed -n -e '1p'`		Command_List=`echo "$Command_List"|sed -e '1d'`		case "$Command" in			[0-9]|[0-9][0-9]) Do_Number "$Command";;			n*)	Do_Next;;			p*)	Do_Previous;;			a*)	Do_Add_Section;;			e*)	Do_Edit; break;;			h*)	Help="y";;			s*)	Done="s"; break;;			q*)	Done="q"			Item_Status=`echo "$Item_Status"|sed -e '1,$s/^./_/'`			break;;			*) Print "$Command is not a valid command. ">&2			Help="y";;		esac		done	if test "$Help"; then		Do_Help	fi	echo	doneset +f# if new sections added, remove unused onesif test "$Item_Num" -gt "$Item_Dir"; then	Tmp_Var=`echo "$Item_Status"|awk "FNR>$Item_Dir{	if(\\$0==\"_\")printf(\"%d\n\", FNR)}"`	if test "$Tmp_Var"; then		Tmp_Var1=`echo "$Tmp_Var"|sed -e 's/$/d/'`		sed -e "$Tmp_Var1" "$TMP_SECTIONS">$TMP_FILE1		cp $TMP_FILE1 "$TMP_SECTIONS"		Item_Status=`echo "$Item_Status"|sed -e "$Tmp_Var1"`		Tmp_Var=""		Tmp_Var1=""		Item_Num=`wc -l<"$TMP_SECTIONS"|tr -d ' '`	fifi}# ###SECTION 100### Constants that redefinePROMPT1="(y=yes, e=edit, Y=yes to all, n=no, N=No to all):"FUNCTIONS="y"#echo "update-info.f (GNU texinfo @TEXINFO_VERSION@) @UPDATE_INFO_VERSION@"

⌨️ 快捷键说明

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