Blob
1 #include <u.h>2 #include <libc.h>3 #include <thread.h>4 #include <venti.h>6 char *host;7 int donothing;9 void10 usage(void)11 {12 fprint(2, "usage: sync [-h host]\n");13 threadexitsall("usage");14 }16 void17 threadmain(int argc, char *argv[])18 {19 VtConn *z;21 fmtinstall('V', vtscorefmt);22 fmtinstall('F', vtfcallfmt);24 ARGBEGIN{25 case 'h':26 host = EARGF(usage());27 if(host == nil)28 usage();29 break;30 case 'x':31 donothing = 1;32 break;33 default:34 usage();35 break;36 }ARGEND38 if(argc != 0)39 usage();41 z = vtdial(host);42 if(z == nil)43 sysfatal("could not connect to server: %r");45 if(vtconnect(z) < 0)46 sysfatal("vtconnect: %r");48 if(!donothing)49 if(vtsync(z) < 0)50 sysfatal("vtsync: %r");52 vthangup(z);53 threadexitsall(0);54 }