Convert ubik_Call(x) calls to ubik_x()
[openafs.git] / src / bucoord / commands.c
index d7f2d99..244f4a7 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,22 +9,15 @@
 
 #include <afsconfig.h>
 #include <afs/param.h>
+#include <afs/stds.h>
 
+#include <roken.h>
 
-#include <afs/stds.h>
-#if defined(AFS_LINUX24_ENV)
-#define _REGEX_RE_COMP
+#ifdef HAVE_POSIX_REGEX                /* use POSIX regexp library */
+#include <regex.h>
 #endif
-#include <sys/types.h>
+
 #include <afs/cmd.h>
-#ifdef AFS_NT40_ENV
-#include <winsock2.h>
-#else
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#endif
-#include <errno.h>
 #include <afs/com_err.h>
 #include <afs/afsutil.h>
 #include <afs/budb.h>
 #include <afs/vldbint.h>       /* PA */
 #include <afs/ktime.h>         /* PA */
 #include <ubik.h>
-#include <time.h>
 #include <lock.h>
-#include <afs/butc.h>
 #include <afs/tcdata.h>
 #include <afs/butx.h>
 #include <afs/vsutils_prototypes.h>
-#ifdef HAVE_POSIX_REGEX                /* use POSIX regexp library */
-#include <regex.h>
-#endif
+
 #include "bc.h"
 #include "error_macros.h"
 #include "bucoord_internal.h"
@@ -54,7 +43,6 @@ extern struct bc_config *bc_globalConfig;
 extern struct bc_dumpTask bc_dumpTasks[BC_MAXSIMDUMPS];
 extern struct ubik_client *cstruct;
 extern char *whoami;
-extern struct ktc_token ttoken;
 
 char *loadFile;
 extern afs_int32 lastTaskCode;
@@ -71,9 +59,9 @@ static int EvalVolumeSet2(struct bc_config *aconfig, struct bc_volumeSet *avs,
 static int DBLookupByVolume(char *volumeName);
 
 int
-bc_EvalVolumeSet(struct bc_config *aconfig, 
-                struct bc_volumeSet *avs, 
-                struct bc_volumeDump **avols, 
+bc_EvalVolumeSet(struct bc_config *aconfig,
+                struct bc_volumeSet *avs,
+                struct bc_volumeDump **avols,
                 struct ubik_client *uclient)
 {                              /*bc_EvalVolumeSet */
     int code = -1;
@@ -105,9 +93,9 @@ struct serversort {
 };
 
 afs_int32
-getSPEntries(afs_uint32 server, afs_int32 partition, 
-            struct serversort **serverlist, 
-            struct serversort **ss, 
+getSPEntries(afs_uint32 server, afs_int32 partition,
+            struct serversort **serverlist,
+            struct serversort **ss,
             struct partitionsort **ps)
 {
     if (!(*ss) || ((*ss)->ipaddr != server)) {
@@ -121,7 +109,7 @@ getSPEntries(afs_uint32 server, afs_int32 partition,
     if (!(*ss)) {
        *ss = (struct serversort *)malloc(sizeof(struct serversort));
        if (!(*ss)) {
-           afs_com_err(whoami, BC_NOMEM, "");
+           afs_com_err(whoami, BC_NOMEM, NULL);
            *ss = 0;
            return (BC_NOMEM);
        }
@@ -142,7 +130,7 @@ getSPEntries(afs_uint32 server, afs_int32 partition,
     if (!(*ps)) {
        *ps = (struct partitionsort *)malloc(sizeof(struct partitionsort));
        if (!(*ps)) {
-           afs_com_err(whoami, BC_NOMEM, "");
+           afs_com_err(whoami, BC_NOMEM, NULL);
            free(*ss);
            *ps = 0;
            *ss = 0;
@@ -157,7 +145,7 @@ getSPEntries(afs_uint32 server, afs_int32 partition,
 }
 
 afs_int32
-randSPEntries(struct serversort *serverlist, 
+randSPEntries(struct serversort *serverlist,
              struct bc_volumeDump **avols)
 {
     struct serversort *ss, **pss;
@@ -199,9 +187,9 @@ randSPEntries(struct serversort *serverlist,
 }
 
 static int
-EvalVolumeSet2(struct bc_config *aconfig, 
-              struct bc_volumeSet *avs, 
-              struct bc_volumeDump **avols, 
+EvalVolumeSet2(struct bc_config *aconfig,
+              struct bc_volumeSet *avs,
+              struct bc_volumeDump **avols,
               struct ubik_client *uclient)
 {                              /*EvalVolumeSet2 */
     struct bc_volumeEntry *tve;
@@ -223,7 +211,7 @@ EvalVolumeSet2(struct bc_config *aconfig,
 
     /* For each of the volume set entries - collect the volumes that match it */
     for (tve = avs->ventries; tve; tve = tve->next) {
-       /* Put together a call to the vlserver for this vlentry. The 
+       /* Put together a call to the vlserver for this vlentry. The
         * performance gain is from letting the vlserver expand the
         * volumeset and not this routine.
         */
@@ -244,7 +232,7 @@ EvalVolumeSet2(struct bc_config *aconfig,
            bulkentries.nbulkentries_val = 0;
            nsi = -1;
            tcode =
-               ubik_Call(VL_ListAttributesN2, uclient, 0, &attributes,
+               ubik_VL_ListAttributesN2(uclient, 0, &attributes,
                          tve->name, si, &nentries, &bulkentries, &nsi);
            if (tcode)
                ERROR(tcode);
@@ -259,6 +247,11 @@ EvalVolumeSet2(struct bc_config *aconfig,
            if (nentries == 0)
                ERROR(RXGEN_OPCODE);    /* Use EvalVolumeSet1 */
 
+           if (nentries < 0)
+               nentries = 0;
+           if (nentries > bulkentries.nbulkentries_len)
+               nentries = bulkentries.nbulkentries_len;
+
            /* Step through each entry and add it to the list of volumes */
            entries = bulkentries.nbulkentries_val;
            for (e = 0; e < nentries; e++) {
@@ -287,7 +280,7 @@ EvalVolumeSet2(struct bc_config *aconfig,
                                 entries[e].serverPartition[ei], &servers,
                                 &ss, &ps);
                if (tcode) {
-                   afs_com_err(whoami, tcode, "");
+                   afs_com_err(whoami, tcode, NULL);
                    ERROR(tcode);
                }
 
@@ -319,14 +312,14 @@ EvalVolumeSet2(struct bc_config *aconfig,
                    tvd = (struct bc_volumeDump *)
                        malloc(sizeof(struct bc_volumeDump));
                    if (!tvd) {
-                       afs_com_err(whoami, BC_NOMEM, "");
+                       afs_com_err(whoami, BC_NOMEM, NULL);
                        ERROR(BC_NOMEM);
                    }
                    memset(tvd, 0, sizeof(*tvd));
 
                    tvd->name = (char *)malloc(strlen(entries[e].name) + 10);
                    if (!(tvd->name)) {
-                       afs_com_err(whoami, BC_NOMEM, "");
+                       afs_com_err(whoami, BC_NOMEM, NULL);
                        free(tvd);
                        ERROR(BC_NOMEM);
                    }
@@ -382,29 +375,29 @@ EvalVolumeSet2(struct bc_config *aconfig,
  * EvalVolumeSetOld
  *
  * Description:
- *     Takes the entries in a volumeset and expands them into a list of 
+ *     Takes the entries in a volumeset and expands them into a list of
  *      volumes. Every VLDB volume entry is looked at and compared to the
  *      volumeset entries.
  *
- *      When matching a VLDB volume entry to a volumeset entry, 
+ *      When matching a VLDB volume entry to a volumeset entry,
  *       1. If the RW volume entry matches, that RW volume is used.
  *       2. Otherwise, if the BK volume entry matches, the BK volume is used.
  *       3. Finally, if the RO volume entry matches, the RO volume is used.
- *      For instance: A volumeset entry of ".* .* user.t.*" will match volume 
- *                    "user.troy" and "user.troy.backup". The rules will use 
+ *      For instance: A volumeset entry of ".* .* user.t.*" will match volume
+ *                    "user.troy" and "user.troy.backup". The rules will use
  *                    the RW volume "user.troy".
  *
  *      When a VLDB volume entry matches a volumeset entry (be it RW, BK or RO),
- *      that volume is used and matches against any remaining volumeset entries 
+ *      that volume is used and matches against any remaining volumeset entries
  *      are not even done.
  *      For instance: A 1st volumeset entry ".* .* .*.backup" will match with
- *                    "user.troy.backup". Its 2nd volumeset entry ".* .* .*" 
- *                    would have matched its RW volume "user.troy", but the first 
+ *                    "user.troy.backup". Its 2nd volumeset entry ".* .* .*"
+ *                    would have matched its RW volume "user.troy", but the first
  *                    match is used and the second match isn't even done.
  *
  * Arguments:
  *     aconfig : Global configuration info.
- *     avs     : 
+ *     avs     :
  *     avols   : Ptr to linked list of entries describing volumes to dump.
  *     uclient : Ptr to Ubik client structure.
  *
@@ -420,13 +413,12 @@ EvalVolumeSet2(struct bc_config *aconfig,
  *-----------------------------------------------------------------------------
  */
 static int
-EvalVolumeSet1(struct bc_config *aconfig, 
+EvalVolumeSet1(struct bc_config *aconfig,
               struct bc_volumeSet *avs,
-              struct bc_volumeDump **avols, 
+              struct bc_volumeDump **avols,
               struct ubik_client *uclient)
 {                              /*EvalVolumeSet1 */
     afs_int32 code;            /*Result of various calls */
-    char *errm;
     struct bc_volumeDump *tvd; /*Ptr to new dump instance */
     struct bc_volumeEntry *tve, *ctve; /*Ptr to new volume entry instance */
     char patt[256];            /*Composite regex; also, target string */
@@ -444,6 +436,8 @@ EvalVolumeSet1(struct bc_config *aconfig,
 #ifdef HAVE_POSIX_REGEX
     regex_t re;
     int need_regfree = 0;
+#else
+    char *errm;
 #endif
 
     *avols = (struct bc_volumeDump *)0;
@@ -455,8 +449,7 @@ EvalVolumeSet1(struct bc_config *aconfig,
      */
     for (index = 0; 1; index = next_index) {   /*w */
        memset(&entry, 0, sizeof(entry));
-       code = ubik_Call(VL_ListEntry,  /*Routine to invoke */
-                        uclient,       /*Ubik client structure */
+       code = ubik_VL_ListEntry(uclient,       /*Ubik client structure */
                         0,     /*Ubik flags */
                         index, /*Current index */
                         &count,        /*Ptr to working variable */
@@ -529,7 +522,7 @@ EvalVolumeSet1(struct bc_config *aconfig,
                        }
                    }
 
-                   /* If the BK name matches the volume set entry, take 
+                   /* If the BK name matches the volume set entry, take
                     * it and exit. Second choice is to use the BK volume.
                     */
                    if (entry.flags & BACK_EXISTS) {
@@ -581,7 +574,7 @@ EvalVolumeSet1(struct bc_config *aconfig,
                                 entry.serverPartition[foundentry], &servers,
                                 &ss, &ps);
                if (code) {
-                   afs_com_err(whoami, code, "");
+                   afs_com_err(whoami, code, NULL);
                    return (code);
                }
 
@@ -589,14 +582,14 @@ EvalVolumeSet1(struct bc_config *aconfig,
                tvd = (struct bc_volumeDump *)
                    malloc(sizeof(struct bc_volumeDump));
                if (!tvd) {
-                   afs_com_err(whoami, BC_NOMEM, "");
+                   afs_com_err(whoami, BC_NOMEM, NULL);
                    return (BC_NOMEM);
                }
                memset(tvd, 0, sizeof(*tvd));
 
                tvd->name = (char *)malloc(strlen(entry.name) + 10);
                if (!(tvd->name)) {
-                   afs_com_err(whoami, BC_NOMEM, "");
+                   afs_com_err(whoami, BC_NOMEM, NULL);
                    free(tvd);
                    return (BC_NOMEM);
                }
@@ -636,33 +629,39 @@ EvalVolumeSet1(struct bc_config *aconfig,
     return (0);
 }                              /*EvalVolumeSet1 */
 
-/* compactDateString
- *     print out a date in compact format, 16 chars, format is
- *     mm/dd/yyyy hh:mm
- * entry:
- *     date_long - ptr to a long containing the time
- * exit:
- *     ptr to a string containing a representation of the date
- */
 char *
-compactDateString(afs_uint32 *date_long, char *string, afs_int32 size)
+compactTimeString(time_t *date, char *string, afs_int32 size)
 {
     struct tm *ltime;
 
     if (!string)
-       return 0;
+       return NULL;
 
-    if (*date_long == NEVERDATE) {
+    if (*date == NEVERDATE) {
        sprintf(string, "NEVER");
     } else {
-        time_t t = *date_long;
-       ltime = localtime(&t);
-       /* prints date in U.S. format of mm/dd/yyyy */
+       ltime = localtime(date);
        strftime(string, size, "%m/%d/%Y %H:%M", ltime);
     }
     return (string);
 }
 
+/* compactDateString
+ *     print out a date in compact format, 16 chars, format is
+ *     mm/dd/yyyy hh:mm
+ * entry:
+ *     date_long - ptr to a long containing the time
+ * exit:
+ *     ptr to a string containing a representation of the date
+ */
+char *
+compactDateString(afs_uint32 *date_long, char *string, afs_int32 size)
+{
+    time_t t = *date_long;
+    return compactTimeString(&t, string, size);
+}
+
+
 afs_int32
 bc_SafeATOI(char *anum)
 {
@@ -738,7 +737,7 @@ bc_CopyString(char *astring)
     tlen = strlen(astring);
     tp = (char *)malloc(tlen + 1);     /* don't forget the terminating null */
     if (!tp) {
-       afs_com_err(whoami, BC_NOMEM, "");
+       afs_com_err(whoami, BC_NOMEM, NULL);
        return (tp);
     }
     strcpy(tp, astring);
@@ -746,7 +745,7 @@ bc_CopyString(char *astring)
 }
 
 /* concatParams
- * 
+ *
  *    Concatenates the parameters of an option and returns the string.
  *
  */
@@ -771,7 +770,7 @@ concatParams(struct cmd_item *itemPtr)
 
     string = (char *)malloc(length);   /* allocate the string */
     if (!string) {
-       afs_com_err(whoami, BC_NOMEM, "");
+       afs_com_err(whoami, BC_NOMEM, NULL);
        return (NULL);
     }
     string[0] = 0;
@@ -790,7 +789,7 @@ concatParams(struct cmd_item *itemPtr)
 /* printIfStatus
  *     print out an interface status node as received from butc
  */
+
 void
 printIfStatus(struct tciStatusS *statusPtr)
 {
@@ -997,7 +996,7 @@ bc_JobsCmd(struct cmd_syndesc *as, void *arock)
        }
     }
 
-    /* 
+    /*
      * Now print the scheduled dumps.
      */
     if (!dlqEmpty(&statusHead) && as)
@@ -1017,11 +1016,11 @@ bc_JobsCmd(struct cmd_syndesc *as, void *arock)
        }
 
        /* Print token expiration time */
-       if ((ttoken.endTime > prevTime)
-           && (ttoken.endTime <= youngest->scheduledDump) && as
-           && (ttoken.endTime != NEVERDATE)) {
-           if (ttoken.endTime > time(0)) {
-               compactDateString(&ttoken.endTime, ds, 50);
+       if ((tokenExpires > prevTime)
+           && (tokenExpires <= youngest->scheduledDump) && as
+           && (tokenExpires != NEVERDATE)) {
+           if (tokenExpires > time(0)) {
+               compactTimeString(&tokenExpires, ds, 50);
                printf("       %16s: TOKEN EXPIRATION\n", ds);
            } else {
                printf("       TOKEN HAS EXPIRED\n");
@@ -1041,11 +1040,11 @@ bc_JobsCmd(struct cmd_syndesc *as, void *arock)
     }
 
     /* Print token expiration time if havn't already */
-    if ((ttoken.endTime == NEVERDATE) && as)
+    if ((tokenExpires == NEVERDATE) && as)
        printf("     : TOKEN NEVER EXPIRES\n");
-    else if ((ttoken.endTime > prevTime) && as) {
-       if (ttoken.endTime > time(0)) {
-           compactDateString(&ttoken.endTime, ds, 50);
+    else if ((tokenExpires > prevTime) && as) {
+       if (tokenExpires > time(0)) {
+           compactTimeString(&tokenExpires, ds, 50);
            printf("       %16s: TOKEN EXPIRATION\n", ds);
        } else {
            printf("     : TOKEN HAS EXPIRED\n");
@@ -1121,7 +1120,6 @@ bc_KillCmd(struct cmd_syndesc *as, void *arock)
        }
        statusPtr->flags |= ABORT_REQUEST;
        unlock_Status();
-       return (0);
     }
     return 0;
 }
@@ -1189,14 +1187,14 @@ bc_VolRestoreCmd(struct cmd_syndesc *as, void *arock)
        /* build list of volume items */
        tvol = (struct bc_volumeDump *)malloc(sizeof(struct bc_volumeDump));
        if (!tvol) {
-           afs_com_err(whoami, BC_NOMEM, "");
+           afs_com_err(whoami, BC_NOMEM, NULL);
            return BC_NOMEM;
        }
        memset(tvol, 0, sizeof(struct bc_volumeDump));
 
        tvol->name = (char *)malloc(VOLSER_MAXVOLNAME + 1);
        if (!tvol->name) {
-           afs_com_err(whoami, BC_NOMEM, "");
+           afs_com_err(whoami, BC_NOMEM, NULL);
            return BC_NOMEM;
        }
        strncpy(tvol->name, ti->data, VOLSER_OLDMAXVOLNAME);
@@ -1229,14 +1227,14 @@ bc_VolRestoreCmd(struct cmd_syndesc *as, void *arock)
     oldFlag = 0;
 
     /* Read all the port offsets into the ports array. The first element in the
-     * array is for full restore and the rest are for incremental restores 
+     * array is for full restore and the rest are for incremental restores
      */
     if (as->parms[5].items) {
        for (ti = as->parms[5].items; ti; ti = ti->next)
            portCount++;
        ports = (afs_int32 *) malloc(portCount * sizeof(afs_int32));
        if (!ports) {
-           afs_com_err(whoami, BC_NOMEM, "");
+           afs_com_err(whoami, BC_NOMEM, NULL);
            return BC_NOMEM;
        }
 
@@ -1255,7 +1253,7 @@ bc_VolRestoreCmd(struct cmd_syndesc *as, void *arock)
        if (dumpID <= 0)
          dumpID = 0;
       }
-    
+
     /*
      * Perform the call to start the restore.
      */
@@ -1303,7 +1301,7 @@ bc_DiskRestoreCmd(struct cmd_syndesc *as, void *arock)
 
     /* parm 0 is the server to restore
      * parm 1 is the partition to restore
-     
+
      * parm 8 and above as in VolRestoreCmd:
      * parm 8 is the new server to restore to
      * parm 9 is the new partition to restore to
@@ -1366,7 +1364,7 @@ bc_DiskRestoreCmd(struct cmd_syndesc *as, void *arock)
            portCount++;
        ports = (afs_int32 *) malloc(portCount * sizeof(afs_int32));
        if (!ports) {
-           afs_com_err(whoami, BC_NOMEM, "");
+           afs_com_err(whoami, BC_NOMEM, NULL);
            return BC_NOMEM;
        }
 
@@ -1391,7 +1389,7 @@ bc_DiskRestoreCmd(struct cmd_syndesc *as, void *arock)
        return (-1);
     }
 
-    /* Since we want only RW volumes, remove any 
+    /* Since we want only RW volumes, remove any
      * BK or RO volumes from the list.
      */
     for (prev = 0, tvol = volsToRestore; tvol; tvol = nextvol) {
@@ -1537,7 +1535,7 @@ bc_VolsetRestoreCmd(struct cmd_syndesc *as, void *arock)
 
            tvol->name = (char *)malloc(VOLSER_MAXVOLNAME + 1);
            if (!tvol->name) {
-               afs_com_err(whoami, BC_NOMEM, "");
+               afs_com_err(whoami, BC_NOMEM, NULL);
                return BC_NOMEM;
            }
            strncpy(tvol->name, volume, VOLSER_OLDMAXVOLNAME);
@@ -1563,7 +1561,7 @@ bc_VolsetRestoreCmd(struct cmd_syndesc *as, void *arock)
            portCount++;
        ports = (afs_int32 *) malloc(portCount * sizeof(afs_int32));
        if (!ports) {
-           afs_com_err(whoami, BC_NOMEM, "");
+           afs_com_err(whoami, BC_NOMEM, NULL);
            return BC_NOMEM;
        }
 
@@ -1634,7 +1632,6 @@ bc_DumpCmd(struct cmd_syndesc *as, void *arock)
     afs_int32 problemFindingDump;      /* can't find parent(s) */
 
     afs_int32 *portp = NULL;
-    afs_int32 portCount = 0;
     afs_int32 doAt, atTime;    /* Time a timed-dump is to start at */
     afs_int32 length;
     char *timeString;
@@ -1662,10 +1659,10 @@ bc_DumpCmd(struct cmd_syndesc *as, void *arock)
        return (code);
     }
 
-    /* 
+    /*
      * Some parameters cannot be specified together
-     * The "-file" option cannot exist with the "-volume", "-dump", 
-     * "-portoffset", or "-append" option 
+     * The "-file" option cannot exist with the "-volume", "-dump",
+     * "-portoffset", or "-append" option
      */
     if (as->parms[6].items) {
        loadfile = 1;
@@ -1683,7 +1680,7 @@ bc_DumpCmd(struct cmd_syndesc *as, void *arock)
        }
     }
 
-    /* 
+    /*
      * Get the time we are to perform this dump
      */
     if (as->parms[3].items) {
@@ -1708,7 +1705,7 @@ bc_DumpCmd(struct cmd_syndesc *as, void *arock)
 
     dontExecute = (as->parms[5].items ? 1 : 0);        /* -n */
 
-    /* 
+    /*
      * If this dump is not a load file, then check the parameters.
      */
     if (!loadfile) {           /*6 */
@@ -1717,10 +1714,9 @@ bc_DumpCmd(struct cmd_syndesc *as, void *arock)
 
        /* get the port number, if one was specified */
        if (as->parms[2].items) {
-           portCount = 1;
            portp = (afs_int32 *) malloc(sizeof(afs_int32));
            if (!portp) {
-               afs_com_err(whoami, BC_NOMEM, "");
+               afs_com_err(whoami, BC_NOMEM, NULL);
                return BC_NOMEM;
            }
 
@@ -1752,12 +1748,12 @@ bc_DumpCmd(struct cmd_syndesc *as, void *arock)
 
     /*6 */
     /*
-     * If given the "-at" option, then add this to the jobs list and return 
+     * If given the "-at" option, then add this to the jobs list and return
      * with no error.
      *
      * Create a status node for this timed dump.
      * Fill in the time to dump and the cmd line for the dump leaving off
-     * the -at option.  If the -n option is there, it is scheduled with 
+     * the -at option.  If the -n option is there, it is scheduled with
      * the Timed dump as opposed to not scheduling the time dump at all.
      */
     if (doAt) {
@@ -1801,7 +1797,7 @@ bc_DumpCmd(struct cmd_syndesc *as, void *arock)
            statusPtr->scheduledDump = atTime;
            statusPtr->cmdLine = (char *)malloc(length);
            if (!statusPtr->cmdLine) {
-               afs_com_err(whoami, BC_NOMEM, "");
+               afs_com_err(whoami, BC_NOMEM, NULL);
                return BC_NOMEM;
            }
 
@@ -1834,7 +1830,7 @@ bc_DumpCmd(struct cmd_syndesc *as, void *arock)
                strcat(statusPtr->cmdLine, " -n");
 
            printf("Add scheduled dump as job %d\n", statusPtr->jobNumber);
-           if ((atTime > ttoken.endTime) && (ttoken.endTime != NEVERDATE))
+           if ((atTime > tokenExpires) && (tokenExpires != NEVERDATE))
                afs_com_err(whoami, 0,
                        "Warning: job %d starts after expiration of AFS token",
                        statusPtr->jobNumber);
@@ -1845,7 +1841,7 @@ bc_DumpCmd(struct cmd_syndesc *as, void *arock)
        return (0);
     }
 
-    /* 
+    /*
      * Read and execute the load file if specified.  The work of reading is done
      * in the main routine prior the dispatch call. loadFile and dontExecute are
      * global variables so this can take place in main.
@@ -1853,14 +1849,14 @@ bc_DumpCmd(struct cmd_syndesc *as, void *arock)
     if (loadfile) {
        loadFile = (char *)malloc(strlen(as->parms[6].items->data) + 1);
        if (!loadFile) {
-           afs_com_err(whoami, BC_NOMEM, "");
+           afs_com_err(whoami, BC_NOMEM, NULL);
            return BC_NOMEM;
        }
        strcpy(loadFile, as->parms[6].items->data);
        return 0;
     }
 
-    /* 
+    /*
      * We are doing a real dump (no load file or timed dump).
      */
     printf("Starting dump of volume set '%s' (dump level '%s')\n", vsName,
@@ -1883,9 +1879,9 @@ bc_DumpCmd(struct cmd_syndesc *as, void *arock)
        }
 
        /* We found the most recent dump at this level. Now check
-        * if we should use it by seeing if its full dump hierarchy 
+        * if we should use it by seeing if its full dump hierarchy
         * exists. If it doesn't, we don't want to base our incremental
-        * off of this dump. 
+        * off of this dump.
         */
        if (!parent || (dumpEntry.id > parent)) {
            /* Follow the parent dumps to see if they are all there */
@@ -1911,7 +1907,7 @@ bc_DumpCmd(struct cmd_syndesc *as, void *arock)
        }
     }
 
-    /* If the problemflag was raise, it means we are not doing the 
+    /* If the problemflag was raise, it means we are not doing the
      * dump at the level we requested it be done at.
      */
     if (problemFindingDump) {
@@ -2173,7 +2169,7 @@ bc_ScanDumpsCmd(struct cmd_syndesc *as, void *arock)
  */
 
 afs_int32
-bc_ParseExpiration(struct cmd_parmdesc *paramPtr, afs_int32 *expType, 
+bc_ParseExpiration(struct cmd_parmdesc *paramPtr, afs_int32 *expType,
                   afs_int32 *expDate)
 {
     struct cmd_item *itemPtr;
@@ -2274,7 +2270,7 @@ bc_dbVerifyCmd(struct cmd_syndesc *as, void *arock)
     detail = (as->parms[0].items ? 1 : 0);     /* print more details */
 
     code =
-       ubik_Call(BUDB_DbVerify, udbHandle.uh_client, 0, &status, &orphans,
+       ubik_BUDB_DbVerify(udbHandle.uh_client, 0, &status, &orphans,
                  &host);
 
     if (code) {
@@ -2342,7 +2338,7 @@ deleteDump(afs_uint32 dumpid,             /* The dumpid to delete */
 
        /* If dump is to an XBSA server, connect to butc and send it
         * the dump to delete. Butc will contact the XBSA server.
-        * The dump will not be an appended dump because XBSA butc 
+        * The dump will not be an appended dump because XBSA butc
         * does not support the append option.
         */
        if (xbsadump && dumpEntry.nVolumes) {
@@ -2402,7 +2398,7 @@ deleteDump(afs_uint32 dumpid,             /* The dumpid to delete */
        /* Display the dumps that were deleted - includes appended dumps */
        for (i = 0; i < dumps.budb_dumpsList_len; i++)
            printf("     %u%s\n", dumps.budb_dumpsList_val[i],
-                  (i > 0) ? " Appended Dump" : "");
+                  (i > 0) ? " Appended Dump" : NULL);
        if (dumps.budb_dumpsList_val)
            free(dumps.budb_dumpsList_val);
     }
@@ -2423,7 +2419,7 @@ bc_deleteDumpCmd(struct cmd_syndesc *as, void *arock)
     afs_int32 rcode = 0;
     afs_int32 groupId = 0, havegroupid, sflags, noexecute;
     struct cmd_item *ti;
-    afs_uint32 fromTime = 0, toTime = 0, havetime = 0;
+    afs_int32 fromTime = 0, toTime = 0, havetime = 0;
     char *timeString;
     budb_dumpsList dumps, flags;
     int i;
@@ -2685,7 +2681,7 @@ bc_restoreDbCmd(struct cmd_syndesc *as, void *arock)
 }
 
 /* ----------------------------------
- * supporting routines for database examination 
+ * supporting routines for database examination
  * ----------------------------------
  */
 
@@ -2832,7 +2828,7 @@ DBLookupByVolume(char *volumeName)
     }
 
     if (code)
-       afs_com_err(whoami, code, "");
+       afs_com_err(whoami, code, NULL);
     return (code);
 }
 
@@ -2920,7 +2916,7 @@ dumpInfo(afs_int32 dumpid, afs_int32 detailFlag)
     for (tapeNumber = dumpEntry.tapes.b; tapeNumber <= dumpEntry.tapes.maxTapes; tapeNumber++) {       /*f */
        tapeLinkPtr = (struct tapeLink *)malloc(sizeof(struct tapeLink));
        if (!tapeLinkPtr) {
-           afs_com_err(whoami, BC_NOMEM, "");
+           afs_com_err(whoami, BC_NOMEM, NULL);
            ERROR(BC_NOMEM);
        }
 
@@ -2972,7 +2968,7 @@ dumpInfo(afs_int32 dumpid, afs_int32 detailFlag)
                volumeLinkPtr =
                    (struct volumeLink *)malloc(sizeof(struct volumeLink));
                if (!volumeLinkPtr) {
-                   afs_com_err(whoami, BC_NOMEM, "");
+                   afs_com_err(whoami, BC_NOMEM, NULL);
                    ERROR(BC_NOMEM);
                }
                memset(volumeLinkPtr, 0, sizeof(*volumeLinkPtr));
@@ -3089,7 +3085,7 @@ printRecentDumps(int ndumps)
        dl.budb_dumpList_val = 0;
 
        /* outline algorithm */
-       code = ubik_Call(BUDB_GetDumps, udbHandle.uh_client, 0, BUDB_MAJORVERSION, BUDB_OP_NPREVIOUS, "",       /* no name */
+       code = ubik_BUDB_GetDumps(udbHandle.uh_client, 0, BUDB_MAJORVERSION, BUDB_OP_NPREVIOUS, "",     /* no name */
                         0,     /* start */
                         ndumps,        /* end */
                         index, /* index */
@@ -3131,7 +3127,7 @@ printRecentDumps(int ndumps)
     return (code);
 }
 
-/* bc_dumpInfoCmd 
+/* bc_dumpInfoCmd
  *     list the dumps and contens of the dumps.
  * params:
  *     as - name of tape