Index: trunk/dasscm/dasscm
===================================================================
--- trunk/dasscm/dasscm	(revision 268)
+++ trunk/dasscm/dasscm	(revision 270)
@@ -161,4 +161,8 @@
 }
 
+
+#
+# check and evaluate environment variables
+#
 sub check_env()
 {
@@ -259,4 +263,11 @@
 }
 
+
+
+#
+# has been intendend,
+# to check addtitional parameters.
+# Currently not used.
+#
 sub check_parameter(@)
 {
@@ -275,5 +286,5 @@
     # make filename absolut
     if ( !( $filename_prod =~ m/^\// ) ) {
-        $filename_prod = cwd() . "/" . $filename_prod;
+        $filename_prod = cwd() . '/' . $filename_prod;
     }
 
@@ -284,12 +295,16 @@
     # TODO: dirname buggy: eg. "/etc/" is reduced to "/",
     #	"/etc" is used as filename
-    my $dirname_prod = dirname($filename_prod);
+    #   therefore make sure, that if filename is a directory,
+    #   it will end by "/"
+    if( ( -d $filename_prod ) and ( !( $filename_prod =~ m/\/$/ ) ) ) {
+        $filename_prod = $filename_prod . '/';
+    }
+
+    ( my $basename, my $dirname_prod ) = fileparse($filename_prod);
 
     # uses chdir to determine real directory in a unique way
     chdir $dirname_prod or die $!;
-    $dirname_prod = cwd();
+    $dirname_prod = cwd() . '/';
     chdir $StartDirectory;
-
-    my $basename = basename($filename_prod);
 
     if ($verbose) {
@@ -460,13 +475,16 @@
 sub svn_update( ;$ )
 {
+    my $update_path = shift || "";
+
+    # use this flag to do only one update per run
     if( ! $svnRepositoryIsUptodate ) {
-        my $update_path = shift || $DASSCM_REPO;
         ( my $rc_update, my @result ) =
         run_command(
-            "$SVN update --non-interactive $svnCheckoutCredentials $update_path");
+            "$SVN update --non-interactive $svnCheckoutCredentials '$DASSCM_REPO/$update_path'");
         print @result;
         if ( $rc_update != 0 ) {
             fatalerror();
-        } else {
+        } elsif ( not $update_path ) {
+            # set this flag if a full update is done
             $svnRepositoryIsUptodate = 1;
         }
@@ -476,21 +494,27 @@
 
 
-sub svn_getStoredFiles( ;$ )
-{
-
-    # TODO: get_filenames?
-    #my $rel_path = shift || "";
-    #my $path = "${DASSCM_REPO}/${rel_path}";
-    my $path = ${DASSCM_REPO};
+sub svn_getStoredFiles( ;@ )
+{
+    (
+        my $basename,
+        my $dirname_prod,
+        my $dirname_repo,
+        my $filename_prod,
+        my $filename_repo
+      )
+      = get_filenames( $_[0] );
 
     # svn ls -R is better, but much, much slower
     # ( my $rc, my @result ) = run_command("$SVN ls --recursive $svnCheckoutCredentials $path");
+
+    # without the last true, run_command returns an error, if result is empty (?)
+    # TODO: replace by perl find
     ( my $rc, my @result ) =
       run_command(
-        "cd $path && find | grep -v '/.svn' | sed -e 's/\.\\///' | grep -v '^[\.]\$'"
+        "cd $dirname_repo && find | grep -v '/.svn' | sed -e 's|\.\\/||' | grep -v '^[\.]\$'; true"
       );
     if ( $rc != 0 ) {
         print @result;
-        fatalerror;
+        fatalerror('failed to get stored files');
     }
     chomp(@result);
@@ -501,9 +525,14 @@
 sub getModifiedFiles( ;$ )
 {
-    # TODO: get_filenames?
-    #my $rel_path = shift || "";
-    #my $path = "${DASSCM_REPO}/${rel_path}";
-    my $path = ${DASSCM_REPO};
-    my @files = svn_getStoredFiles($path);
+    (
+        my $basename,
+        my $dirname_prod,
+        my $dirname_repo,
+        my $filename_prod,
+        my $filename_repo
+      )
+      = get_filenames( $_[0] );
+
+    my @files = svn_getStoredFiles( $dirname_prod );
 
     # stores result from status (cvscheck)
@@ -818,9 +847,4 @@
     check_env();
 
-    # TODO: get_filenames?
-    #my $rel_path = shift || "";
-    #my $path = "${DASSCM_REPO}/${rel_path}";
-    my $dir = ${DASSCM_REPO};
-
     #
     # update local repository
@@ -828,5 +852,5 @@
     svn_update();
 
-    ( my $refChangedFiles, my $refRemovedFiles ) = getModifiedFiles( $dir );
+    ( my $refChangedFiles, my $refRemovedFiles ) = getModifiedFiles( "/" );
     my %changedfiles = %{$refChangedFiles};
     my %removedfiles = %{$refRemovedFiles};
@@ -896,4 +920,14 @@
     check_env();
 
+    (
+        my $basename,
+        my $dirname_prod,
+        my $dirname_repo,
+        my $filename_prod,
+        my $filename_repo
+      )
+      = get_filenames( $_[0] || "/" );
+
+
     # return code for the shell
     # default: error
@@ -905,7 +939,5 @@
     svn_update();
 
-    # TODO: start at subdirectories ?
-    my $dir   = $DASSCM_REPO;
-    ( my $refChangedFiles, my $refRemovedFiles ) = getModifiedFiles( $dir );
+    ( my $refChangedFiles, my $refRemovedFiles ) = getModifiedFiles( $dirname_prod );
     my %changedfiles = %{$refChangedFiles};
     my %removedfiles = %{$refRemovedFiles};
@@ -927,5 +959,5 @@
         }
     } else {
-        print "no modified files found in $dir\n";
+        print "no modified files found in $dirname_repo\n";
         $return_code = $RETURN_OK;
     }
@@ -936,5 +968,5 @@
 
 
-sub permissions(@)
+sub permissions()
 {
     check_parameter( @_, 1 );
@@ -946,7 +978,6 @@
     #svn_update();
 
-    # TODO: start at subdirectories ?
     my $dir   = $DASSCM_REPO;
-    my @files = svn_getStoredFiles($dir);
+    my @files = svn_getStoredFiles( "/" );
 
     if (@files) {
@@ -1074,5 +1105,5 @@
     } elsif (m/permissions/i) {
         $command = "permissions";
-        permissions(@ARGV);
+        permissions();
     } else {
         print "unknown command: $command\n\n";
