#include <afs/com_err.h>
#include <afs/afsutil.h>
#include <afs/budb.h>
+#include <afs/budb_prototypes.h>
#include <afs/butc.h>
#include <afs/bubasics.h> /* PA */
#include <afs/volser.h>
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;
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);
}
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;
entries[e].serverPartition[ei], &servers,
&ss, &ps);
if (tcode) {
- afs_com_err(whoami, tcode, "");
+ afs_com_err(whoami, tcode, NULL);
ERROR(tcode);
}
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);
}
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 */
#ifdef HAVE_POSIX_REGEX
regex_t re;
int need_regfree = 0;
+#else
+ char *errm;
#endif
*avols = (struct bc_volumeDump *)0;
entry.serverPartition[foundentry], &servers,
&ss, &ps);
if (code) {
- afs_com_err(whoami, code, "");
+ afs_com_err(whoami, code, NULL);
return (code);
}
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);
}
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)
{
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);
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;
}
/* 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");
}
/* 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");
/* 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);
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;
}
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;
}
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);
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;
}
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;
}
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;
}
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);
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);
/* 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);
}
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;
- afs_int32 port = -1, dbonly = 0, force;
+ afs_int32 port = -1, force;
/* Must specify at least one of -dumpid, -from, or -to */
if (!as->parms[0].items && !as->parms[1].items && !as->parms[2].items
}
if (code)
- afs_com_err(whoami, code, "");
+ afs_com_err(whoami, code, NULL);
return (code);
}
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);
}
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));