📄 fold.in
字号:
#! @BASH@# This script is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License version 2 as# published by the Free Software Foundation.## See the COPYING and AUTHORS files for more details.# Read in library functionsif [ "$(type -t patch_file_name)" != function ]then if ! [ -r $QUILT_DIR/scripts/patchfns ] then echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2 exit 1 fi . $QUILT_DIR/scripts/patchfnsfiusage(){ printf $"Usage: quilt fold [-p strip-level]\n" if [ x$1 = x-h ] then printf $"Integrate the patch read from standard input into the topmost patch:After making sure that all files modified are part of the topmostpatch, the patch is applied with the specified strip level (whichdefaults to 1).-p strip-level The number of pathname components to strip from file names when applying patchfile." exit 0 else exit 1 fi}options=`getopt -o p:qh -- "$@"`if [ $? -ne 0 ]then usagefieval set -- "$options"while truedo case "$1" in -p) opt_strip_level=$2 shift 2 ;; -q) opt_silent=1 shift ;; -h) usage -h ;; --) shift break ;; esacdoneif [ $# -ne 0 ]then usagefi: ${opt_strip_level:=1}[ -n "$opt_silent" ] && silent=-stop=$(find_top_patch) || exit 1trap "failed=1" SIGINTworkdir=$(gen_tempfile -d $PWD)patch -d ${SUBDIR:-.} $QUILT_PATCH_OPTS -p$opt_strip_level $silent \ --backup --prefix="$workdir/$SUBDIR" -E \|| failed=1if [ -z "$failed" ]then # Copy additional files from workdir to the backup directory # For this patch for file in $(find $workdir -type f -a ! -path "$workdir/.timestamp") do file="${file:${#workdir}+1}" backup_file="$(backup_file_name $top "$file")" if ! [ -e "$backup_file" ] then if ! mkdir -p "$(dirname "$backup_file")" || ! ln "$workdir/$file" "$backup_file" then failed=1 break fi fi donefiif [ -n "$failed" ]then # Restore all files to the state from before applying the patch for file in $(find $workdir -type f -a ! -path "$workdir/.timestamp") do file="${file:${#workdir}+1}" if ! mv -f "$workdir/$file" "$file" then printf $"File %s may be corrupted\n" "$file" >&2 fi done rm -rf $workdir exit 1firm -rf $workdirexit 0### Local Variables:### mode: shell-script### End:# vim:filetype=sh
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -