if ((defaultConn = virGetEnvBlockSUID("VIRSH_DEFAULT_CONNECT_URI")))
ctl->connname = vshStrdup(ctl, defaultConn);
- if (vshInit(ctl, cmdGroups, NULL) < 0)
+ if (!vshInit(ctl, cmdGroups, NULL))
exit(EXIT_FAILURE);
if (!virshParseArgv(ctl, argc, argv) ||
/*
* Initialize global data
*/
-int
+bool
vshInit(vshControl *ctl, const vshCmdGrp *groups, const vshCmdDef *set)
{
- int ret = -1;
-
if (!ctl->hooks) {
vshError(ctl, "%s", _("client hooks cannot be NULL"));
- goto error;
+ return false;
}
if (!groups && !set) {
vshError(ctl, "%s", _("command groups and command set "
"cannot both be NULL"));
- goto error;
+ return false;
}
cmdGroups = groups;
vshInitDebug(ctl);
if (ctl->imode && vshReadlineInit(ctl) < 0)
- goto error;
+ return false;
- ret = 0;
- error:
- return ret;
+ return true;
}
void
void vshPrintExtra(vshControl *ctl, const char *format, ...)
ATTRIBUTE_FMT_PRINTF(2, 3);
-int vshInit(vshControl *ctl, const vshCmdGrp *groups, const vshCmdDef *set);
+bool vshInit(vshControl *ctl, const vshCmdGrp *groups, const vshCmdDef *set);
void vshDeinit(vshControl *ctl);
void vshInitDebug(vshControl *ctl);
void vshDebug(vshControl *ctl, int level, const char *format, ...)