diff options
| author | rsc <devnull@localhost> | 2005-02-11 22:16:21 +0000 |
|---|---|---|
| committer | rsc <devnull@localhost> | 2005-02-11 22:16:21 +0000 |
| commit | f0fb9c573e5e8ef31b82ba7b5f48d9e54280882e (patch) | |
| tree | 58d626a9aa49f9e1f9de72d0a708ffa752100e38 /src/cmd/factotum/main.c | |
| parent | 68f2c92c6f2978fe2c9e2ea3c6c60e584d55a9a7 (diff) | |
| download | plan9port-f0fb9c573e5e8ef31b82ba7b5f48d9e54280882e.tar.gz plan9port-f0fb9c573e5e8ef31b82ba7b5f48d9e54280882e.zip | |
make key prompt work
Diffstat (limited to 'src/cmd/factotum/main.c')
| -rw-r--r-- | src/cmd/factotum/main.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/cmd/factotum/main.c b/src/cmd/factotum/main.c index a258684d..dbcfa5fe 100644 --- a/src/cmd/factotum/main.c +++ b/src/cmd/factotum/main.c @@ -1,5 +1,6 @@ #include "std.h" #include "dat.h" +#include <9pclient.h> int extrafactotumdir; int debug; @@ -132,15 +133,16 @@ promptforkey(int fd, char *params) static int sendkey(Attr *attr) { - int fd, rv; + int rv; char buf[1024]; - - fd = open("/mnt/factotum/ctl", ORDWR); - if(fd < 0) - sysfatal("opening /mnt/factotum/ctl: %r"); - rv = fprint(fd, "key %A\n", attr); - read(fd, buf, sizeof buf); - close(fd); + CFid *fid; + + fid = nsopen("factotum", nil, "ctl", OWRITE); + if(fid == nil) + sysfatal("opening factotum/ctl: %r"); + snprint(buf, sizeof buf, "key %A\n", attr); + rv = fswrite(fid, buf, strlen(buf)); + fsclose(fid); return rv; } @@ -163,8 +165,8 @@ gflag(char *s) int nf; int fd; - if((fd = open("/dev/cons", ORDWR)) < 0) - sysfatal("open /dev/cons: %r"); + if((fd = open("/dev/tty", ORDWR)) < 0) + sysfatal("open /dev/tty: %r"); nf = getfields(s, f, nelem(f), 0, "\n"); if(nf == 1){ /* needkey or old badkey */ |
