summaryrefslogtreecommitdiff
path: root/sys/src/cmd/import.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2013-04-02 04:23:26 +0200
committercinap_lenrek <cinap_lenrek@gmx.de>2013-04-02 04:23:26 +0200
commit182ed8a2b5acf59cbf6f0e3812b8416c03c823e8 (patch)
tree13ed8ab04eafa52c1888561eaff79fb293935500 /sys/src/cmd/import.c
parentd645d4d81bed04bba1530d1dabb921279e3c4c34 (diff)
add import -z option to skip initial tree negotiation (from mycroftiv)
Diffstat (limited to 'sys/src/cmd/import.c')
-rw-r--r--sys/src/cmd/import.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/sys/src/cmd/import.c b/sys/src/cmd/import.c
index f834db929..07ed96fe6 100644
--- a/sys/src/cmd/import.c
+++ b/sys/src/cmd/import.c
@@ -25,6 +25,7 @@ AuthInfo *ai;
int debug;
int doauth = 1;
int timedout;
+int skiptree;
int connect(char*, char*, int);
int passive(void);
@@ -145,6 +146,9 @@ main(int argc, char **argv)
case 'B':
backwards = 1;
break;
+ case 'z':
+ skiptree = 1;
+ break;
default:
usage();
}ARGEND;
@@ -315,20 +319,22 @@ connect(char *system, char *tree, int oldserver)
sysfatal("%r: %s", system);
}
- procsetname("writing tree name %s", tree);
- n = write(fd, tree, strlen(tree));
- if(n < 0)
- sysfatal("can't write tree: %r");
-
- strcpy(buf, "can't read tree");
-
- procsetname("awaiting OK for %s", tree);
- n = read(fd, buf, sizeof buf - 1);
- if(n!=2 || buf[0]!='O' || buf[1]!='K'){
- if (timedout)
- sysfatal("timed out connecting to %s", na);
- buf[sizeof buf - 1] = '\0';
- sysfatal("bad remote tree: %s", buf);
+ if(!skiptree){
+ procsetname("writing tree name %s", tree);
+ n = write(fd, tree, strlen(tree));
+ if(n < 0)
+ sysfatal("can't write tree: %r");
+
+ strcpy(buf, "can't read tree");
+
+ procsetname("awaiting OK for %s", tree);
+ n = read(fd, buf, sizeof buf - 1);
+ if(n!=2 || buf[0]!='O' || buf[1]!='K'){
+ if (timedout)
+ sysfatal("timed out connecting to %s", na);
+ buf[sizeof buf - 1] = '\0';
+ sysfatal("bad remote tree: %s", buf);
+ }
}
if(oldserver)
@@ -366,7 +372,7 @@ void
usage(void)
{
fprint(2, "usage: import [-abcC] [-A] [-E clear|ssl|tls] "
-"[-e 'crypt auth'|clear] [-k keypattern] [-p] host remotefs [mountpoint]\n");
+"[-e 'crypt auth'|clear] [-k keypattern] [-p] [-z] host remotefs [mountpoint]\n");
exits("usage");
}