1 #include <u.h> 2 #include <libc.h> 3 #include <bio.h> 4 #include <ip.h> 5 #include <plumb.h> 6 #include <thread.h> 7 #include <fcall.h> 8 #include <9p.h> 9 #include "dat.h" 10 #include "fns.h" 11 12 char *cookiefile; 13 char *mtpt = "/mnt/web"; 14 char *service; 15 16 Ctl globalctl = 17 { 18 1, /* accept cookies */ 19 1, /* send cookies */ 20 10, /* redirect limit */ 21 "webfs/2.0 (plan 9)" /* user agent */ 22 }; 23 24 void 25 usage(void) 26 { 27 fprint(2, "usage: webfs [-c cookies] [-m mtpt] [-s service]\n"); 28 threadexitsall("usage"); 29 } 30 31 void 32 threadmain(int argc, char **argv) 33 { 34 rfork(RFNOTEG); 35 ARGBEGIN{ 36 case 'D': 37 chatty9p++; 38 break; 39 case 'c': 40 cookiefile = EARGF(usage()); 41 break; 42 case 'm': 43 mtpt = EARGF(usage()); 44 break; 45 case 's': 46 service = EARGF(usage()); 47 break; 48 }ARGEND 49 50 quotefmtinstall(); 51 if(argc != 0) 52 usage(); 53 54 plumbinit(); 55 globalctl.useragent = estrdup(globalctl.useragent); 56 initcookies(cookiefile); 57 initurl(); 58 initfs(); 59 threadpostmountsrv(&fs, service, mtpt, MREPL); 60 threadexits(nil); 61 } 62