vere: adds -a/--arch option to next subcommand

This commit is contained in:
Joe Bryan 2022-05-26 00:42:28 -04:00
parent afd3fd19d1
commit e473beef41
3 changed files with 46 additions and 18 deletions

View File

@ -1304,27 +1304,51 @@ _cw_meld(c3_i argc, c3_c* argv[])
u3m_stop();
}
/* _cw_next(); request upgrade
/* _cw_next(): request upgrade
*/
static void
_cw_next(c3_i argc, c3_c* argv[])
{
switch ( argc ) {
case 2: {
if ( !(u3_Host.dir_c = _main_pier_run(argv[0])) ) {
fprintf(stderr, "unable to find pier\r\n");
exit (1);
}
} break;
c3_i ch_i, lid_i;
c3_w arg_w;
case 3: {
u3_Host.dir_c = argv[2];
} break;
static struct option lop_u[] = {
{ "arch", required_argument, NULL, 'a' },
{ NULL, 0, NULL, 0 }
};
default: {
fprintf(stderr, "invalid command\r\n");
u3_Host.dir_c = _main_pier_run(argv[0]);
while ( -1 != (ch_i=getopt_long(argc, argv, "a:", lop_u, &lid_i)) ) {
switch ( ch_i ) {
case 'a': {
u3_Host.arc_c = strdup(optarg);
} break;
case '?': {
exit(1);
} break;
}
}
// argv[optind] is always "next"
//
if ( !u3_Host.dir_c ) {
if ( optind + 1 < argc ) {
u3_Host.dir_c = argv[optind + 1];
}
else {
fprintf(stderr, "invalid command, pier required\r\n");
exit(1);
} break;
}
optind++;
}
if ( optind + 1 != argc ) {
fprintf(stderr, "invalid command\r\n");
exit(1);
}
u3_Host.pep_o = c3y;

View File

@ -328,6 +328,7 @@
#endif
u3_utty* uty_u; // linked terminal list
c3_o nex_o; // upgrade requested
c3_c* arc_c; // upgrade to arch
u3_opts ops_u; // commandline options
c3_o pep_o; // prep for upgrade
c3_i xit_i; // exit code for shutdown

View File

@ -1375,10 +1375,13 @@ _king_do_upgrade(c3_c* pac_c, c3_c* ver_c)
#ifdef U3_OS_ARCH
arc_c = U3_OS_ARCH;
#else
// XX support arch argument
//
u3l_log("vere: arch required\r\n");
return;
if ( u3_Host.arc_c ) {
arc_c = u3_Host.arc_c;
}
else {
u3l_log("vere: arch required\r\n");
return;
}
#endif
// XX get link option