[PATCH 1/2] standard_file: Add else clause

Simon Marchi <[email protected]>
Newsgroups gmane.comp.sysutils.dejagnu.general
Message-ID <[email protected]>
I think that the current form:

  if ( !is_remote } {
    # Do non-remote stuff and return
  }
  # Do remote stuff

is not very clear and that this would be more readable.

  if ( !is_remote } {
    # Do non-remote stuff
  } else {
    # Do remote stuff
  }

That's all.

ChangeLog:

	* lib/remote.exp (standard_file); Add else clause.
---
 lib/remote.exp | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/lib/remote.exp b/lib/remote.exp
index bddf2ae..688680b 100644
--- a/lib/remote.exp
+++ b/lib/remote.exp
@@ -762,21 +762,22 @@ proc standard_file { dest op args } {
 		return
 	    }
 	}
-    }
-    switch $op {
-	exists {
-	    set status [remote_exec $dest "test -f $file"]
-	    return [lindex $status 0]
-	}
-	delete {
-	    set file ""
-	    # Allow multiple files to be deleted at once.
-	    foreach x $args {
-		append file " $x"
+    } else {
+	switch $op {
+	    exists {
+		set status [remote_exec $dest "test -f $file"]
+		return [lindex $status 0]
+	    }
+	    delete {
+		set file ""
+		# Allow multiple files to be deleted at once.
+		foreach x $args {
+		    append file " $x"
+		}
+		verbose "remote_file deleting $file"
+		set status [remote_exec $dest "rm -f $file"]
+		return [lindex $status 0]
 	    }
-	    verbose "remote_file deleting $file"
-	    set status [remote_exec $dest "rm -f $file"]
-	    return [lindex $status 0]
 	}
     }
 }
-- 
2.5.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.