X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=lib%2Flibfileedit.sh;fp=lib%2Flibfileedit.sh;h=007ca4e7331c13cdfe6d3c9ee11e99e6bb671c6a;hb=12c96c00c54d1b56c2472457377339c11e0a00d9;hp=6d8a8ef36cca4005c829ebc1ebfbc685c8d0411c;hpb=c97978d1de45f00d3348cd6e1844ec650f270159;p=portsreinstall%2Fcurrent.git diff --git a/lib/libfileedit.sh b/lib/libfileedit.sh index 6d8a8ef..007ca4e 100644 --- a/lib/libfileedit.sh +++ b/lib/libfileedit.sh @@ -15,7 +15,7 @@ fileedit_rm_a_line () [ -n "$item" ] || return 0 [ -e "$dstpath" ] || return 0 tmpfile=$dstpath.fileedit_rm_a_line.tmp - grep -v -Fx "$item" "$dstpath" 2> /dev/null > $tmpfile || : + env LANG=C grep -v -Fx "$item" "$dstpath" 2> /dev/null > $tmpfile || : mv "$tmpfile" "$dstpath" } @@ -31,7 +31,7 @@ fileedit_add_a_line_if_new () if [ -e "$dstpath" ] then cp "$dstpath" "$tmpfile" - grep -q -Fx "$item" "$dstpath" \ + env LANG=C grep -q -Fx "$item" "$dstpath" \ || echo "$item" >> $tmpfile else dstdir=`dirname "$dstpath"` @@ -77,7 +77,7 @@ fileedit_add_lines_if_new () then while read origin do - grep -q -Fx "$origin" "$dstpath" \ + env LANG=C grep -q -Fx "$origin" "$dstpath" \ || echo "$origin" done > $tmpclip if [ "@$advance" = @advance ] @@ -110,8 +110,8 @@ fileedit_manipulate_old_new_lines () newdiff=$4 [ -e "$oldsrc" ] || oldsrc=/dev/null [ -e "$newsrc" ] || newsrc=/dev/null - grep -vFx -f "$newsrc" "$oldsrc" > $olddiff 2> /dev/null || : - grep -vFx -f "$oldsrc" "$newsrc" > $newdiff 2> /dev/null || : + env LANG=C grep -vFx -f "$newsrc" "$oldsrc" > $olddiff 2> /dev/null || : + env LANG=C grep -vFx -f "$oldsrc" "$newsrc" > $newdiff 2> /dev/null || : [ `cat "$olddiff" "$newdiff" | wc -l` -gt 0 ] } @@ -123,7 +123,7 @@ fileedit_manipulate_old_lines () newsrc=$2 [ -e "$oldsrc" ] || oldsrc=/dev/null [ -e "$newsrc" ] || newsrc=/dev/null - grep -vFx -f "$newsrc" "$oldsrc" 2> /dev/null + env LANG=C grep -vFx -f "$newsrc" "$oldsrc" 2> /dev/null } # ============= Manipulate new lines from an old and a new versions of a file ============= @@ -134,7 +134,7 @@ fileedit_manipulate_new_lines () newsrc=$2 [ -e "$oldsrc" ] || oldsrc=/dev/null [ -e "$newsrc" ] || newsrc=/dev/null - grep -vFx -f "$oldsrc" "$newsrc" 2> /dev/null + env LANG=C grep -vFx -f "$oldsrc" "$newsrc" 2> /dev/null } # ============= Check whether removed lines exists in updating from an old and a new versions of a file ============= @@ -145,5 +145,5 @@ fileedit_exists_old_lines () newsrc=$2 [ -e "$oldsrc" ] || oldsrc=/dev/null [ -e "$newsrc" ] || newsrc=/dev/null - grep -qvFx -f "$newsrc" "$oldsrc" 2> /dev/null + env LANG=C grep -qvFx -f "$newsrc" "$oldsrc" 2> /dev/null }