Merge branch 'cc-release-prepare-args' into cc-release-rc-merge

* cc-release-prepare-args:
  adds placeholder for -J (ivory pill, unimplemented)
  alphebetizes u3_opts and _main_getopt() defaults
  replaces -k with -K (kernel version)
  renames -L (local networking) from loh to net
  removes -t (ticket), -s, and -S (secret/prompt)
  removes unused args -I (galaxy) and -l (raft port)
  removes -n ("unix hostname", for raft)
  removes -X ("skip last event")
  removes -M ("memory madness")
This commit is contained in:
Joe Bryan 2018-11-16 20:30:16 -05:00
commit aa05514625
4 changed files with 42 additions and 150 deletions

View File

@ -491,32 +491,26 @@
/* u3_opts: command line configuration.
*/
typedef struct _u3_opts {
c3_c* nam_c; // -n, unix hostname
c3_c* who_c; // -w, begin with ticket
c3_c* tic_c; // -t, ticket value
c3_c* pil_c; // -B, bootstrap from
c3_c* lit_c; // -J, ivory (fastboot) kernel
c3_c* sec_c; // -s, secret
c3_w kno_w; // -k, kernel version
c3_w fuz_w; // -f, fuzz testing
c3_s por_s; // -p, ames port
c3_o abo; // -a, abort aggressively
c3_c* pil_c; // -B, bootstrap from
c3_o bat; // -b, batch create
c3_o sic; // -S, enter secret at prompt
c3_o gab; // -g, test garbage collection
c3_o dem; // -d, daemon
c3_o dry; // -D, dry compute, no checkpoint
c3_o tex; // -x, exit after loading
c3_o fog; // -X, skip last event
c3_o fak; // -F, fake carrier
c3_o loh; // -L, local-only networking
c3_o pro; // -P, profile
c3_o veb; // -v, verbose (inverse of -q)
c3_o nuu; // -c, new pier
c3_o dry; // -D, dry compute, no checkpoint
c3_o dem; // -d, daemon
c3_o fak; // -F, fake carrier
c3_w fuz_w; // -f, fuzz testing
c3_o gab; // -g, test garbage collection
c3_c* lit_c; // -J, ivory (fastboot) kernel
c3_w kno_w; // -K, kernel version
c3_o net; // -L, local-only networking
c3_o pro; // -P, profile
c3_s por_s; // -p, ames port
c3_o qui; // -q, quiet
c3_o vno; // -V, turn on +verb
c3_o mem; // -M, memory madness
c3_o rep; // -R, report build info
c3_o vno; // -V, replay without reboots
c3_o veb; // -v, verbose (inverse of -q)
c3_c* who_c; // -w, begin with ticket
c3_o tex; // -x, exit after loading
} u3_opts;
/* u3_host: entire host.

View File

@ -50,7 +50,7 @@ _ames_czar(u3_pier* pir_u, c3_y imp_y, c3_s* por_s)
{
u3_ames* sam_u = pir_u->sam_u;
if ( c3y == u3_Host.ops_u.loh ) {
if ( c3n == u3_Host.ops_u.net ) {
*por_s = 31337 + imp_y;
return 0x7f000001;
}

View File

@ -325,54 +325,14 @@ _boothack_cb(uv_connect_t *conn, int status)
if ( c3y == u3_Host.ops_u.fak ) {
fprintf(stderr, "boot: F A K E ship with null security\r\n");
sec = 0;
if ( 0 != u3_Host.ops_u.tic_c ) {
fprintf(stderr, "boot: fake ship does not need a ticket (-t)\r\n");
exit(1);
}
tic = u3k(who);
tic = 0;
}
else {
if ( 0 == u3_Host.ops_u.sec_c ) {
c3_w eny_w[16];
u3_pier_rand(eny_w);
sec = u3i_words(2, eny_w);
{
u3_noun rot = u3dc("scot", 'p', u3k(sec));
c3_c* rot_c = u3r_string(rot);
fprintf(stderr, "boot: %s: R O O T P A S S W O R D %s\r\n",
u3_Host.ops_u.who_c,
rot_c);
fprintf(stderr, " (write it down and put it in your wallet)\r\n");
u3z(rot);
c3_free(rot_c);
}
} else {
u3_noun suc = u3dc("slaw", 'p', u3i_string(u3_Host.ops_u.sec_c));
if ( u3_nul == suc ) {
fprintf(stderr, "boot: malformed secret (-s)\r\n");
exit(1);
}
sec = u3k(u3t(suc));
u3z(suc);
}
{
u3_noun tuc = u3dc("slaw", 'p', u3i_string(u3_Host.ops_u.tic_c));
if ( u3_nul == tuc ) {
fprintf(stderr, "boot: malformed ticket (-t)\r\n");
exit(1);
}
tic = u3k(u3t(tuc));
u3z(tuc);
}
fprintf(stderr, "boot: real ships not yet supported\r\n");
exit(1);
}
pax = u3i_string(u3_Host.dir_c);
mat = u3ke_jam(u3nc(c3__doom,

View File

@ -38,8 +38,6 @@ _main_readw(const c3_c* str_c, c3_w max_w, c3_w* out_w)
else return c3n;
}
static c3_c hostbuf[2048]; // kill me
/* _main_presig(): prefix optional sig.
*/
c3_c*
@ -66,69 +64,52 @@ _main_getopt(c3_i argc, c3_c** argv)
u3_Host.ops_u.abo = c3n;
u3_Host.ops_u.bat = c3n;
u3_Host.ops_u.gab = c3n;
u3_Host.ops_u.loh = c3n;
u3_Host.ops_u.dem = c3n;
u3_Host.ops_u.fog = c3n;
u3_Host.ops_u.fak = c3n;
u3_Host.ops_u.tex = c3n;
u3_Host.ops_u.pro = c3n;
u3_Host.ops_u.dry = c3n;
u3_Host.ops_u.sic = c3n;
u3_Host.ops_u.veb = c3n;
u3_Host.ops_u.qui = c3n;
u3_Host.ops_u.fak = c3n;
u3_Host.ops_u.gab = c3n;
u3_Host.ops_u.net = c3y;
u3_Host.ops_u.nuu = c3n;
u3_Host.ops_u.mem = c3n;
u3_Host.ops_u.pro = c3n;
u3_Host.ops_u.qui = c3n;
u3_Host.ops_u.rep = c3n;
u3_Host.ops_u.tex = c3n;
u3_Host.ops_u.veb = c3n;
u3_Host.ops_u.kno_w = DefaultKernel;
while ( (ch_i=getopt(argc, argv,"s:B:I:w:t:f:k:l:n:p:LSabcdgmqvxFMPDXR")) != -1 ) {
while ( (ch_i=getopt(argc, argv,"J:B:w:f:K:p:LabcdgqvxFPDR")) != -1 ) {
switch ( ch_i ) {
case 'M': {
u3_Host.ops_u.mem = c3y;
break;
case 'J': {
// XX should set path to ivory pill
// u3_Host.ops_u.lit_c = strdup(optarg);
// break;
return c3n;
}
case 'B': {
u3_Host.ops_u.pil_c = strdup(optarg);
break;
}
case 's': {
u3_Host.ops_u.sec_c = strdup(optarg);
break;
}
case 'w': {
u3_Host.ops_u.who_c = _main_presig(optarg);
u3_Host.ops_u.nuu = c3y;
break;
}
case 't': {
u3_Host.ops_u.tic_c = _main_presig(optarg);
break;
}
case 'x': {
u3_Host.ops_u.tex = c3y;
break;
}
case 'X': {
u3_Host.ops_u.fog = c3y;
break;
}
case 'f': {
if ( c3n == _main_readw(optarg, 100, &u3_Host.ops_u.fuz_w) ) {
return c3n;
}
break;
}
case 'k': {
case 'K': {
if ( c3n == _main_readw(optarg, 256, &u3_Host.ops_u.kno_w) ) {
return c3n;
}
break;
}
case 'n': {
u3_Host.ops_u.nam_c = strdup(optarg);
break;
}
case 'p': {
if ( c3n == _main_readw(optarg, 65536, &arg_w) ) {
return c3n;
@ -139,9 +120,9 @@ _main_getopt(c3_i argc, c3_c** argv)
u3_Host.ops_u.rep = c3y;
return c3y;
}
case 'L': { u3_Host.ops_u.loh = c3y; break; }
case 'L': { u3_Host.ops_u.net = c3n; break; }
case 'F': {
u3_Host.ops_u.loh = c3y;
u3_Host.ops_u.net = c3n;
u3_Host.ops_u.fak = c3y;
break;
}
@ -175,39 +156,12 @@ _main_getopt(c3_i argc, c3_c** argv)
fprintf(stderr, "comets are not yet supported; identify with -w\r\n");
return c3n;
}
else {
if ( c3n == u3_Host.ops_u.fak ) {
if ( (u3_Host.ops_u.tic_c == 0) &&
(strlen(u3_Host.ops_u.who_c) >= 4)
)
{
c3_c tic_c[29];
printf("enter your ticket: ~");
scanf("%28s", tic_c);
u3_Host.ops_u.tic_c = _main_presig(tic_c);
}
if ( c3y == u3_Host.ops_u.sic ) {
c3_c sec_c[29];
printf("enter your secret: ~");
scanf("%28s", sec_c);
u3_Host.ops_u.sec_c = _main_presig(sec_c);
}
}
}
} else {
if ( u3_Host.ops_u.sec_c != 0 ) {
fprintf(stderr, "-s only makes sense when creating a new ship\n");
else if ( c3n == u3_Host.ops_u.fak ) {
fprintf(stderr, "real ships are not yet supported; fake with -F\r\n");
return c3n;
}
if ( u3_Host.ops_u.tic_c != 0 ) {
fprintf(stderr, "-t only makes sense when creating a new ship\n");
return c3n;
}
}
else {
if ( u3_Host.ops_u.who_c != 0 ) {
fprintf(stderr, "-w only makes sense when creating a new ship\n");
return c3n;
@ -232,19 +186,6 @@ _main_getopt(c3_i argc, c3_c** argv)
}
}
if ( u3_Host.ops_u.nam_c == 0 ) {
u3_Host.ops_u.nam_c = getenv("HOSTNAME");
if ( u3_Host.ops_u.nam_c == 0 ) {
c3_w len_w = sysconf(_SC_HOST_NAME_MAX) + 1;
u3_Host.ops_u.nam_c = hostbuf;
if ( 0 != gethostname(u3_Host.ops_u.nam_c, len_w) ) {
perror("gethostname");
exit(1);
}
}
}
if ( argc != (optind + 1) && u3_Host.ops_u.who_c != 0 ) {
u3_Host.dir_c = strdup(1 + u3_Host.ops_u.who_c);
}
@ -292,11 +233,9 @@ u3_ve_usage(c3_i argc, c3_c** argv)
"-x Exit immediately\n",
"-r host Initial peer address\n",
"-l port Initial peer port\n",
"-M Memory madness\n",
"-f Fuzz testing\n",
"-k stage Start at Hoon kernel version stage\n",
"-R Report urbit build info\n",
"-Xwtf Skip last event\n"};
"-K stage Start at Hoon kernel version stage\n",
"-R Report urbit build info\n"};
#else
c3_c *use_c[] = {
"simple usage: \n",
@ -486,7 +425,6 @@ main(c3_i argc,
// printf("welcome.\n");
printf("urbit %s\n", URBIT_VERSION);
printf("urbit: home is %s\n", u3_Host.dir_c);
// printf("vere: hostname is %s\n", u3_Host.ops_u.nam_c);
if ( c3y == u3_Host.ops_u.dem && c3n == u3_Host.ops_u.bat ) {
printf("urbit: running as daemon\n");