#define CMD_CREATE 0x4001
#define CMD_MIGRATE 0x4002
#define CMD_SILENTEXIST 0x4003
+#define CMD_SILENT 0x4004
struct option const
{ "tag", required_argument, 0, CMD_TAG },
{ "create", no_argument, 0, CMD_CREATE },
{ "migrate", no_argument, 0, CMD_MIGRATE },
+ { "silent", no_argument, 0, CMD_SILENT },
{ "silentexist", no_argument, 0, CMD_SILENTEXIST },
{ 0,0,0,0 },
};
"<opts> can be:\n"
" --silentexist ... be silent when context exists already; useful\n"
" for '--create' only\n"
+ " --silent ... if the feature is not supported, just execute\n"
+ " <program>\n"
"\n"
"'vtag --create' exits with code 254 iff the context exists already.\n"
"\n"
{
tag_t tag;
- if (!vc_isSupported(vcFEATURE_PPTAG))
- goto exec;
+ if (!vc_isSupported(vcFEATURE_PPTAG)) {
+ if (args->verbosity >= 1) {
+ errno = ENOSYS;
+ perror(ENSC_WRAPPERS_PREFIX);
+ return wrapper_exit_code;
+ }
+ else
+ goto exec;
+ }
+ if (args->tag == VC_DYNAMIC_XID) {
+ if (args->verbosity >= 1) {
+ WRITE_MSG(2, "You must specify the tag with '--tag'; try '--help' for more information\n");
+ return wrapper_exit_code;
+ }
+ else {
+ WRITE_MSG(2, ENSC_WRAPPERS_PREFIX "WARNING: A dynamic tag has been specified, this is not supported\n");
+ goto exec;
+ }
+ }
if (args->do_create) {
tag = vc_tag_create(args->tag);
int main (int argc, char *argv[])
{
struct Arguments args = {
- .tag = VC_NOCTX,
+ .tag = VC_DYNAMIC_XID,
.do_create = false,
.do_migrate = false,
.is_silentexist = false,
while (1) {
int c = getopt_long(argc, argv, "+", CMDLINE_OPTIONS, 0);
if (c==-1) break;
-
+
switch (c) {
case CMD_HELP : showHelp(1, argv[0], 0);
case CMD_VERSION : showVersion();
case CMD_MIGRATE : args.do_migrate = true; break;
case CMD_SILENTEXIST : args.is_silentexist = true; break;
case CMD_TAG : args.tag = Evc_tagopt2tag(optarg,true); break;
+ case CMD_SILENT : args.verbosity--; break;
default :
WRITE_MSG(2, "Try '");
WRITE_MSG(2, "Neither '--create' nor '--migrate' specified; try '--help' for more information\n");
else if (args.do_create && args.do_migrate)
WRITE_MSG(2, "Can not specify '--create' and '--migrate' at the same time; try '--help' for more information\n");
- else if (args.tag==VC_NOCTX)
- WRITE_MSG(2, "You must specify the tag with '--tag'; try '--help' for more information\n");
else if (optind>=argc)
WRITE_MSG(2, "No command given; use '--help' for more information.\n");
else