35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
-
+
-
-
+
-
+
-
+
-
|
#define AUTOSYNC_PULL 2
#endif /* INTERFACE */
/*
** If the respository is configured for autosyncing, then do an
** autosync. This will be a pull if the argument is true or a push
** if the argument is false. Return true if the autosync is done
** if the argument is false.
** and false if autosync is not requested for the current repository.
*/
int autosync(int flags){
void autosync(int flags){
const char *zUrl;
if( db_get_boolean("autosync", 0)==0 ){
return 0;
return;
}
zUrl = db_get("last-sync-url", 0);
if( zUrl==0 ){
return 0; /* No default server */
return; /* No default server */
}
url_parse(zUrl);
if( g.urlIsFile ){
return 0; /* Network sync only */
}
if( g.urlPort!=80 ){
printf("Autosync: http://%s:%d%s\n", g.urlName, g.urlPort, g.urlPath);
}else{
printf("Autosync: http://%s%s\n", g.urlName, g.urlPath);
}
url_enable_proxy("via proxy: ");
client_sync((flags & AUTOSYNC_PUSH)!=0, 1, 0);
return 1;
}
/*
** This routine processes the command-line argument for push, pull,
** and sync. If a command-line argument is given, that is the URL
** of a server to sync against. If no argument is given, use the
** most recently synced URL. Remember the current URL for next time.
|