From 64b62a3fd4e0b99754a67fbd25b8d583bfd5a24b Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Mon, 7 Nov 2005 17:43:17 +0000 Subject: [PATCH] fiddle --- cpu.c | 28 ++++++++++------------------ drawterm.h | 2 +- main.c | 2 -- secstore.c | 4 ++-- 4 files changed, 13 insertions(+), 23 deletions(-) diff --git a/cpu.c b/cpu.c index 4a3688f..1c44952 100644 --- a/cpu.c +++ b/cpu.c @@ -99,7 +99,7 @@ mountfactotum(void) void cpumain(int argc, char **argv) { - char dat[MaxStr], buf[MaxStr], cmd[MaxStr], *p, *err, *secstoreserver, *s; + char dat[MaxStr], buf[MaxStr], cmd[MaxStr], *err, *secstoreserver, *s; int fd, ms, data; /* see if we should use a larger message size */ @@ -115,6 +115,12 @@ cpumain(int argc, char **argv) if(user == nil) user = readcons("user", nil, 0); secstoreserver = nil; + authserver = getenv("auth"); + if(authserver == nil) + authserver = "auth"; + system = getenv("cpu"); + if(system == nil) + system = "cpu"; ARGBEGIN{ case 'a': authserver = EARGF(usage()); @@ -154,6 +160,9 @@ cpumain(int argc, char **argv) usage(); }ARGEND; + if(argc != 0) + usage(); + if(mountfactotum() < 0){ if(secstoreserver == nil) secstoreserver = authserver; @@ -167,23 +176,6 @@ cpumain(int argc, char **argv) } } - if(argc != 0) - usage(); - - if(system == nil) { - p = getenv("cpu"); - if(p == 0) - fatal(0, "set $cpu"); - system = p; - } - - if(authserver == nil) { - p = getenv("auth"); - if(p == 0) - fatal(0, "set $auth"); - authserver = p; - } - if((err = rexcall(&data, system, srvname))) fatal(1, "%s: %s", err, system); diff --git a/drawterm.h b/drawterm.h index 175d1a7..be88f73 100644 --- a/drawterm.h +++ b/drawterm.h @@ -2,7 +2,7 @@ extern int havesecstore(char *addr, char *owner); extern char *secstore; extern char secstorebuf[65536]; extern char *secstorefetch(char *addr, char *owner, char *passwd); -extern char *authaddr; +extern char *authserver; extern char *readcons(char *prompt, char *def, int secret); extern int exportfs(int, int); extern char *user; diff --git a/main.c b/main.c index 9fcf5d0..20e9419 100644 --- a/main.c +++ b/main.c @@ -6,8 +6,6 @@ #include "drawterm.h" -char *authaddr = "auth"; -char *cpuaddr = "cpu"; char *argv0; char *user; diff --git a/secstore.c b/secstore.c index 63a975d..0d031da 100644 --- a/secstore.c +++ b/secstore.c @@ -41,9 +41,9 @@ secdial(char *secstore) * like il!host or tcp!host or host. */ if(strcmp(p, "$auth")==0){ - if(authaddr == nil) + if(authserver == nil) return -1; - strecpy(buf, buf+sizeof buf, authaddr); + strecpy(buf, buf+sizeof buf, authserver); nf = getfields(buf, f, nelem(f), 0, "!"); switch(nf){ default: