add -G 0w-ca.rrier.-gene.rator flag

This commit is contained in:
Anton Dyudin 2016-10-24 11:56:44 -07:00
parent fe64596a5e
commit 3b1b0181ce
3 changed files with 26 additions and 4 deletions

View File

@ -532,10 +532,11 @@
c3_c* imp_c; // -I, czar name
c3_c* nam_c; // -n, unix hostname
c3_c* raf_c; // -r, raft flotilla
c3_c* who_c; // -T, begin with ticket
c3_c* tic_c; // -T, ticket value
c3_c* who_c; // -w, begin with ticket
c3_c* tic_c; // -t, ticket value
c3_c* pil_c; // -B, bootstrap from
c3_c* arv_c; // -A, initial sync from
c3_c* gen_c; // -G, czar generator
c3_w kno_w; // -k, kernel version
c3_w fuz_w; // -f, fuzz testing
c3_s por_s; // -p, ames port

View File

@ -82,7 +82,7 @@ _main_getopt(c3_i argc, c3_c** argv)
u3_Host.ops_u.rep = c3n;
u3_Host.ops_u.kno_w = DefaultKernel;
while ( (ch_i=getopt(argc, argv,"B:A:I:w:t:f:k:l:n:p:r:LabcdgqvxFMPDXR")) != -1 ) {
while ( (ch_i=getopt(argc, argv,"G:B:A:I:w:t:f:k:l:n:p:r:LabcdgqvxFMPDXR")) != -1 ) {
switch ( ch_i ) {
case 'M': {
u3_Host.ops_u.mem = c3y;
@ -92,6 +92,10 @@ _main_getopt(c3_i argc, c3_c** argv)
u3_Host.ops_u.pil_c = strdup(optarg);
break;
}
case 'G': {
u3_Host.ops_u.gen_c = strdup(optarg);
break;
}
case 'A': {
u3_Host.ops_u.arv_c = strdup(optarg);
break;
@ -187,6 +191,18 @@ _main_getopt(c3_i argc, c3_c** argv)
"the initial sync path with -A\n");
return c3n;
}
if ( u3_Host.ops_u.gen_c != 0 && ( u3_Host.ops_u.imp_c == 0 ||
u3_Host.ops_u.nuu == c3n ) ) {
fprintf(stderr, "-G only makes sense when creating a new galaxy");
return c3n;
}
if ( u3_Host.ops_u.tic_c != 0 && ( u3_Host.ops_u.imp_c != 0 ||
u3_Host.ops_u.nuu == c3y ) ) {
fprintf(stderr, "-t only makes sense when creating a new non-galaxy");
return c3n;
}
if ( u3_Host.ops_u.rop_s == 0 && u3_Host.ops_u.raf_c != 0 ) {
fprintf(stderr, "The -r flag requires -l.\n");

View File

@ -1189,7 +1189,12 @@ u3_sist_boot(void)
u3_noun gen = u3_nul;
u3_noun gun = u3_nul;
if (c3n == u3_Host.ops_u.fak) {
gen = _sist_text("generator");
if ( 0 != u3_Host.ops_u.gen_c) {
gen = u3i_string(u3_Host.ops_u.gen_c);
}
else {
gen = _sist_text("generator"); // XX move to main.c
}
gun = u3dc("slaw", c3__uw, gen);
if ( u3_nul == gun ) {