Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Import from Autoconf sources:

	2005-09-06  Paul Eggert  <eggert@cs.ucla.edu>
	* config/move-if-change: Don't output "$2 is unchanged";
	suggested by Ben Elliston.  Handle weird characters correctly.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@107275 138bc75d-0d04-0410-961f-82ee72b054a4
  • Loading branch information...
commit fefdfa6eba783a005677edb3fc8459fd7bb16adb 1 parent 5447c6e
authored November 21, 2005

Showing 2 changed files with 25 additions and 27 deletions. Show diff stats Hide diff stats

  1. 8  ChangeLog
  2. 44  move-if-change
8  ChangeLog
... ...
@@ -1,3 +1,11 @@
  1
+2005-11-21  Ben Elliston  <bje@au.ibm.com>
  2
+
  3
+	Import from Autoconf sources:
  4
+
  5
+	2005-09-06  Paul Eggert  <eggert@cs.ucla.edu>
  6
+	* config/move-if-change: Don't output "$2 is unchanged";
  7
+	suggested by Ben Elliston.  Handle weird characters correctly.
  8
+
1 9
 2005-11-18  Andreas Tobler  <a.tobler@schweiz.ch>
2 10
 
3 11
 	* ltcf-c.sh (whole_archive_flag_spec): Remove '-all_load $convenience'
44  move-if-change
... ...
@@ -1,32 +1,22 @@
1 1
 #!/bin/sh
  2
+# Like mv $1 $2, but if the files are the same, just delete $1.
  3
+# Status is zero if successful, nonzero otherwise.
2 4
 
3  
-# Copyright (C) 1996 Free Software Foundation, Inc.
4  
-#
5  
-# This program is free software; you can redistribute it and/or modify
6  
-# it under the terms of the GNU General Public License as published by
7  
-# the Free Software Foundation; either version 2 of the License, or
8  
-# (at your option) any later version.
9  
-#
10  
-# This program is distributed in the hope that it will be useful,
11  
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
12  
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  
-# GNU General Public License for more details.
14  
-#
15  
-# You should have received a copy of the GNU General Public License
16  
-# along with this program; if not, write to the Free Software
17  
-# Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  5
+usage="$0: usage: $0 SOURCE DEST"
18 6
 
19  
-if
20  
-test -r $2
21  
-then
22  
-if
23  
-cmp $1 $2 > /dev/null
24  
-then
25  
-echo $2 is unchanged
26  
-rm -f $1
27  
-else
28  
-mv -f $1 $2
29  
-fi
  7
+case $# in
  8
+2) ;;
  9
+*) echo "$usage" >&2; exit 1;;
  10
+esac
  11
+
  12
+for arg in "$1" "$2"; do
  13
+  case $arg in
  14
+   -*) echo "$usage" >&2; exit 1;;
  15
+  esac
  16
+done
  17
+
  18
+if test -r "$2" && cmp -s "$1" "$2"; then
  19
+  rm -f "$1"
30 20
 else
31  
-mv -f $1 $2
  21
+  mv -f "$1" "$2"
32 22
 fi

0 notes on commit fefdfa6

Please sign in to comment.
Something went wrong with that request. Please try again.