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(); u3m_stop();
} }
/* _cw_next(); request upgrade /* _cw_next(): request upgrade
*/ */
static void static void
_cw_next(c3_i argc, c3_c* argv[]) _cw_next(c3_i argc, c3_c* argv[])
{ {
switch ( argc ) { c3_i ch_i, lid_i;
case 2: { c3_w arg_w;
if ( !(u3_Host.dir_c = _main_pier_run(argv[0])) ) {
fprintf(stderr, "unable to find pier\r\n");
exit (1);
}
} break;
case 3: { static struct option lop_u[] = {
u3_Host.dir_c = argv[2]; { "arch", required_argument, NULL, 'a' },
} break; { NULL, 0, NULL, 0 }
};
default: { u3_Host.dir_c = _main_pier_run(argv[0]);
fprintf(stderr, "invalid command\r\n");
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); exit(1);
} break; }
optind++;
}
if ( optind + 1 != argc ) {
fprintf(stderr, "invalid command\r\n");
exit(1);
} }
u3_Host.pep_o = c3y; u3_Host.pep_o = c3y;

View File

@ -328,6 +328,7 @@
#endif #endif
u3_utty* uty_u; // linked terminal list u3_utty* uty_u; // linked terminal list
c3_o nex_o; // upgrade requested c3_o nex_o; // upgrade requested
c3_c* arc_c; // upgrade to arch
u3_opts ops_u; // commandline options u3_opts ops_u; // commandline options
c3_o pep_o; // prep for upgrade c3_o pep_o; // prep for upgrade
c3_i xit_i; // exit code for shutdown 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 #ifdef U3_OS_ARCH
arc_c = U3_OS_ARCH; arc_c = U3_OS_ARCH;
#else #else
// XX support arch argument if ( u3_Host.arc_c ) {
// arc_c = u3_Host.arc_c;
u3l_log("vere: arch required\r\n"); }
return; else {
u3l_log("vere: arch required\r\n");
return;
}
#endif #endif
// XX get link option // XX get link option