diff options
author | Russ Cox <rsc@swtch.com> | 2007-10-12 12:52:52 -0400 |
---|---|---|
committer | Russ Cox <rsc@swtch.com> | 2007-10-12 12:52:52 -0400 |
commit | 4ff69507837bb2501cba25dfa219c252333cc185 (patch) | |
tree | 4b3c826cb6d322041a8a5e316279eb31ee4a1c55 /src/cmd/9p.c | |
parent | 3dc14df0f7fc06bc90bf525de440fbe15e992130 (diff) | |
download | plan9port-4ff69507837bb2501cba25dfa219c252333cc185.tar.gz plan9port-4ff69507837bb2501cba25dfa219c252333cc185.tar.bz2 plan9port-4ff69507837bb2501cba25dfa219c252333cc185.zip |
9p: add -n to disable authentication
Diffstat (limited to 'src/cmd/9p.c')
-rw-r--r-- | src/cmd/9p.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/cmd/9p.c b/src/cmd/9p.c index 4d19e5e6..1befa6b0 100644 --- a/src/cmd/9p.c +++ b/src/cmd/9p.c @@ -12,7 +12,7 @@ char *addr; void usage(void) { - fprint(2, "usage: 9p [-a address] [-A aname] cmd args...\n"); + fprint(2, "usage: 9p [-n] [-a address] [-A aname] cmd args...\n"); fprint(2, "possible cmds:\n"); fprint(2, " read name\n"); fprint(2, " readfd name\n"); @@ -25,6 +25,9 @@ usage(void) threadexitsall("usage"); } +CFsys *(*nsmnt)(char*, char*) = nsamount; +CFsys *(*fsmnt)(int, char*) = fsamount; + char *aname; void xread(int, char**); void xwrite(int, char**); @@ -68,6 +71,10 @@ threadmain(int argc, char **argv) if(strchr(addr, '!') == nil) addr = netmkaddr(addr, "tcp", "9fs"); break; + case 'n': + nsmnt = nsmount; + fsmnt = fsmount; + break; case 'D': chatty9pclient = 1; break; @@ -104,15 +111,15 @@ xparse(char *name, char **path) else *p++ = 0; *path = p; - fs = nsamount(name, aname); + fs = nsmnt(name, aname); if(fs == nil) sysfatal("mount: %r"); }else{ *path = name; if((fd = dial(addr, nil, nil, nil)) < 0) sysfatal("dial: %r"); - if((fs = fsamount(fd, aname)) == nil) - sysfatal("fsamount: %r"); + if((fs = fsmnt(fd, aname)) == nil) + sysfatal("mount: %r"); } return fs; } @@ -467,6 +474,8 @@ dircmp(const void *va, const void *vb) return strcmp(a->name, b->name); } +char *dot[] = { "." }; + void xls(int argc, char **argv) { @@ -497,6 +506,10 @@ xls(int argc, char **argv) quotefmtinstall(); fmtinstall('T', timefmt); + if(argc == 0){ + argv = dot; + argc = 1; + } for(i=0; i<argc; i++){ name = argv[i]; fs = xparse(name, &xname); |