Add -l option to `adb sync`
Change-Id: I87c01663dff319dde24b70560e6fe5647ebf9d49
diff --git a/commandline.c b/commandline.c
index 8781081..3ee54c7 100644
--- a/commandline.c
+++ b/commandline.c
@@ -112,6 +112,7 @@
" adb push <local> <remote> - copy file/dir to device\n"
" adb pull <remote> [<local>] - copy file/dir from device\n"
" adb sync [ <directory> ] - copy host->device only if changed\n"
+ " (-l means list but don't copy)\n"
" (see 'adb help all')\n"
" adb shell - run remote shell interactively\n"
" adb shell <command> - run remote shell command\n"
@@ -1041,10 +1042,19 @@
if(!strcmp(argv[0], "sync")) {
char *srcarg, *android_srcpath, *data_srcpath;
+ int listonly = 0;
+
int ret;
if(argc < 2) {
/* No local path was specified. */
srcarg = NULL;
+ } else if (argc >= 2 && strcmp(argv[1], "-l") == 0) {
+ listonly = 1;
+ if (argc == 3) {
+ srcarg = argv[2];
+ } else {
+ srcarg = NULL;
+ }
} else if(argc == 2) {
/* A local path or "android"/"data" arg was specified. */
srcarg = argv[1];
@@ -1055,9 +1065,9 @@
if(ret != 0) return usage();
if(android_srcpath != NULL)
- ret = do_sync_sync(android_srcpath, "/system");
+ ret = do_sync_sync(android_srcpath, "/system", listonly);
if(ret == 0 && data_srcpath != NULL)
- ret = do_sync_sync(data_srcpath, "/data");
+ ret = do_sync_sync(data_srcpath, "/data", listonly);
free(android_srcpath);
free(data_srcpath);