commit de2664d8b399bd15f5ae72369bd96df10de90f8c
Author: Oswald Buddenhagen <[email protected]>
Date:   Wed Sep 25 17:51:24 2013 +0200

    make paths relative to CWD, after all
    
    the test suite actually relies on it. it would be possible to adjust it,
    but there is not much reason to make paths relative to HOME (as we
    support convenient tilde expansion). so use the least invasive approach,
    which is simply the old behavior. adjust the documentation accordingly.
    
    This reverts commit d53205fde766ec7abf69088ee247e316d9a0118a.
    (cherry picked from commit b802c7d4ed6eb09bd6cba94315d43158e20fdec6)

 src/config.c |    2 +-
 src/mbsync.1 |    4 +++-
 src/util.c   |   15 ++-------------
 3 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/src/config.c b/src/config.c
index c671c30..d8f9b52 100644
--- a/src/config.c
+++ b/src/config.c
@@ -163,7 +163,7 @@ getopt_helper( conffile_t *cfile, int *cops, int *mops, int 
*sops, char **sync_s
                while ((arg = next_arg( &cfile->rest )));
                *mops |= XOP_HAVE_CREATE;
        } else if (!strcasecmp( "SyncState", cfile->cmd ))
-               *sync_state = !strcmp( cfile->val, "*" ) ? nfstrdup( "*" ) : 
expand_strdup( cfile->val );
+               *sync_state = expand_strdup( cfile->val );
        else
                return 0;
        return 1;
diff --git a/src/mbsync.1 b/src/mbsync.1
index 304e75b..5ed8dfd 100644
--- a/src/mbsync.1
+++ b/src/mbsync.1
@@ -91,6 +91,8 @@ Lines starting with a hash mark (\fB#\fR) are comments and 
are ignored entirely.
 Configuration items are keywords followed by one or more arguments;
 arguments containing spaces must be enclosed in double quotes (\fB"\fR).
 All keywords (including those used as arguments) are case-insensitive.
+Bash-like home directory expansion using the tilde (\fB~\fR) is supported
+in all options which represent local paths.
 There are a few global options, the rest applies to particular sections.
 Sections are started by a section keyword and are terminated by an empty line
 or end of file.
@@ -161,7 +163,7 @@ Store's \fBTrash\fR. When using this, the remote Store does 
not need an own
 (Default: \fIno\fR)
 ..
 .SS Maildir Stores
-The reference point for relative \fBPath\fRs is $HOME.
+The reference point for relative \fBPath\fRs is the current working directory.
 .P
 As \fBmbsync\fR needs UIDs, but no standardized UID storage scheme exists for
 Maildir, \fBmbsync\fR supports two schemes, each with its pros and cons.
diff --git a/src/util.c b/src/util.c
index 4f6a353..6fb43c2 100644
--- a/src/util.c
+++ b/src/util.c
@@ -303,35 +303,24 @@ expand_strdup( const char *s )
        if (*s == '~') {
                s++;
                if (!*s) {
-                 rethome:
                        p = 0;
                        q = Home;
                } else if (*s == '/') {
-                       p = s + 1;
+                       p = s;
                        q = Home;
                } else {
                        if ((p = strchr( s, '/' ))) {
                                r = my_strndup( s, (int)(p - s) );
                                pw = getpwnam( r );
                                free( r );
-                               p++;
                        } else
                                pw = getpwnam( s );
                        if (!pw)
                                return 0;
                        q = pw->pw_dir;
                }
-               if (!p)
-                       return nfstrdup( q );
-         retjoin:
-               nfasprintf( &r, "%s/%s", q, p );
+               nfasprintf( &r, "%s%s", q, p ? p : "" );
                return r;
-       } else if (*s != '/') {
-               if (*s == '.' && !s[1])
-                       goto rethome;
-               p = s;
-               q = Home;
-               goto retjoin;
        } else
                return nfstrdup( s );
 }

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk
_______________________________________________
isync-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to