bos: re-add -salvagedirs for use with -all
[openafs.git] / src / bozo / bos.c
index 2d156fc..0e2e3f4 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright 2000, International Business Machines Corporation and others.
  * All Rights Reserved.
- * 
+ *
  * This software has been released under the terms of the IBM Public
  * License.  For details, see the LICENSE file in the top-level source
  * directory or online at http://www.openafs.org/dl/license10.html
@@ -9,77 +9,39 @@
 
 #include <afsconfig.h>
 #include <afs/param.h>
+#include <afs/stds.h>
 
+#include <afs/procmgmt.h>
+#include <roken.h>
+#include <afs/opr.h>
+
+#include <hcrypto/ui.h>
 
-#include <afs/stds.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <sys/types.h>
-#ifdef AFS_NT40_ENV
-#include <winsock2.h>
-#include <io.h>
-#include <fcntl.h>
-#else
-#include <sys/file.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <sys/socket.h>
-#include <strings.h>
-#endif /* AFS_NT40_ENV */
-#include <string.h>
-#include <afs/procmgmt.h>      /* signal(), kill(), wait(), etc. */
-#include <time.h>
 #include "bnode.h"
-#include <errno.h>
 #include <afs/afsutil.h>
 #include <afs/cellconfig.h>
 #include <rx/rx.h>
-#include <sys/stat.h>
 #include <rx/xdr.h>
 #include <afs/auth.h>
 #include <afs/cellconfig.h>
-#include <stdio.h>
 #include <afs/cmd.h>
 #include <afs/com_err.h>
 #include <ubik.h>
 #include <afs/ktime.h>
-#include <des.h>
-#include <des_prototypes.h>
 #include <afs/kautils.h>
+#include <afs/afsint.h>
 #include <afs/volser.h>
 
-static int IStatServer(register struct cmd_syndesc *as, int int32p);
-static int DoStat(char *aname, register struct rx_connection *aconn, 
+static int IStatServer(struct cmd_syndesc *as, int int32p);
+static int DoStat(char *aname, struct rx_connection *aconn,
                  int aint32p, int firstTime);
 
 #include "bosint.h"
+#include "bnode_internal.h"
 #include "bosprototypes.h"
 
 /* command offsets for bos salvage command */
-#define MRAFS_OFFSET  10
-#define ADDPARMOFFSET 27
-
-/* MR-AFS salvage parameters */
-struct MRAFSSalvageParms {
-    afs_int32 Optdebug;
-    afs_int32 Optnowrite;
-    afs_int32 Optforce;
-    afs_int32 Optoktozap;
-    afs_int32 Optrootfiles;
-    afs_int32 Optsalvagedirs;
-    afs_int32 Optblockreads;
-    afs_int32 OptListResidencies;
-    afs_int32 OptSalvageRemote;
-    afs_int32 OptSalvageArchival;
-    afs_int32 OptIgnoreCheck;
-    afs_int32 OptForceOnLine;
-    afs_int32 OptUseRootDirACL;
-    afs_int32 OptTraceBadLinkCounts;
-    afs_int32 OptDontAskFS;
-    afs_int32 OptLogLevel;
-    afs_int32 OptRxDebug;
-    afs_uint32 OptResidencies;
-};
+#define ADDPARMOFFSET 11
 
 /* dummy routine for the audit work.  It should do nothing since audits */
 /* occur at the server level and bos is not a server. */
@@ -100,60 +62,15 @@ em(afs_int32 acode)
        return (char *)afs_error_message(acode);
 }
 
-/* get partition id from a name */
-/* XXX - unused code - could be removed? */
-#if 0
-static afs_int32
-GetPartitionID(char *aname)
-{
-    register char tc;
-    char ascii[3];
-
-    tc = *aname;
-    if (tc == 0)
-       return -1;              /* unknown */
-    /* numbers go straight through */
-    if (tc >= '0' && tc <= '9') {
-       return atoi(aname);
-    }
-    /* otherwise check for vicepa or /vicepa, or just plain "a" */
-    ascii[2] = 0;
-    if (strlen(aname) <= 2) {
-       strcpy(ascii, aname);
-    } else if (!strncmp(aname, "/vicep", 6)) {
-       strncpy(ascii, aname + 6, 2);
-    } else if (!strncmp(aname, "vicep", 5)) {
-       strncpy(ascii, aname + 5, 2);
-    } else
-       return -1;              /* bad partition name */
-    /* now partitions are named /vicepa ... /vicepz, /vicepaa, /vicepab,
-     * .../vicepzz, and are numbered from 0.  Do the appropriate conversion */
-    if (ascii[1] == 0) {
-       /* one char name, 0..25 */
-       if (ascii[0] < 'a' || ascii[0] > 'z')
-           return -1;          /* wrongo */
-       return ascii[0] - 'a';
-    } else {
-       /* two char name, 26 .. <whatever> */
-       if (ascii[0] < 'a' || ascii[0] > 'z')
-           return -1;          /* wrongo */
-       if (ascii[1] < 'a' || ascii[1] > 'z')
-           return -1;          /* just as bad */
-       return (ascii[0] - 'a') * 26 + (ascii[1] - 'a') + 26;
-    }
-}
-#endif
-
 /* make ctime easier to use */
 static char *
-DateOf(afs_int32 atime)
+DateOf(time_t atime)
 {
     static char tbuffer[30];
-    register char *tp;
-    time_t t = (time_t) atime;
-    tp = ctime(&t);
+    char *tp;
+    tp = ctime(&atime);
     if (tp) {
-       strcpy(tbuffer, tp);
+       strlcpy(tbuffer, tp, sizeof(tbuffer));
        tbuffer[24] = 0;        /* get rid of new line */
     } else
        strcpy(tbuffer, "BAD TIME");
@@ -171,8 +88,8 @@ GetConn(struct cmd_syndesc *as, int aencrypt)
     char *hostname;
     char *cellname = NULL;
     const char *confdir;
-    register afs_int32 code;
-    register struct rx_connection *tconn;
+    afs_int32 code;
+    struct rx_connection *tconn;
     afs_int32 addr;
     struct afsconf_dir *tdir = NULL;
     afsconf_secflags secFlags;
@@ -182,12 +99,16 @@ GetConn(struct cmd_syndesc *as, int aencrypt)
     hostname = as->parms[0].items->data;
     th = hostutil_GetHostByName(hostname);
     if (!th) {
-       printf("bos: can't find address for host '%s'\n", hostname);
+       fprintf(stderr, "bos: can't find address for host '%s'\n", hostname);
        exit(1);
     }
     memcpy(&addr, th->h_addr, sizeof(afs_int32));
 
-    secFlags = AFSCONF_SECOPTS_FALLBACK_NULL;
+    if (aencrypt)
+       secFlags = AFSCONF_SECOPTS_ALWAYSENCRYPT;
+    else
+       secFlags = AFSCONF_SECOPTS_FALLBACK_NULL;
+
 
     if (as->parms[ADDPARMOFFSET + 2].items) { /* -localauth */
        secFlags |= AFSCONF_SECOPTS_LOCALAUTH;
@@ -203,7 +124,7 @@ GetConn(struct cmd_syndesc *as, int aencrypt)
         * directory */
        tdir = afsconf_Open(confdir);
        if (tdir == NULL) {
-           printf("bos: can't open cell database (%s)\n", confdir);
+           fprintf(stderr, "bos: can't open cell database (%s)\n", confdir);
            exit(1);
        }
     }
@@ -235,20 +156,20 @@ GetConn(struct cmd_syndesc *as, int aencrypt)
 static int
 SetAuth(struct cmd_syndesc *as, void *arock)
 {
-    register afs_int32 code;
-    register struct rx_connection *tconn;
+    afs_int32 code;
+    struct rx_connection *tconn;
     afs_int32 flag;
-    register char *tp;
+    char *tp;
 
-    tconn = GetConn(as, 0);
+    tconn = GetConn(as, 1);
     tp = as->parms[1].items->data;
     if (strcmp(tp, "on") == 0)
        flag = 0;               /* auth req.: noauthflag is false */
     else if (strcmp(tp, "off") == 0)
        flag = 1;
     else {
-       printf
-           ("bos: illegal authentication specifier '%s', must be 'off' or 'on'.\n",
+       fprintf
+           (stderr, "bos: illegal authentication specifier '%s', must be 'off' or 'on'.\n",
             tp);
        return 1;
     }
@@ -263,7 +184,7 @@ SetAuth(struct cmd_syndesc *as, void *arock)
 static int
 ComputeDestDir(char *aname, char *adir, char *aresult, afs_int32 alen)
 {
-    register char *tp;
+    char *tp;
 
     strcpy(aresult, adir);
     tp = strrchr(aname, '/');
@@ -280,10 +201,10 @@ ComputeDestDir(char *aname, char *adir, char *aresult, afs_int32 alen)
 
 /* copy data from fd afd to rx call acall */
 static int
-CopyBytes(int afd, register struct rx_call *acall)
+CopyBytes(int afd, struct rx_call *acall)
 {
-    register afs_int32 code;
-    register afs_int32 len;
+    afs_int32 code;
+    afs_int32 len;
     char tbuffer[256];
 
     while (1) {
@@ -299,13 +220,13 @@ CopyBytes(int afd, register struct rx_call *acall)
 }
 
 static int
-Prune(register struct cmd_syndesc *as, void *arock)
+Prune(struct cmd_syndesc *as, void *arock)
 {
-    register afs_int32 code;
-    register struct rx_connection *tconn;
-    register afs_int32 flags;
+    afs_int32 code;
+    struct rx_connection *tconn;
+    afs_int32 flags;
 
-    tconn = GetConn(as, 0);
+    tconn = GetConn(as, 1);
     flags = 0;
     if (as->parms[1].items)
        flags |= BOZO_PRUNEBAK;
@@ -322,31 +243,31 @@ Prune(register struct cmd_syndesc *as, void *arock)
 }
 
 static int
-Exec(register struct cmd_syndesc *as, void *arock)
+Exec(struct cmd_syndesc *as, void *arock)
 {
-    register struct rx_connection *tconn;
-    register afs_int32 code;
+    struct rx_connection *tconn;
+    afs_int32 code;
 
-    tconn = GetConn(as, 0);
+    tconn = GetConn(as, 1);
     code = BOZO_Exec(tconn, as->parms[1].items->data);
     if (code)
-       printf("bos: failed to execute command (%s)\n", em(code));
+       fprintf(stderr, "bos: failed to execute command (%s)\n", em(code));
     return code;
 }
 
 static int
-GetDate(register struct cmd_syndesc *as, void *arock)
+GetDate(struct cmd_syndesc *as, void *arock)
 {
-    register afs_int32 code;
+    afs_int32 code;
     char tbuffer[256];
     char destDir[256];
     afs_int32 time, bakTime, oldTime;
-    register struct rx_connection *tconn;
-    register struct cmd_item *ti;
+    struct rx_connection *tconn;
+    struct cmd_item *ti;
 
     tconn = GetConn(as, 0);
     if (!as->parms[1].items) {
-       printf("bos: no files to check\n");
+       fprintf(stderr, "bos: no files to check\n");
        return 1;
     }
 
@@ -361,7 +282,7 @@ GetDate(register struct cmd_syndesc *as, void *arock)
        ComputeDestDir(ti->data, destDir, tbuffer, sizeof(tbuffer));
        code = BOZO_GetDates(tconn, tbuffer, &time, &bakTime, &oldTime);
        if (code) {
-           printf("bos: failed to check date on %s (%s)\n", ti->data,
+           fprintf(stderr, "bos: failed to check date on %s (%s)\n", ti->data,
                   em(code));
            return 1;
        } else {
@@ -385,17 +306,17 @@ GetDate(register struct cmd_syndesc *as, void *arock)
 }
 
 static int
-UnInstall(register struct cmd_syndesc *as, void *arock)
+UnInstall(struct cmd_syndesc *as, void *arock)
 {
-    register afs_int32 code;
+    afs_int32 code;
     char tbuffer[256];
     char destDir[256];
-    register struct cmd_item *ti;
-    register struct rx_connection *tconn;
+    struct cmd_item *ti;
+    struct rx_connection *tconn;
 
-    tconn = GetConn(as, 0);
+    tconn = GetConn(as, 1);
     if (!as->parms[1].items) {
-       printf("bos: no files to uninstall\n");
+       fprintf(stderr, "bos: no files to uninstall\n");
        return 1;
     }
 
@@ -410,7 +331,7 @@ UnInstall(register struct cmd_syndesc *as, void *arock)
        ComputeDestDir(ti->data, destDir, tbuffer, sizeof(tbuffer));
        code = BOZO_UnInstall(tconn, tbuffer);
        if (code) {
-           printf("bos: failed to uninstall %s (%s)\n", ti->data, em(code));
+           fprintf(stderr, "bos: failed to uninstall %s (%s)\n", ti->data, em(code));
            return 1;
        } else
            printf("bos: uninstalled file %s\n", ti->data);
@@ -423,13 +344,13 @@ GetServerGoal(struct rx_connection *aconn, char *aname)
 {
     char buffer[500];
     char *tp;
-    register afs_int32 code;
+    afs_int32 code;
     struct bozo_status istatus;
 
     tp = buffer;
     code = BOZO_GetInstanceInfo(aconn, aname, &tp, &istatus);
     if (code) {
-       printf("bos: failed to get instance info for '%s' (%s)\n", aname,
+       fprintf(stderr, "bos: failed to get instance info for '%s' (%s)\n", aname,
               em(code));
        /* if we can't get the answer, assume its running */
        return BSTAT_NORMAL;
@@ -444,17 +365,17 @@ static int
 Install(struct cmd_syndesc *as, void *arock)
 {
     struct rx_connection *tconn;
-    register afs_int32 code;
-    register struct cmd_item *ti;
+    afs_int32 code;
+    struct cmd_item *ti;
     struct stat tstat;
     char tbuffer[256];
     int fd;
     struct rx_call *tcall;
     char destDir[256];
 
-    tconn = GetConn(as, 0);
+    tconn = GetConn(as, 1);
     if (!as->parms[1].items) {
-       printf("bos: no files to install\n");
+       fprintf(stderr, "bos: no files to install\n");
        return 1;
     }
 
@@ -469,12 +390,12 @@ Install(struct cmd_syndesc *as, void *arock)
        fd = open(ti->data, O_RDONLY);
        if (fd < 0) {
            /* better to quit on error than continue for install command */
-           printf("bos: can't find file '%s', quitting\n", ti->data);
+           fprintf(stderr, "bos: can't find file '%s', quitting\n", ti->data);
            return 1;
        }
        code = fstat(fd, &tstat);
        if (code) {
-           printf("bos: failed to stat file %s, errno is %d\n", ti->data,
+           fprintf(stderr, "bos: failed to stat file %s, errno is %d\n", ti->data,
                   errno);
            return 1;
        }
@@ -489,7 +410,7 @@ Install(struct cmd_syndesc *as, void *arock)
        }
        code = rx_EndCall(tcall, code);
        if (code) {
-           printf("bos: failed to install %s (%s)\n", ti->data, em(code));
+           fprintf(stderr, "bos: failed to install %s (%s)\n", ti->data, em(code));
            return 1;
        } else
            printf("bos: installed file %s\n", ti->data);
@@ -500,68 +421,36 @@ Install(struct cmd_syndesc *as, void *arock)
 static int
 Shutdown(struct cmd_syndesc *as, void *arock)
 {
-    register struct rx_connection *tconn;
-    register afs_int32 code;
-    register struct cmd_item *ti;
+    struct rx_connection *tconn;
+    afs_int32 code;
+    struct cmd_item *ti;
 
-    tconn = GetConn(as, 0);
+    tconn = GetConn(as, 1);
     if (as->parms[1].items == 0) {
        code = BOZO_ShutdownAll(tconn);
        if (code)
-           printf("bos: failed to shutdown servers (%s)\n", em(code));
+           fprintf(stderr, "bos: failed to shutdown servers (%s)\n", em(code));
     } else {
        for (ti = as->parms[1].items; ti; ti = ti->next) {
            code = BOZO_SetTStatus(tconn, ti->data, BSTAT_SHUTDOWN);
            if (code)
-               printf("bos: failed to shutdown instance %s (%s)\n", ti->data,
+               fprintf(stderr, "bos: failed to shutdown instance %s (%s)\n", ti->data,
                       em(code));
        }
     }
     if (as->parms[8].items) {
        code = BOZO_WaitAll(tconn);
        if (code)
-           printf("bos: can't wait for processes to shutdown (%s)\n",
+           fprintf(stderr, "bos: can't wait for processes to shutdown (%s)\n",
                   em(code));
     }
     return 0;
 }
 
 static int
-BlockScannerCmd(struct cmd_syndesc *as, void *arock)
-{
-    register afs_int32 code;
-    struct rx_connection *tconn;
-    char BlockCommand[] = "/usr/afs/bin/scanner -block";
-
-    tconn = GetConn(as, 0);
-    code = BOZO_Exec(tconn, BlockCommand);
-    if (code)
-       printf
-           ("bos: failed to block scanner from making migration requests (%s)\n",
-            em(code));
-    return 0;
-}
-
-static int
-UnBlockScannerCmd(struct cmd_syndesc *as, void *arock)
-{
-    register afs_int32 code;
-    struct rx_connection *tconn;
-    char UnBlockCommand[] = "/usr/afs/bin/scanner -unblock";
-
-    tconn = GetConn(as, 0);
-    code = BOZO_Exec(tconn, UnBlockCommand);
-    if (code)
-       printf
-           ("bos: failed to allow scanner daemon to make migration requests again (%s)\n",
-            em(code));
-    return 0;
-}
-
-static int
 GetRestartCmd(struct cmd_syndesc *as, void *arock)
 {
-    register afs_int32 code;
+    afs_int32 code;
     struct ktime generalTime, newBinaryTime;
     char messageBuffer[256];
     struct rx_connection *tconn;
@@ -572,27 +461,27 @@ GetRestartCmd(struct cmd_syndesc *as, void *arock)
 
     code = BOZO_GetRestartTime(tconn, 1, (struct bozo_netKTime *) &generalTime);
     if (code) {
-       printf("bos: failed to retrieve restart information (%s)\n",
+       fprintf(stderr, "bos: failed to retrieve restart information (%s)\n",
               em(code));
        return code;
     }
     code = BOZO_GetRestartTime(tconn, 2, (struct bozo_netKTime *) &newBinaryTime);
     if (code) {
-       printf("bos: failed to retrieve restart information (%s)\n",
+       fprintf(stderr, "bos: failed to retrieve restart information (%s)\n",
               em(code));
        return code;
     }
 
     code = ktime_DisplayString(&generalTime, messageBuffer);
     if (code) {
-       printf("bos: failed to decode restart time (%s)\n", em(code));
+       fprintf(stderr, "bos: failed to decode restart time (%s)\n", em(code));
        return code;
     }
     printf("Server %s restarts %s\n", hostp, messageBuffer);
 
     code = ktime_DisplayString(&newBinaryTime, messageBuffer);
     if (code) {
-       printf("bos: failed to decode restart time (%s)\n", em(code));
+       fprintf(stderr, "bos: failed to decode restart time (%s)\n", em(code));
        return code;
     }
     printf("Server %s restarts for new binaries %s\n", hostp, messageBuffer);
@@ -605,13 +494,13 @@ static int
 SetRestartCmd(struct cmd_syndesc *as, void *arock)
 {
     afs_int32 count = 0;
-    register afs_int32 code;
+    afs_int32 code;
     struct ktime restartTime;
     afs_int32 type = 0 ;
     struct rx_connection *tconn;
 
     count = 0;
-    tconn = GetConn(as, 0);
+    tconn = GetConn(as, 1);
     if (as->parms[2].items) {
        count++;
        type = 1;
@@ -621,21 +510,21 @@ SetRestartCmd(struct cmd_syndesc *as, void *arock)
        type = 2;
     }
     if (count > 1) {
-       printf("bos: can't specify more than one restart time at a time\n");
+       fprintf(stderr, "bos: can't specify more than one restart time at a time\n");
        return -1;
     }
     if (count == 0)
        type = 1;               /* by default set general restart time */
 
     if ((code = ktime_ParsePeriodic(as->parms[1].items->data, &restartTime))) {
-       printf("bos: failed to parse '%s' as periodic restart time(%s)\n",
+       fprintf(stderr, "bos: failed to parse '%s' as periodic restart time(%s)\n",
               as->parms[1].items->data, em(code));
        return code;
     }
 
     code = BOZO_SetRestartTime(tconn, type, (struct bozo_netKTime *) &restartTime);
     if (code) {
-       printf("bos: failed to set restart time at server (%s)\n", em(code));
+       fprintf(stderr, "bos: failed to set restart time at server (%s)\n", em(code));
        return code;
     }
     return 0;
@@ -644,20 +533,20 @@ SetRestartCmd(struct cmd_syndesc *as, void *arock)
 static int
 Startup(struct cmd_syndesc *as, void *arock)
 {
-    register struct rx_connection *tconn;
-    register afs_int32 code;
-    register struct cmd_item *ti;
+    struct rx_connection *tconn;
+    afs_int32 code;
+    struct cmd_item *ti;
 
-    tconn = GetConn(as, 0);
+    tconn = GetConn(as, 1);
     if (as->parms[1].items == 0) {
        code = BOZO_StartupAll(tconn);
        if (code)
-           printf("bos: failed to startup servers (%s)\n", em(code));
+           fprintf(stderr, "bos: failed to startup servers (%s)\n", em(code));
     } else {
        for (ti = as->parms[1].items; ti; ti = ti->next) {
            code = BOZO_SetTStatus(tconn, ti->data, BSTAT_NORMAL);
            if (code)
-               printf("bos: failed to start instance %s (%s)\n", ti->data,
+               fprintf(stderr, "bos: failed to start instance %s (%s)\n", ti->data,
                       em(code));
        }
     }
@@ -667,41 +556,41 @@ Startup(struct cmd_syndesc *as, void *arock)
 static int
 Restart(struct cmd_syndesc *as, void *arock)
 {
-    register struct rx_connection *tconn;
-    register afs_int32 code;
-    register struct cmd_item *ti;
+    struct rx_connection *tconn;
+    afs_int32 code;
+    struct cmd_item *ti;
 
-    tconn = GetConn(as, 0);
+    tconn = GetConn(as, 1);
     if (as->parms[2].items) {
        /* this is really a rebozo command */
        if (as->parms[1].items) {
            /* specified specific things to restart, can't do this at the same
             * time */
-           printf
-               ("bos: can't specify both '-bos' and specific servers to restart.\n");
+           fprintf
+               (stderr, "bos: can't specify both '-bos' and specific servers to restart.\n");
            return 1;
        }
        /* otherwise do a rebozo */
        code = BOZO_ReBozo(tconn);
        if (code)
-           printf("bos: failed to restart bosserver (%s)\n", em(code));
+           fprintf(stderr, "bos: failed to restart bosserver (%s)\n", em(code));
        return code;
     }
     if (as->parms[1].items == 0) {
        if (as->parms[3].items) {       /* '-all' */
            code = BOZO_RestartAll(tconn);
            if (code)
-               printf("bos: failed to restart servers (%s)\n", em(code));
+               fprintf(stderr, "bos: failed to restart servers (%s)\n", em(code));
        } else
-           printf("bos: To restart all processes please specify '-all'\n");
+           fprintf(stderr, "bos: To restart all processes please specify '-all'\n");
     } else {
        if (as->parms[3].items) {
-           printf("bos: Can't use '-all' along with individual instances\n");
+           fprintf(stderr, "bos: Can't use '-all' along with individual instances\n");
        } else {
            for (ti = as->parms[1].items; ti; ti = ti->next) {
                code = BOZO_Restart(tconn, ti->data);
                if (code)
-                   printf("bos: failed to restart instance %s (%s)\n",
+                   fprintf(stderr, "bos: failed to restart instance %s (%s)\n",
                           ti->data, em(code));
            }
        }
@@ -712,25 +601,25 @@ Restart(struct cmd_syndesc *as, void *arock)
 static int
 SetCellName(struct cmd_syndesc *as, void *arock)
 {
-    register struct rx_connection *tconn;
-    register afs_int32 code;
+    struct rx_connection *tconn;
+    afs_int32 code;
 
-    tconn = GetConn(as, 0);
+    tconn = GetConn(as, 1);
     code = BOZO_SetCellName(tconn, as->parms[1].items->data);
     if (code)
-       printf("bos: failed to set cell (%s)\n", em(code));
+       fprintf(stderr, "bos: failed to set cell (%s)\n", em(code));
     return 0;
 }
 
 static int
-AddHost(register struct cmd_syndesc *as, void *arock)
+AddHost(struct cmd_syndesc *as, void *arock)
 {
-    register struct rx_connection *tconn;
-    register afs_int32 code;
-    register struct cmd_item *ti;
+    struct rx_connection *tconn;
+    afs_int32 code;
+    struct cmd_item *ti;
     char name[MAXHOSTCHARS];
 
-    tconn = GetConn(as, 0);
+    tconn = GetConn(as, 1);
     for (ti = as->parms[1].items; ti; ti = ti->next) {
        if (as->parms[2].items) {
            if (strlen(ti->data) > MAXHOSTCHARS - 3) {
@@ -744,42 +633,42 @@ AddHost(register struct cmd_syndesc *as, void *arock)
        } else
            code = BOZO_AddCellHost(tconn, ti->data);
        if (code)
-           printf("bos: failed to add host %s (%s)\n", ti->data, em(code));
+           fprintf(stderr, "bos: failed to add host %s (%s)\n", ti->data, em(code));
     }
     return 0;
 }
 
 static int
-RemoveHost(register struct cmd_syndesc *as, void *arock)
+RemoveHost(struct cmd_syndesc *as, void *arock)
 {
-    register struct rx_connection *tconn;
-    register afs_int32 code;
-    register struct cmd_item *ti;
+    struct rx_connection *tconn;
+    afs_int32 code;
+    struct cmd_item *ti;
 
-    tconn = GetConn(as, 0);
+    tconn = GetConn(as, 1);
     for (ti = as->parms[1].items; ti; ti = ti->next) {
        code = BOZO_DeleteCellHost(tconn, ti->data);
        if (code)
-           printf("bos: failed to delete host %s (%s)\n", ti->data,
+           fprintf(stderr, "bos: failed to delete host %s (%s)\n", ti->data,
                   em(code));
     }
     return 0;
 }
 
 static int
-ListHosts(register struct cmd_syndesc *as, void *arock)
+ListHosts(struct cmd_syndesc *as, void *arock)
 {
-    register struct rx_connection *tconn;
-    register afs_int32 code;
+    struct rx_connection *tconn;
+    afs_int32 code;
     char tbuffer[256];
     char *tp;
-    register afs_int32 i;
+    afs_int32 i;
 
     tp = tbuffer;
     tconn = GetConn(as, 0);
     code = BOZO_GetCellName(tconn, &tp);
     if (code) {
-       printf("bos: failed to get cell name (%s)\n", em(code));
+       fprintf(stderr, "bos: failed to get cell name (%s)\n", em(code));
        exit(1);
     }
     printf("Cell name is %s\n", tbuffer);
@@ -788,7 +677,7 @@ ListHosts(register struct cmd_syndesc *as, void *arock)
        if (code == BZDOM)
            break;
        if (code != 0) {
-           printf("bos: failed to get cell host %d (%s)\n", i, em(code));
+           fprintf(stderr, "bos: failed to get cell host %d (%s)\n", i, em(code));
            exit(1);
        }
        printf("    Host %d is %s\n", i + 1, tbuffer);
@@ -797,29 +686,30 @@ ListHosts(register struct cmd_syndesc *as, void *arock)
 }
 
 static int
-AddKey(register struct cmd_syndesc *as, void *arock)
+AddKey(struct cmd_syndesc *as, void *arock)
 {
-    register struct rx_connection *tconn;
-    register afs_int32 code;
+    struct rx_connection *tconn;
+    afs_int32 code;
     struct ktc_encryptionKey tkey;
     afs_int32 temp;
-    char *tcell;
-    char cellBuffer[256];
     char buf[BUFSIZ], ver[BUFSIZ];
 
     tconn = GetConn(as, 1);
     memset(&tkey, 0, sizeof(struct ktc_encryptionKey));
 
-    if (as->parms[1].items)
-       strcpy(buf, as->parms[1].items->data);
-    else {
+    if (as->parms[1].items) {
+       if (strlcpy(buf, as->parms[1].items->data, sizeof(buf)) >= sizeof(buf)) {
+           fprintf(stderr, "Key data too long for buffer\n");
+           exit(1);
+       }
+    } else {
        /* prompt for key */
-       code = des_read_pw_string(buf, sizeof(buf), "input key: ", 0);
+       code = UI_UTIL_read_pw_string(buf, sizeof(buf), "input key: ", 0);
        if (code || strlen(buf) == 0) {
            fprintf(stderr, "Bad key: \n");
            exit(1);
        }
-       code = des_read_pw_string(ver, sizeof(ver), "Retype input key: ", 0);
+       code = UI_UTIL_read_pw_string(ver, sizeof(ver), "Retype input key: ", 0);
        if (code || strlen(ver) == 0) {
            fprintf(stderr, "Bad key: \n");
            exit(1);
@@ -839,46 +729,52 @@ AddKey(register struct cmd_syndesc *as, void *arock)
 */
        strcpy((char *)&tkey, buf);
     } else {                   /* kerberos key */
+       char *tcell;
        if (as->parms[ADDPARMOFFSET].items) {
-           strcpy(cellBuffer, as->parms[ADDPARMOFFSET].items->data);
+           tcell = strdup(as->parms[ADDPARMOFFSET].items->data);
+           if (tcell == NULL) {
+               fprintf(stderr, "bos: Unable to allocate memory for cellname\n");
+               exit(1);
+           }
 
            /* string to key needs upper-case cell names */
 
            /* I don't believe this is true.  The string to key function
             * actually expands the cell name, then LOWER-CASES it.  Perhaps it
             * didn't use to??? */
-           ucstring(cellBuffer, cellBuffer, strlen(cellBuffer));
-           tcell = cellBuffer;
+           ucstring(tcell, tcell, strlen(tcell));
        } else
            tcell = NULL;       /* no cell specified, use current */
 /*
        ka_StringToKey(as->parms[1].items->data, tcell, &tkey);
 */
        ka_StringToKey(buf, tcell, &tkey);
+
+       if (tcell)
+           free(tcell);
     }
-    tconn = GetConn(as, 1);
     code = BOZO_AddKey(tconn, temp, ktc_to_bozoptr(&tkey));
     if (code) {
-       printf("bos: failed to set key %d (%s)\n", temp, em(code));
+       fprintf(stderr, "bos: failed to set key %d (%s)\n", temp, em(code));
        exit(1);
     }
     return 0;
 }
 
 static int
-RemoveKey(register struct cmd_syndesc *as, void *arock)
+RemoveKey(struct cmd_syndesc *as, void *arock)
 {
-    register struct rx_connection *tconn;
-    register afs_int32 code;
+    struct rx_connection *tconn;
+    afs_int32 code;
     afs_int32 temp;
-    register struct cmd_item *ti;
+    struct cmd_item *ti;
 
-    tconn = GetConn(as, 0);
+    tconn = GetConn(as, 1);
     for (ti = as->parms[1].items; ti; ti = ti->next) {
        temp = atoi(ti->data);
        code = BOZO_DeleteKey(tconn, temp);
        if (code) {
-           printf("bos: failed to delete key %d (%s)\n", temp, em(code));
+           fprintf(stderr, "bos: failed to delete key %d (%s)\n", temp, em(code));
            exit(1);
        }
     }
@@ -886,15 +782,15 @@ RemoveKey(register struct cmd_syndesc *as, void *arock)
 }
 
 static int
-ListKeys(register struct cmd_syndesc *as, void *arock)
+ListKeys(struct cmd_syndesc *as, void *arock)
 {
-    register struct rx_connection *tconn;
-    register afs_int32 code;
+    struct rx_connection *tconn;
+    afs_int32 code;
     struct ktc_encryptionKey tkey;
     afs_int32 kvno;
     struct bozo_keyInfo keyInfo;
     int everWorked;
-    register afs_int32 i;
+    afs_int32 i;
 
     tconn = GetConn(as, 1);
     everWorked = 0;
@@ -904,9 +800,10 @@ ListKeys(register struct cmd_syndesc *as, void *arock)
            break;
        everWorked = 1;
        /* first check if key is returned */
-       if ((!ka_KeyIsZero(ktc_to_charptr(&tkey), sizeof(tkey))) && (as->parms[1].items)) {
+       if ((!ka_KeyIsZero((char *)&tkey, sizeof(tkey)))
+           && (as->parms[1].items)) {
            printf("key %d is '", kvno);
-           ka_PrintBytes(ktc_to_charptr(&tkey), sizeof(tkey));
+           ka_PrintBytes((char *)&tkey, sizeof(tkey));
            printf("'\n");
        } else {
            if (keyInfo.keyCheckSum == 0)       /* shouldn't happen */
@@ -919,26 +816,26 @@ ListKeys(register struct cmd_syndesc *as, void *arock)
        printf("Keys last changed on %s.\n", DateOf(keyInfo.mod_sec));
     }
     if (code != BZDOM)
-       printf("bos: %s error encountered while listing keys\n", em(code));
+       fprintf(stderr, "bos: %s error encountered while listing keys\n", em(code));
     else
        printf("All done.\n");
     return 0;
 }
 
 static int
-AddSUser(register struct cmd_syndesc *as, void *arock)
+AddSUser(struct cmd_syndesc *as, void *arock)
 {
-    register struct rx_connection *tconn;
-    register afs_int32 code;
+    struct rx_connection *tconn;
+    afs_int32 code;
     int failed;
-    register struct cmd_item *ti;
+    struct cmd_item *ti;
 
     failed = 0;
-    tconn = GetConn(as, 0);
+    tconn = GetConn(as, 1);
     for (ti = as->parms[1].items; ti; ti = ti->next) {
        code = BOZO_AddSUser(tconn, ti->data);
        if (code) {
-           printf("bos: failed to add user '%s' (%s)\n", ti->data, em(code));
+           fprintf(stderr, "bos: failed to add user '%s' (%s)\n", ti->data, em(code));
            failed = 1;
        }
     }
@@ -946,23 +843,23 @@ AddSUser(register struct cmd_syndesc *as, void *arock)
 }
 
 static int
-RemoveSUser(register struct cmd_syndesc *as, void *arock)
+RemoveSUser(struct cmd_syndesc *as, void *arock)
 {
-    register struct rx_connection *tconn;
-    register struct cmd_item *ti;
-    register afs_int32 code;
+    struct rx_connection *tconn;
+    struct cmd_item *ti;
+    afs_int32 code;
     int failed;
 
     failed = 0;
-    tconn = GetConn(as, 0);
+    tconn = GetConn(as, 1);
     for (ti = as->parms[1].items; ti; ti = ti->next) {
        code = BOZO_DeleteSUser(tconn, ti->data);
        if (code) {
-           printf("bos: failed to delete user '%s', ", ti->data);
+           fprintf(stderr, "bos: failed to delete user '%s', ", ti->data);
            if (code == ENOENT)
-               printf("(no such user)\n");
+               fprintf(stderr, "(no such user)\n");
            else
-               printf("(%s)\n", em(code));
+               fprintf(stderr, "(%s)\n", em(code));
            failed = 1;
        }
     }
@@ -971,11 +868,11 @@ RemoveSUser(register struct cmd_syndesc *as, void *arock)
 
 #define        NPERLINE    10          /* dudes to print per line */
 static int
-ListSUsers(register struct cmd_syndesc *as, void *arock)
+ListSUsers(struct cmd_syndesc *as, void *arock)
 {
-    register struct rx_connection *tconn;
-    register int i;
-    register afs_int32 code;
+    struct rx_connection *tconn;
+    int i;
+    afs_int32 code;
     char tbuffer[256];
     char *tp;
     int lastNL, printGreeting;
@@ -1001,7 +898,7 @@ ListSUsers(register struct cmd_syndesc *as, void *arock)
     }
     if (code != 1) {
        /* a real error code, instead of scanned past end */
-       printf("bos: failed to retrieve super-user list (%s)\n", em(code));
+       fprintf(stderr, "bos: failed to retrieve super-user list (%s)\n", em(code));
        return code;
     }
     if (lastNL == 0)
@@ -1010,11 +907,11 @@ ListSUsers(register struct cmd_syndesc *as, void *arock)
 }
 
 static int
-StatServer(register struct cmd_syndesc *as, void *arock)
+StatServer(struct cmd_syndesc *as, void *arock)
 {
-    register struct rx_connection *tconn;
-    register afs_int32 code;
-    register int i;
+    struct rx_connection *tconn;
+    afs_int32 code;
+    int i;
     char ibuffer[BOZO_BSSIZE];
     char *tp;
     int int32p;
@@ -1034,7 +931,7 @@ StatServer(register struct cmd_syndesc *as, void *arock)
        if (code == BZDOM)
            break;
        if (code) {
-           printf("bos: failed to contact host's bosserver (%s).\n",
+           fprintf(stderr, "bos: failed to contact host's bosserver (%s).\n",
                   em(code));
            break;
        }
@@ -1044,16 +941,16 @@ StatServer(register struct cmd_syndesc *as, void *arock)
 }
 
 static int
-CreateServer(register struct cmd_syndesc *as, void *arock)
+CreateServer(struct cmd_syndesc *as, void *arock)
 {
-    register struct rx_connection *tconn;
-    register afs_int32 code;
+    struct rx_connection *tconn;
+    afs_int32 code;
     char *parms[6];
-    register struct cmd_item *ti;
-    register int i;
+    struct cmd_item *ti;
+    int i;
     char *type, *name, *notifier = NONOTIFIER;
 
-    tconn = GetConn(as, 0);
+    tconn = GetConn(as, 1);
     for (i = 0; i < 6; i++)
        parms[i] = "";
     for (i = 0, ti = as->parms[3].items; (ti && i < 6); ti = ti->next, i++) {
@@ -1068,29 +965,29 @@ CreateServer(register struct cmd_syndesc *as, void *arock)
        BOZO_CreateBnode(tconn, type, name, parms[0], parms[1], parms[2],
                         parms[3], parms[4], notifier);
     if (code) {
-       printf
-           ("bos: failed to create new server instance %s of type '%s' (%s)\n",
+       fprintf
+           (stderr, "bos: failed to create new server instance %s of type '%s' (%s)\n",
             name, type, em(code));
     }
     return code;
 }
 
 static int
-DeleteServer(register struct cmd_syndesc *as, void *arock)
+DeleteServer(struct cmd_syndesc *as, void *arock)
 {
-    register struct rx_connection *tconn;
-    register afs_int32 code;
-    register struct cmd_item *ti;
+    struct rx_connection *tconn;
+    afs_int32 code;
+    struct cmd_item *ti;
 
     code = 0;
-    tconn = GetConn(as, 0);
+    tconn = GetConn(as, 1);
     for (ti = as->parms[1].items; ti; ti = ti->next) {
        code = BOZO_DeleteBnode(tconn, ti->data);
        if (code) {
            if (code == BZBUSY)
-               printf("bos: can't delete running instance '%s'\n", ti->data);
+               fprintf(stderr, "bos: can't delete running instance '%s'\n", ti->data);
            else
-               printf("bos: failed to delete instance '%s' (%s)\n", ti->data,
+               fprintf(stderr, "bos: failed to delete instance '%s' (%s)\n", ti->data,
                       em(code));
        }
     }
@@ -1098,56 +995,53 @@ DeleteServer(register struct cmd_syndesc *as, void *arock)
 }
 
 static int
-StartServer(register struct cmd_syndesc *as, void *arock)
+StartServer(struct cmd_syndesc *as, void *arock)
 {
-    register struct rx_connection *tconn;
-    register afs_int32 code;
-    register struct cmd_item *ti;
+    struct rx_connection *tconn;
+    afs_int32 code;
+    struct cmd_item *ti;
 
     code = 0;
-    tconn = GetConn(as, 0);
+    tconn = GetConn(as, 1);
     for (ti = as->parms[1].items; ti; ti = ti->next) {
        code = BOZO_SetStatus(tconn, ti->data, BSTAT_NORMAL);
        if (code)
-           printf("bos: failed to start instance '%s' (%s)\n", ti->data,
-                  em(code));
+           fprintf(stderr, "bos: failed to start instance '%s' (%s)\n", 
+                    ti->data, em(code));
     }
     return code;
 }
 
 static int
-StopServer(register struct cmd_syndesc *as, void *arock)
+StopServer(struct cmd_syndesc *as, void *arock)
 {
-    register struct rx_connection *tconn;
-    register afs_int32 code;
-    register struct cmd_item *ti;
+    struct rx_connection *tconn;
+    afs_int32 code;
+    struct cmd_item *ti;
 
     code = 0;
-    tconn = GetConn(as, 0);
+    tconn = GetConn(as, 1);
     for (ti = as->parms[1].items; ti; ti = ti->next) {
        code = BOZO_SetStatus(tconn, ti->data, BSTAT_SHUTDOWN);
        if (code)
-           printf("bos: failed to change stop instance '%s' (%s)\n",
+           fprintf(stderr, "bos: failed to change stop instance '%s' (%s)\n",
                   ti->data, em(code));
     }
     if (as->parms[8].items) {
        code = BOZO_WaitAll(tconn);
        if (code)
-           printf("bos: can't wait for processes to shutdown (%s)\n",
+           fprintf(stderr, "bos: can't wait for processes to shutdown (%s)\n",
                   em(code));
     }
     return code;
 }
 
-#define PARMBUFFERSSIZE 32
-
 static afs_int32
-DoSalvage(struct rx_connection * aconn, char * aparm1, char * aparm2, 
-         char * aoutName, afs_int32 showlog, char * parallel, 
-         char * atmpDir, char * orphans, int dafs, 
-         struct MRAFSSalvageParms * mrafsParm)
+DoSalvage(struct rx_connection * aconn, char * aparm1, char * aparm2,
+         char * aoutName, afs_int32 showlog, char * parallel,
+         char * atmpDir, char * orphans, int dafs, int dodirs)
 {
-    register afs_int32 code;
+    afs_int32 code;
     char *parms[6];
     char buffer;
     char tbuffer[BOZO_BSSIZE];
@@ -1157,21 +1051,21 @@ DoSalvage(struct rx_connection * aconn, char * aparm1, char * aparm2,
     FILE *outFile;
     int closeIt;
     char partName[20];         /* canonical name for partition */
-    char pbuffer[PARMBUFFERSSIZE];
     afs_int32 partNumber;
     char *notifier = NONOTIFIER;
+    int count;
 
     /* if a partition was specified, canonicalize the name, since
      * the salvager has a stupid partition ID parser */
     if (aparm1) {
        partNumber = volutil_GetPartitionID(aparm1);
        if (partNumber < 0) {
-           printf("bos: could not parse partition ID '%s'\n", aparm1);
+           fprintf(stderr, "bos: could not parse partition ID '%s'\n", aparm1);
            return EINVAL;
        }
        tp = volutil_PartitionName(partNumber);
        if (!tp) {
-           printf("bos: internal error parsing partition ID '%s'\n", aparm1);
+           fprintf(stderr, "bos: internal error parsing partition ID '%s'\n", aparm1);
            return EINVAL;
        }
        strcpy(partName, tp);
@@ -1182,7 +1076,7 @@ DoSalvage(struct rx_connection * aconn, char * aparm1, char * aparm2,
     if (aoutName) {
        outFile = fopen(aoutName, "w");
        if (!outFile) {
-           printf("bos: can't open specified SalvageLog file '%s'\n",
+           fprintf(stderr, "bos: can't open specified SalvageLog file '%s'\n",
                   aoutName);
            return ENOENT;
        }
@@ -1208,7 +1102,7 @@ DoSalvage(struct rx_connection * aconn, char * aparm1, char * aparm2,
 
            if ((strlen(tbuffer) + 9 + strlen(partName) + 1 + strlen(aparm2) +
                 1) > BOZO_BSSIZE) {
-               printf("bos: command line too big\n");
+               fprintf(stderr, "bos: command line too big\n");
                return (E2BIG);
            }
 
@@ -1221,7 +1115,7 @@ DoSalvage(struct rx_connection * aconn, char * aparm1, char * aparm2,
 
            if ((strlen(tbuffer) + 1 + strlen(partName) + 1 + strlen(aparm2) +
                 1) > BOZO_BSSIZE) {
-               printf("bos: command line too big\n");
+               fprintf(stderr, "bos: command line too big\n");
                return (E2BIG);
            }
 
@@ -1234,7 +1128,7 @@ DoSalvage(struct rx_connection * aconn, char * aparm1, char * aparm2,
        /* partition salvage */
        strncpy(tbuffer, AFSDIR_CANONICAL_SERVER_SALVAGER_FILEPATH, BOZO_BSSIZE);
        if ((strlen(tbuffer) + 4 + strlen(partName) + 1) > BOZO_BSSIZE) {
-           printf("bos: command line too big\n");
+           fprintf(stderr, "bos: command line too big\n");
            return (E2BIG);
        }
        strcat(tbuffer, " -force ");
@@ -1244,13 +1138,13 @@ DoSalvage(struct rx_connection * aconn, char * aparm1, char * aparm2,
     /* For DAFS, specifying a single volume does not result in a standard
      * salvager call.  Instead, it simply results in a SALVSYNC call to the
      * online salvager daemon.  This interface does not give us the same rich
-     * set of call flags.  Thus, we skip these steps for DAFS single-volume 
+     * set of call flags.  Thus, we skip these steps for DAFS single-volume
      * calls */
     if (!dafs || (*aparm2 == 0)) {
        /* add the parallel option if given */
        if (parallel != NULL) {
            if ((strlen(tbuffer) + 11 + strlen(parallel) + 1) > BOZO_BSSIZE) {
-               printf("bos: command line too big\n");
+               fprintf(stderr, "bos: command line too big\n");
                return (E2BIG);
            }
            strcat(tbuffer, " -parallel ");
@@ -1260,7 +1154,7 @@ DoSalvage(struct rx_connection * aconn, char * aparm1, char * aparm2,
        /* add the tmpdir option if given */
        if (atmpDir != NULL) {
            if ((strlen(tbuffer) + 9 + strlen(atmpDir) + 1) > BOZO_BSSIZE) {
-               printf("bos: command line too big\n");
+               fprintf(stderr, "bos: command line too big\n");
                return (E2BIG);
            }
            strcat(tbuffer, " -tmpdir ");
@@ -1270,53 +1164,19 @@ DoSalvage(struct rx_connection * aconn, char * aparm1, char * aparm2,
        /* add the orphans option if given */
        if (orphans != NULL) {
            if ((strlen(tbuffer) + 10 + strlen(orphans) + 1) > BOZO_BSSIZE) {
-               printf("bos: command line too big\n");
+               fprintf(stderr, "bos: command line too big\n");
                return (E2BIG);
            }
            strcat(tbuffer, " -orphans ");
            strcat(tbuffer, orphans);
        }
-
-       if (mrafsParm->Optdebug)
-           strcat(tbuffer, " -debug");
-       if (mrafsParm->Optnowrite)
-           strcat(tbuffer, " -nowrite");
-       if (mrafsParm->Optforce)
-           strcat(tbuffer, " -force");
-       if (mrafsParm->Optoktozap)
-           strcat(tbuffer, " -oktozap");
-       if (mrafsParm->Optrootfiles)
-           strcat(tbuffer, " -rootfiles");
-       if (mrafsParm->Optsalvagedirs)
+       /* add the salvagedirs option if given */
+       if (dodirs) {
+           if (strlen(tbuffer) + 14 > BOZO_BSSIZE) {
+               fprintf(stderr, "bos: command line too big\n");
+               return (E2BIG);
+           }
            strcat(tbuffer, " -salvagedirs");
-       if (mrafsParm->Optblockreads)
-           strcat(tbuffer, " -blockreads");
-       if (mrafsParm->OptListResidencies)
-           strcat(tbuffer, " -ListResidencies");
-       if (mrafsParm->OptSalvageRemote)
-           strcat(tbuffer, " -SalvageRemote");
-       if (mrafsParm->OptSalvageArchival)
-           strcat(tbuffer, " -SalvageArchival");
-       if (mrafsParm->OptIgnoreCheck)
-           strcat(tbuffer, " -IgnoreCheck");
-       if (mrafsParm->OptForceOnLine)
-           strcat(tbuffer, " -ForceOnLine");
-       if (mrafsParm->OptUseRootDirACL)
-           strcat(tbuffer, " -UseRootDirACL");
-       if (mrafsParm->OptTraceBadLinkCounts)
-           strcat(tbuffer, " -TraceBadLinkCounts");
-       if (mrafsParm->OptDontAskFS)
-           strcat(tbuffer, " -DontAskFS");
-       if (mrafsParm->OptLogLevel) {
-           sprintf(pbuffer, " -LogLevel %ld", afs_printable_int32_ld(mrafsParm->OptLogLevel));
-           strcat(tbuffer, pbuffer);
-       }
-       if (mrafsParm->OptRxDebug)
-           strcat(tbuffer, " -rxdebug");
-       if (mrafsParm->OptResidencies) {
-           sprintf(pbuffer, " -Residencies %lu", 
-                   afs_printable_uint32_lu(mrafsParm->OptResidencies));
-           strcat(tbuffer, pbuffer);
        }
     }
 
@@ -1326,20 +1186,22 @@ DoSalvage(struct rx_connection * aconn, char * aparm1, char * aparm2,
        BOZO_CreateBnode(aconn, "cron", "salvage-tmp", parms[0], parms[1],
                         parms[2], parms[3], parms[4], notifier);
     if (code) {
-       printf("bos: failed to start 'salvager' (%s)\n", em(code));
+       fprintf(stderr, "bos: failed to start 'salvager' (%s)\n", em(code));
        goto done;
     }
     /* now wait for bnode to disappear */
+    count = 0;
     while (1) {
-       IOMGR_Sleep(5);
+       IOMGR_Sleep(1);
        tp = tbuffer;
        code = BOZO_GetInstanceInfo(aconn, "salvage-tmp", &tp, &istatus);
        if (code)
            break;
-       printf("bos: waiting for salvage to complete.\n");
+       if ((++count % 5) == 0)
+           printf("bos: waiting for salvage to complete.\n");
     }
     if (code != BZNOENT) {
-       printf("bos: salvage failed (%s)\n", em(code));
+       fprintf(stderr, "bos: salvage failed (%s)\n", em(code));
        goto done;
     }
     code = 0;
@@ -1353,7 +1215,7 @@ DoSalvage(struct rx_connection * aconn, char * aparm1, char * aparm2,
        code =
            StartBOZO_GetLog(tcall, AFSDIR_CANONICAL_SERVER_SLVGLOG_FILEPATH);
        if (code) {
-           rx_EndCall(tcall, code);
+           code = rx_EndCall(tcall, code);
            goto done;
        }
        /* copy data */
@@ -1376,20 +1238,20 @@ DoSalvage(struct rx_connection * aconn, char * aparm1, char * aparm2,
 }
 
 static int
-GetLogCmd(register struct cmd_syndesc *as, void *arock)
+GetLogCmd(struct cmd_syndesc *as, void *arock)
 {
     struct rx_connection *tconn;
-    register struct rx_call *tcall;
-    register afs_int32 code;
+    struct rx_call *tcall;
+    afs_int32 code;
     char buffer;
     int error;
 
     printf("Fetching log file '%s'...\n", as->parms[1].items->data);
-    tconn = GetConn(as, 0);
+    tconn = GetConn(as, 1);
     tcall = rx_NewCall(tconn);
     code = StartBOZO_GetLog(tcall, as->parms[1].items->data);
     if (code) {
-       rx_EndCall(tcall, code);
+       code = rx_EndCall(tcall, code);
        goto done;
     }
     /* copy data */
@@ -1446,47 +1308,34 @@ IsDAFS(struct rx_connection *aconn)
 static int
 SalvageCmd(struct cmd_syndesc *as, void *arock)
 {
-    register struct rx_connection *tconn;
-    register afs_int32 code, rc, i;
+    struct rx_connection *tconn;
+    afs_int32 code, rc;
     char *outName;
     char tname[BOZO_BSSIZE];
     afs_int32 newID;
     extern struct ubik_client *cstruct;
-    afs_int32 curGoal, showlog = 0, dafs = 0, mrafs = 0;
+    afs_int32 curGoal, showlog = 0, dafs = 0;
+    int dodirs = 0;
     char *parallel;
     char *tmpDir;
     char *orphans;
-    char *tp;
     char * serviceName;
-    struct MRAFSSalvageParms mrafsParm;
-
-    memset(&mrafsParm, 0, sizeof(mrafsParm));
 
     /* parm 0 is machine name, 1 is partition, 2 is volume, 3 is -all flag */
-    tconn = GetConn(as, 0);
-
-    tp = &tname[0];
+    tconn = GetConn(as, 1);
 
     /* find out whether fileserver is running demand attach fs */
     if (IsDAFS(tconn)) {
        dafs = 1;
        serviceName = "dafs";
-       /* Find out whether fileserver is running MR-AFS (has a scanner instance) */
-       /* XXX this should really be done some other way, potentially by RPC */
-       if ((code = BOZO_GetInstanceParm(tconn, serviceName, 4, &tp) == 0))
-           mrafs = 1;
     } else {
        serviceName = "fs";
-       /* Find out whether fileserver is running MR-AFS (has a scanner instance) */
-       /* XXX this should really be done some other way, potentially by RPC */
-       if ((code = BOZO_GetInstanceParm(tconn, serviceName, 3, &tp) == 0))
-           mrafs = 1;
     }
 
     /* we can do a volume, a partition or the whole thing, but not mixtures
      * thereof */
     if (!as->parms[1].items && as->parms[2].items) {
-       printf("bos: must specify partition to salvage individual volume.\n");
+       fprintf(stderr, "bos: must specify partition to salvage individual volume.\n");
        return -1;
     }
     if (as->parms[5].items && as->parms[3].items) {
@@ -1494,7 +1343,7 @@ SalvageCmd(struct cmd_syndesc *as, void *arock)
        return -1;
     }
     if (as->parms[4].items && (as->parms[1].items || as->parms[2].items)) {
-       printf("bos: can not specify -all with other flags.\n");
+       fprintf(stderr, "bos: can not specify -all with other flags.\n");
        return -1;
     }
 
@@ -1520,85 +1369,24 @@ SalvageCmd(struct cmd_syndesc *as, void *arock)
     /* -orphans option */
     orphans = NULL;
     if (as->parms[8].items) {
-       if (mrafs) {
-           printf("Can't specify -orphans for MR-AFS fileserver\n");
-           return EINVAL;
-       }
        orphans = as->parms[8].items->data;
     }
 
     if (dafs) {
        if (!as->parms[9].items) { /* -forceDAFS flag */
-           printf("This is a demand attach fileserver.  Are you sure you want to proceed with a manual salvage?\n");
-           printf("must specify -forceDAFS flag in order to proceed.\n");
+           fprintf(stderr, "This is a demand attach fileserver.  Are you sure you want to proceed with a manual salvage?\n");
+           fprintf(stderr, "must specify -forceDAFS flag in order to proceed.\n");
            return EINVAL;
        }
     }
 
-    if (mrafs) {
-       if (as->parms[MRAFS_OFFSET].items)
-           mrafsParm.Optdebug = 1;
-       if (as->parms[MRAFS_OFFSET + 1].items)
-           mrafsParm.Optnowrite = 1;
-       if (as->parms[MRAFS_OFFSET + 2].items)
-           mrafsParm.Optforce = 1;
-       if (as->parms[MRAFS_OFFSET + 3].items)
-           mrafsParm.Optoktozap = 1;
-       if (as->parms[MRAFS_OFFSET + 4].items)
-           mrafsParm.Optrootfiles = 1;
-       if (as->parms[MRAFS_OFFSET + 5].items)
-           mrafsParm.Optsalvagedirs = 1;
-       if (as->parms[MRAFS_OFFSET + 6].items)
-           mrafsParm.Optblockreads = 1;
-       if (as->parms[MRAFS_OFFSET + 7].items)
-           mrafsParm.OptListResidencies = 1;
-       if (as->parms[MRAFS_OFFSET + 8].items)
-           mrafsParm.OptSalvageRemote = 1;
-       if (as->parms[MRAFS_OFFSET + 9].items)
-           mrafsParm.OptSalvageArchival = 1;
-       if (as->parms[MRAFS_OFFSET + 10].items)
-           mrafsParm.OptIgnoreCheck = 1;
-       if (as->parms[MRAFS_OFFSET + 11].items)
-           mrafsParm.OptForceOnLine = 1;
-       if (as->parms[MRAFS_OFFSET + 12].items)
-           mrafsParm.OptUseRootDirACL = 1;
-       if (as->parms[MRAFS_OFFSET + 13].items)
-           mrafsParm.OptTraceBadLinkCounts = 1;
-       if (as->parms[MRAFS_OFFSET + 14].items)
-           mrafsParm.OptDontAskFS = 1;
-       if (as->parms[MRAFS_OFFSET + 15].items)
-           mrafsParm.OptLogLevel =
-               atoi(as->parms[MRAFS_OFFSET + 15].items->data);
-       if (as->parms[MRAFS_OFFSET + 16].items)
-           mrafsParm.OptRxDebug = 1;
-       if (as->parms[MRAFS_OFFSET + 17].items) {
-           if (as->parms[MRAFS_OFFSET + 8].items
-               || as->parms[MRAFS_OFFSET + 9].items) {
-               printf
-                   ("Can't specify -Residencies with -SalvageRemote or -SalvageArchival\n");
-               return EINVAL;
-           }
-           code =
-               util_GetUInt32(as->parms[MRAFS_OFFSET + 17].items->data,
-                              &mrafsParm.OptResidencies);
-           if (code) {
-               printf("bos: '%s' is not a valid residency mask.\n",
-                      as->parms[MRAFS_OFFSET + 13].items->data);
-               return code;
-           }
-       }
-    } else {
-       int stop = 0;
-
-       for (i = MRAFS_OFFSET; i < ADDPARMOFFSET; i++) {
-           if (as->parms[i].items) {
-               printf(" %s only possible for MR-AFS fileserver.\n",
-                      as->parms[i].name);
-               stop = 1;
-           }
+    if (as->parms[10].items) { /* -salvagedirs */
+       if (as->parms[4].items) { /* -all */
+           dodirs = 1;
+       } else {
+           fprintf(stderr, " -salvagedirs only possible with -all.\n");
+           return EINVAL;
        }
-       if (stop)
-           exit(1);
     }
 
     if (as->parms[4].items) {
@@ -1608,23 +1396,23 @@ SalvageCmd(struct cmd_syndesc *as, void *arock)
            printf("bos: shutting down '%s'.\n", serviceName);
            code = BOZO_SetTStatus(tconn, serviceName, BSTAT_SHUTDOWN);
            if (code) {
-               printf("bos: failed to stop '%s' (%s)\n", serviceName, em(code));
+               fprintf(stderr, "bos: failed to stop '%s' (%s)\n", serviceName, em(code));
                return code;
            }
            code = BOZO_WaitAll(tconn); /* wait for shutdown to complete */
            if (code)
-               printf
-                   ("bos: failed to wait for file server shutdown, continuing.\n");
+               fprintf
+                   (stderr, "bos: failed to wait for file server shutdown, continuing.\n");
        }
        /* now do the salvage operation */
        printf("Starting salvage.\n");
        rc = DoSalvage(tconn, NULL, NULL, outName, showlog, parallel, tmpDir,
-                      orphans, dafs, &mrafsParm);
+                      orphans, dafs, dodirs);
        if (curGoal == BSTAT_NORMAL) {
            printf("bos: restarting %s.\n", serviceName);
            code = BOZO_SetTStatus(tconn, serviceName, BSTAT_NORMAL);
            if (code) {
-               printf("bos: failed to restart '%s' (%s)\n", serviceName, em(code));
+               fprintf(stderr, "bos: failed to restart '%s' (%s)\n", serviceName, em(code));
                return code;
            }
        }
@@ -1632,15 +1420,15 @@ SalvageCmd(struct cmd_syndesc *as, void *arock)
            return rc;
     } else if (!as->parms[2].items) {
        if (!as->parms[1].items) {
-           printf
-               ("bos: must specify -all switch to salvage all partitions.\n");
+           fprintf
+               (stderr, "bos: must specify -all switch to salvage all partitions.\n");
            return -1;
        }
        if (volutil_GetPartitionID(as->parms[1].items->data) < 0) {
            /* can't parse volume ID, so complain before shutting down
             * file server.
             */
-           printf("bos: can't interpret %s as partition ID.\n",
+           fprintf(stderr, "bos: can't interpret %s as partition ID.\n",
                   as->parms[1].items->data);
            return -1;
        }
@@ -1650,18 +1438,18 @@ SalvageCmd(struct cmd_syndesc *as, void *arock)
            printf("bos: shutting down '%s'.\n", serviceName);
            code = BOZO_SetTStatus(tconn, serviceName, BSTAT_SHUTDOWN);
            if (code) {
-               printf("bos: can't stop '%s' (%s)\n", serviceName, em(code));
+               fprintf(stderr, "bos: can't stop '%s' (%s)\n", serviceName, em(code));
                return code;
            }
            code = BOZO_WaitAll(tconn); /* wait for shutdown to complete */
            if (code)
-               printf
-                   ("bos: failed to wait for file server shutdown, continuing.\n");
+               fprintf
+                   (stderr, "bos: failed to wait for file server shutdown, continuing.\n");
        }
        /* now do the salvage operation */
        printf("Starting salvage.\n");
        rc = DoSalvage(tconn, as->parms[1].items->data, NULL, outName,
-                      showlog, parallel, tmpDir, orphans, dafs, &mrafsParm);
+                      showlog, parallel, tmpDir, orphans, dafs, 0);
        if (curGoal == BSTAT_NORMAL) {
            printf("bos: restarting '%s'.\n", serviceName);
            code = BOZO_SetTStatus(tconn, serviceName, BSTAT_NORMAL);
@@ -1690,19 +1478,23 @@ SalvageCmd(struct cmd_syndesc *as, void *arock)
        confdir =
            (localauth ? AFSDIR_SERVER_ETC_DIRPATH :
             AFSDIR_CLIENT_ETC_DIRPATH);
-       code = vsu_ClientInit( /* noauth */ 1, confdir, tmpname,
-                             /* server auth */ 0, &cstruct, (int (*)())0);
+
+       code = vsu_ClientInit(confdir, tmpname,
+                             AFSCONF_SECOPTS_FALLBACK_NULL |
+                             AFSCONF_SECOPTS_NOAUTH,
+                             NULL, &cstruct);
+
        if (code == 0) {
            newID = vsu_GetVolumeID(as->parms[2].items->data, cstruct, &err);
            if (newID == 0) {
-               printf("bos: can't interpret %s as volume name or ID\n",
+               fprintf(stderr, "bos: can't interpret %s as volume name or ID\n",
                       as->parms[2].items->data);
                return -1;
            }
            sprintf(tname, "%u", newID);
        } else {
-           printf
-               ("bos: can't initialize volume system client (code %d), trying anyway.\n",
+           fprintf
+               (stderr, "bos: can't initialize volume system client (code %d), trying anyway.\n",
                 code);
            strncpy(tname, as->parms[2].items->data, sizeof(tname));
        }
@@ -1710,13 +1502,13 @@ SalvageCmd(struct cmd_syndesc *as, void *arock)
            /* can't parse volume ID, so complain before shutting down
             * file server.
             */
-           printf("bos: can't interpret %s as partition ID.\n",
+           fprintf(stderr, "bos: can't interpret %s as partition ID.\n",
                   as->parms[1].items->data);
            return -1;
        }
        printf("Starting salvage.\n");
        rc = DoSalvage(tconn, as->parms[1].items->data, tname, outName,
-                      showlog, parallel, tmpDir, orphans, dafs, &mrafsParm);
+                      showlog, parallel, tmpDir, orphans, dafs, 0);
        if (rc)
            return rc;
     }
@@ -1724,10 +1516,10 @@ SalvageCmd(struct cmd_syndesc *as, void *arock)
 }
 
 static int
-IStatServer(register struct cmd_syndesc *as, int int32p)
+IStatServer(struct cmd_syndesc *as, int int32p)
 {
-    register struct rx_connection *tconn;
-    register struct cmd_item *ti;
+    struct rx_connection *tconn;
+    struct cmd_item *ti;
     int firstTime = 1;
 
     tconn = GetConn(as, 0);
@@ -1739,15 +1531,15 @@ IStatServer(register struct cmd_syndesc *as, int int32p)
 }
 
 static int
-DoStat(IN char *aname, 
-       IN register struct rx_connection *aconn, 
-       IN int aint32p, 
+DoStat(IN char *aname,
+       IN struct rx_connection *aconn,
+       IN int aint32p,
        IN int firstTime)       /* true iff first instance in cmd */
 {
     afs_int32 temp;
     char buffer[500];
-    register afs_int32 code;
-    register afs_int32 i;
+    afs_int32 code;
+    afs_int32 i;
     struct bozo_status istatus;
     char *tp;
     char *is1, *is2, *is3, *is4;       /* instance strings */
@@ -1755,7 +1547,7 @@ DoStat(IN char *aname,
     tp = buffer;
     code = BOZO_GetInstanceInfo(aconn, aname, &tp, &istatus);
     if (code) {
-       printf("bos: failed to get instance info for '%s' (%s)\n", aname,
+       fprintf(stderr, "bos: failed to get instance info for '%s' (%s)\n", aname,
               em(code));
        return -1;
     }
@@ -1783,7 +1575,7 @@ DoStat(IN char *aname,
     tp = buffer;
     code = BOZO_GetStatus(aconn, aname, &temp, &tp);
     if (code)
-       printf("bos: failed to get status for instance '%s' (%s)\n", aname,
+       fprintf(stderr, "bos: failed to get status for instance '%s' (%s)\n", aname,
               em(code));
     else {
        printf("currently ");
@@ -1859,13 +1651,13 @@ DoStat(IN char *aname,
 static int
 GetRestrict(struct cmd_syndesc *as, void *arock)
 {
-    register struct rx_connection *tconn;
+    struct rx_connection *tconn;
     afs_int32 code, val;
 
     tconn = GetConn(as, 0);
     code = BOZO_GetRestrictedMode(tconn, &val);
     if (code)
-       printf("bos: failed to get restricted mode (%s)\n", em(code));
+       fprintf(stderr, "bos: failed to get restricted mode (%s)\n", em(code));
     else
        printf("Restricted mode is %s\n", val ? "on" : "off");
 
@@ -1875,19 +1667,19 @@ GetRestrict(struct cmd_syndesc *as, void *arock)
 static int
 SetRestrict(struct cmd_syndesc *as, void *arock)
 {
-    register struct rx_connection *tconn;
+    struct rx_connection *tconn;
     afs_int32 code, val;
 
-    tconn = GetConn(as, 0);
+    tconn = GetConn(as, 1);
     util_GetInt32(as->parms[1].items->data, &val);
     code = BOZO_SetRestrictedMode(tconn, val);
     if (code)
-       printf("bos: failed to set restricted mode (%s)\n", em(code));
+       fprintf(stderr, "bos: failed to set restricted mode (%s)\n", em(code));
     return 0;
 }
 
 static void
-add_std_args(register struct cmd_syndesc *ts)
+add_std_args(struct cmd_syndesc *ts)
 {
     cmd_Seek(ts, ADDPARMOFFSET);
     /* + 0 */ cmd_AddParm(ts, "-cell", CMD_SINGLE, CMD_OPTIONAL, "cell name");
@@ -1902,14 +1694,17 @@ add_std_args(register struct cmd_syndesc *ts)
 int
 main(int argc, char **argv)
 {
-    register afs_int32 code;
-    register struct cmd_syndesc *ts;
+    afs_int32 code;
+    struct cmd_syndesc *ts;
+#ifdef AFS_NT40_ENV
+    __declspec(dllimport)
+#endif
     extern int afsconf_SawCell;
 
 #ifdef AFS_AIX32_ENV
     /*
-     * The following signal action for AIX is necessary so that in case of a 
-     * crash (i.e. core is generated) we can include the user's data section 
+     * The following signal action for AIX is necessary so that in case of a
+     * crash (i.e. core is generated) we can include the user's data section
      * in the core dump. Unfortunately, by default, only a partial core is
      * generated which, in many cases, isn't too useful.
      */
@@ -1925,7 +1720,7 @@ main(int argc, char **argv)
     /* start up rx */
     code = rx_Init(0);
     if (code) {
-       printf("bos: could not initialize rx (%s)\n", em(code));
+       fprintf(stderr, "bos: could not initialize rx (%s)\n", em(code));
        exit(1);
     }
 
@@ -1943,12 +1738,12 @@ main(int argc, char **argv)
     initialize_CMD_error_table();
     initialize_BZ_error_table();
 
-    ts = cmd_CreateSyntax("start", StartServer, NULL, "start running a server");
+    ts = cmd_CreateSyntax("start", StartServer, NULL, 0, "start running a server");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-instance", CMD_LIST, 0, "server process name");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("stop", StopServer, NULL, "halt a server instance");
+    ts = cmd_CreateSyntax("stop", StopServer, NULL, 0, "halt a server instance");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-instance", CMD_LIST, 0, "server process name");
     cmd_Seek(ts, 8);
@@ -1956,7 +1751,7 @@ main(int argc, char **argv)
                "wait for process to stop");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("status", StatServer, NULL,
+    ts = cmd_CreateSyntax("status", StatServer, NULL, 0,
                          "show server instance status");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-instance", CMD_LIST, CMD_OPTIONAL,
@@ -1964,7 +1759,7 @@ main(int argc, char **argv)
     cmd_AddParm(ts, "-long", CMD_FLAG, CMD_OPTIONAL, "long status");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("shutdown", Shutdown, NULL, "shutdown all processes");
+    ts = cmd_CreateSyntax("shutdown", Shutdown, NULL, 0, "shutdown all processes");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-instance", CMD_LIST, CMD_OPTIONAL, "instances");
     cmd_Seek(ts, 8);
@@ -1972,12 +1767,12 @@ main(int argc, char **argv)
                "wait for process to stop");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("startup", Startup, NULL, "start all processes");
+    ts = cmd_CreateSyntax("startup", Startup, NULL, 0, "start all processes");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-instance", CMD_LIST, CMD_OPTIONAL, "instances");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("restart", Restart, NULL, "restart processes");
+    ts = cmd_CreateSyntax("restart", Restart, NULL, 0, "restart processes");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-instance", CMD_LIST, CMD_OPTIONAL, "instances");
     cmd_AddParm(ts, "-bosserver", CMD_FLAG, CMD_OPTIONAL,
@@ -1987,7 +1782,7 @@ main(int argc, char **argv)
 
 #ifndef OPBOS
 
-    ts = cmd_CreateSyntax("create", CreateServer, NULL,
+    ts = cmd_CreateSyntax("create", CreateServer, NULL, 0,
                          "create a new server instance");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-instance", CMD_SINGLE, 0, "server process name");
@@ -1997,105 +1792,105 @@ main(int argc, char **argv)
                "Notifier program");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("delete", DeleteServer, NULL,
+    ts = cmd_CreateSyntax("delete", DeleteServer, NULL, 0,
                          "delete a server instance");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-instance", CMD_LIST, 0, "server process name");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("adduser", AddSUser, NULL,
+    ts = cmd_CreateSyntax("adduser", AddSUser, NULL, 0,
                          "add users to super-user list");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-user", CMD_LIST, 0, "user names");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("removeuser", RemoveSUser, NULL,
+    ts = cmd_CreateSyntax("removeuser", RemoveSUser, NULL, 0,
                          "remove users from super-user list");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-user", CMD_LIST, 0, "user names");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("listusers", ListSUsers, NULL, "list super-users");
+    ts = cmd_CreateSyntax("listusers", ListSUsers, NULL, 0, "list super-users");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("addkey", AddKey, NULL,
+    ts = cmd_CreateSyntax("addkey", AddKey, NULL, 0,
                          "add keys to key dbase (kvno 999 is bcrypt)");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-key", CMD_SINGLE, CMD_OPTIONAL, "key");
     cmd_AddParm(ts, "-kvno", CMD_SINGLE, 0, "key version number");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("removekey", RemoveKey, NULL,
+    ts = cmd_CreateSyntax("removekey", RemoveKey, NULL, 0,
                          "remove keys from key dbase");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-kvno", CMD_LIST, 0, "key version number");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("listkeys", ListKeys, NULL, "list keys");
+    ts = cmd_CreateSyntax("listkeys", ListKeys, NULL, 0, "list keys");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-showkey", CMD_FLAG, CMD_OPTIONAL,
                "show the actual key rather than the checksum");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("listhosts", ListHosts, NULL, "get cell host list");
+    ts = cmd_CreateSyntax("listhosts", ListHosts, NULL, 0, "get cell host list");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     add_std_args(ts);
     cmd_CreateAlias(ts, "getcell");
 
-    ts = cmd_CreateSyntax("setcellname", SetCellName, NULL, "set cell name");
+    ts = cmd_CreateSyntax("setcellname", SetCellName, NULL, 0, "set cell name");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-name", CMD_SINGLE, 0, "cell name");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("addhost", AddHost, NULL, "add host to cell dbase");
+    ts = cmd_CreateSyntax("addhost", AddHost, NULL, 0, "add host to cell dbase");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-host", CMD_LIST, 0, "host name");
     cmd_AddParm(ts, "-clone", CMD_FLAG, CMD_OPTIONAL, "vote doesn't count");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("removehost", RemoveHost, NULL,
+    ts = cmd_CreateSyntax("removehost", RemoveHost, NULL, 0,
                          "remove host from cell dbase");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-host", CMD_LIST, 0, "host name");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("setauth", SetAuth, NULL,
+    ts = cmd_CreateSyntax("setauth", SetAuth, NULL, 0,
                          "set authentication required flag");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-authrequired", CMD_SINGLE, 0,
                "on or off: authentication required for admin requests");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("install", Install, NULL, "install program");
+    ts = cmd_CreateSyntax("install", Install, NULL, 0, "install program");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-file", CMD_LIST, 0, "files to install");
     cmd_AddParm(ts, "-dir", CMD_SINGLE, CMD_OPTIONAL, "destination dir");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("uninstall", UnInstall, NULL, "uninstall program");
+    ts = cmd_CreateSyntax("uninstall", UnInstall, NULL, 0, "uninstall program");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-file", CMD_LIST, 0, "files to uninstall");
     cmd_AddParm(ts, "-dir", CMD_SINGLE, CMD_OPTIONAL, "destination dir");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("getlog", GetLogCmd, NULL, "examine log file");
+    ts = cmd_CreateSyntax("getlog", GetLogCmd, NULL, 0, "examine log file");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-file", CMD_SINGLE, 0, "log file to examine");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("getdate", GetDate, NULL, "get dates for programs");
+    ts = cmd_CreateSyntax("getdate", GetDate, NULL, 0, "get dates for programs");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-file", CMD_LIST, 0, "files to check");
     cmd_AddParm(ts, "-dir", CMD_SINGLE, CMD_OPTIONAL, "destination dir");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("exec", Exec, NULL, "execute shell command on server");
+    ts = cmd_CreateSyntax("exec", Exec, NULL, 0, "execute shell command on server");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-cmd", CMD_SINGLE, 0, "command to execute");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("prune", Prune, NULL, "prune server files");
+    ts = cmd_CreateSyntax("prune", Prune, NULL, 0, "prune server files");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-bak", CMD_FLAG, CMD_OPTIONAL, "delete .BAK files");
     cmd_AddParm(ts, "-old", CMD_FLAG, CMD_OPTIONAL, "delete .OLD files");
@@ -2103,7 +1898,7 @@ main(int argc, char **argv)
     cmd_AddParm(ts, "-all", CMD_FLAG, CMD_OPTIONAL, "delete all junk files");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("setrestart", SetRestartCmd, NULL,
+    ts = cmd_CreateSyntax("setrestart", SetRestartCmd, NULL, 0,
                          "set restart times");
     cmd_AddParm(ts, "-server", CMD_SINGLE, CMD_REQUIRED, "machine name");
     cmd_AddParm(ts, "-time", CMD_SINGLE, CMD_REQUIRED,
@@ -2115,13 +1910,13 @@ main(int argc, char **argv)
     add_std_args(ts);
     cmd_CreateAlias(ts, "setr");
 
-    ts = cmd_CreateSyntax("getrestart", GetRestartCmd, NULL,
+    ts = cmd_CreateSyntax("getrestart", GetRestartCmd, NULL, 0,
                          "get restart times");
     cmd_AddParm(ts, "-server", CMD_SINGLE, CMD_REQUIRED, "machine name");
     add_std_args(ts);
     cmd_CreateAlias(ts, "getr");
 
-    ts = cmd_CreateSyntax("salvage", SalvageCmd, NULL,
+    ts = cmd_CreateSyntax("salvage", SalvageCmd, NULL, 0,
                          "salvage partition or volumes");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-partition", CMD_SINGLE, CMD_OPTIONAL,
@@ -2141,60 +1936,16 @@ main(int argc, char **argv)
                "ignore | remove | attach");
     cmd_AddParm(ts, "-forceDAFS", CMD_FLAG, CMD_OPTIONAL,
                "(DAFS) force salvage of demand attach fileserver");
-    cmd_AddParm(ts, "-debug", CMD_FLAG, CMD_OPTIONAL,
-               "(MR-AFS) Run in Debugging mode");
-    cmd_AddParm(ts, "-nowrite", CMD_FLAG, CMD_OPTIONAL,
-               "(MR-AFS) Run readonly/test mode");
-    cmd_AddParm(ts, "-force", CMD_FLAG, CMD_OPTIONAL,
-               "(MR-AFS) Force full salvaging");
-    cmd_AddParm(ts, "-oktozap", CMD_FLAG, CMD_OPTIONAL,
-               "(MR-AFS) Give permission to destroy bogus file residencies/volumes - debugging flag");
-    cmd_AddParm(ts, "-rootfiles", CMD_FLAG, CMD_OPTIONAL,
-               "(MR-AFS) Show files owned by root - debugging flag");
     cmd_AddParm(ts, "-salvagedirs", CMD_FLAG, CMD_OPTIONAL,
-               "(MR-AFS) Force rebuild/salvage of all directories");
-    cmd_AddParm(ts, "-blockreads", CMD_FLAG, CMD_OPTIONAL,
-               "(MR-AFS) Read smaller blocks to handle IO/bad blocks");
-    cmd_AddParm(ts, "-ListResidencies", CMD_FLAG, CMD_OPTIONAL,
-               "(MR-AFS) Just list affected file residencies - debugging flag");
-    cmd_AddParm(ts, "-SalvageRemote", CMD_FLAG, CMD_OPTIONAL,
-               "(MR-AFS) Salvage storage systems that are not directly attached");
-    cmd_AddParm(ts, "-SalvageArchival", CMD_FLAG, CMD_OPTIONAL,
-               "(MR-AFS) Salvage HSM storage systems");
-    cmd_AddParm(ts, "-IgnoreCheck", CMD_FLAG, CMD_OPTIONAL,
-               "(MR-AFS) Don't perform VLDB safety check when deleting unreferenced files.  Only a good idea in single server cell.");
-    cmd_AddParm(ts, "-ForceOnLine", CMD_FLAG, CMD_OPTIONAL,
-               "(MR-AFS) Force the volume to come online, even if it hasn't salvaged cleanly.");
-    cmd_AddParm(ts, "-UseRootDirACL", CMD_FLAG, CMD_OPTIONAL,
-               "(MR-AFS) Use the root directory ACL for lost+found directory if it is created.");
-    cmd_AddParm(ts, "-TraceBadLinkCounts", CMD_FLAG, CMD_OPTIONAL,
-               "(MR-AFS) Print out lines about volume reference count changes.");
-    cmd_AddParm(ts, "-DontAskFS", CMD_FLAG, CMD_OPTIONAL,
-               "(MR-AFS) Don't ask fileserver to take volume offline.  THIS IS VERY DANGEROUS.");
-    cmd_AddParm(ts, "-LogLevel", CMD_SINGLE, CMD_OPTIONAL,
-               "(MR-AFS) log level");
-    cmd_AddParm(ts, "-rxdebug", CMD_FLAG, CMD_OPTIONAL,
-               "(MR-AFS) Write out rx debug information.");
-    cmd_AddParm(ts, "-Residencies", CMD_SINGLE, CMD_OPTIONAL,
-               "(MR-AFS) Numeric mask of residencies to be included in the salvage.  Do not use with -SalvageRemote or -SalvageArchival");
-    add_std_args(ts);
-
-    ts = cmd_CreateSyntax("blockscanner", BlockScannerCmd, NULL,
-                         "block scanner daemon from making migration requests");
-    cmd_AddParm(ts, "-server", CMD_SINGLE, CMD_REQUIRED, "machine name");
-    add_std_args(ts);
-
-    ts = cmd_CreateSyntax("unblockscanner", UnBlockScannerCmd, NULL,
-                         "allow scanner daemon to make migration requests again");
-    cmd_AddParm(ts, "-server", CMD_SINGLE, CMD_REQUIRED, "machine name");
+               "Force rebuild/salvage of all directories");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("getrestricted", GetRestrict, NULL,
+    ts = cmd_CreateSyntax("getrestricted", GetRestrict, NULL, 0,
                          "get restrict mode");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("setrestricted", SetRestrict, NULL,
+    ts = cmd_CreateSyntax("setrestricted", SetRestrict, NULL, 0,
                          "set restrict mode");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-mode", CMD_SINGLE, 0, "mode to set");