URI: 
       tmake key prompt work - plan9port - [fork] Plan 9 from user space
  HTML git clone git://src.adamsgaard.dk/plan9port
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit f0fb9c573e5e8ef31b82ba7b5f48d9e54280882e
   DIR parent 68f2c92c6f2978fe2c9e2ea3c6c60e584d55a9a7
  HTML Author: rsc <devnull@localhost>
       Date:   Fri, 11 Feb 2005 22:16:21 +0000
       
       make key prompt work
       
       Diffstat:
         M src/cmd/factotum/main.c             |      22 ++++++++++++----------
         M src/cmd/factotum/p9any.c            |       2 +-
         M src/cmd/factotum/secstore.c         |       6 +-----
       
       3 files changed, 14 insertions(+), 16 deletions(-)
       ---
   DIR diff --git a/src/cmd/factotum/main.c b/src/cmd/factotum/main.c
       t@@ -1,5 +1,6 @@
        #include "std.h"
        #include "dat.h"
       +#include <9pclient.h>
        
        int extrafactotumdir;
        int debug;
       t@@ -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;
        }
        
       t@@ -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 */
   DIR diff --git a/src/cmd/factotum/p9any.c b/src/cmd/factotum/p9any.c
       t@@ -189,7 +189,7 @@ p9anyclient(Conv *c)
                        if(dom && strcmp(q+1, dom) != 0)
                                continue;
                        *q++ = '\0';
       -                if(k = keyfetch(c, "%A proto=%q dom=%q", attr, f[i], q))
       +                if(k = keylookup("%A proto=%q dom=%q", attr, f[i], q))
                                goto found;
                        *--q = '@';
                }
   DIR diff --git a/src/cmd/factotum/secstore.c b/src/cmd/factotum/secstore.c
       t@@ -22,7 +22,6 @@ int
        secdial(void)
        {
                char *p;
       -        int fd;
        
                p = secstore;
                if(p == nil)          /* else use the authserver */
       t@@ -32,10 +31,7 @@ secdial(void)
                if(p == nil)
                        p = "secstore";
        
       -        fd = dial(netmkaddr(p, "net", "secstore"), 0, 0, 0);
       -        if(fd < 0)
       -                fprint(2, "secdial: %r\n");
       -        return fd;
       +        return dial(netmkaddr(p, "net", "secstore"), 0, 0, 0);
        }