Options cleanup

Remove sow, pas, and rez. Add comments with flags and short
descriptions. Also correctly bound ports.
This commit is contained in:
Steve Dee 2014-03-17 18:55:24 -07:00
parent 309f4b31fd
commit fd3c03fa73
3 changed files with 28 additions and 33 deletions

View File

@ -503,31 +503,28 @@
u2_bean vog; // did they vote for us?
} u2_rnam;
/* u2_opts:
/* u2_opts: command line configuration.
*/
typedef struct _u2_opts {
c3_c* cpu_c;
c3_c* imp_c;
c3_c* hom_c;
c3_c* nam_c;
c3_c* raf_c;
c3_w kno_w;
c3_w fuz_w;
c3_s por_s;
c3_s rop_s;
u2_bean abo;
u2_bean bat;
u2_bean gab;
u2_bean dem;
u2_bean fog;
u2_bean loh;
u2_bean pro;
u2_bean veb;
u2_bean pas;
u2_bean rez;
u2_bean sow;
u2_bean nuu;
u2_bean vno;
c3_c* cpu_c; // pier name
c3_c* imp_c; // -I, czar name
c3_c* hom_c; // -h, urbit home
c3_c* nam_c; // -n, unix hostname
c3_c* raf_c; // -r, raft flotilla
c3_w kno_w; // -k, kernel version
c3_w fuz_w; // -f, fuzz testing
c3_s por_s; // -p, ames port
c3_s rop_s; // -l, raft port
u2_bean abo; // -a
u2_bean bat; // -b, batch create
u2_bean gab; // -g
u2_bean dem; // -d, dem
u2_bean fog; // -Xwtf, skip last event
u2_bean loh; // -L, local-only networking
u2_bean pro; // , profile
u2_bean veb; // -v, verbose (inverse of -q)
u2_bean nuu; // -c, new pier
u2_bean vno; // -V
} u2_opts;
/* u2_host: entire host.

View File

@ -68,17 +68,22 @@ _main_getopt(c3_i argc, c3_c** argv)
u2_Host.ops_u.fog = u2_no;
u2_Host.ops_u.pro = u2_no;
u2_Host.ops_u.veb = u2_yes;
u2_Host.ops_u.rez = u2_no;
u2_Host.ops_u.nuu = u2_no;
u2_Host.ops_u.vno = u2_no;
u2_Host.ops_u.kno_w = DefaultKernel;
while ( (ch_i = getopt(argc, argv, "I:f:h:k:l:n:p:r:X:Labcdgqv")) != -1 ) {
while ( (ch_i = getopt(argc, argv, "I:X:f:h:k:l:n:p:r:Labcdgqv")) != -1 ) {
switch ( ch_i ) {
case 'I': {
u2_Host.ops_u.imp_c = strdup(optarg);
break;
}
case 'X': {
if ( 0 != strcmp("wtf", optarg) ) {
return u2_no;
} else u2_Host.ops_u.fog = u2_yes;
break;
}
case 'f': {
if ( u2_no == _main_readw(optarg, 100, &u2_Host.ops_u.fuz_w) ) {
return u2_no;
@ -115,12 +120,6 @@ _main_getopt(c3_i argc, c3_c** argv)
u2_Host.ops_u.raf_c = strdup(optarg);
break;
}
case 'X': {
if ( 0 != strcmp("wtf", optarg) ) {
return u2_no;
} else u2_Host.ops_u.fog = u2_yes;
break;
}
case 'L': { u2_Host.ops_u.loh = u2_yes; break; }
case 'a': { u2_Host.ops_u.abo = u2_yes; break; }
case 'b': { u2_Host.ops_u.bat = u2_yes; break; }
@ -303,7 +302,6 @@ main(c3_i argc,
u2_wr_check_init(u2_Host.ops_u.cpu_c);
if ( (u2_no == u2_Host.ops_u.nuu) &&
(u2_no == u2_Host.ops_u.rez) &&
(u2_yes == u2_loom_load()) )
{
u2_Host.wir_r = u2_ray_of(0, 0);

View File

@ -120,7 +120,7 @@ u2_raft_readopt(const c3_c* arg_c, c3_c* our_c, c3_s oup_s)
c3_c* end_c;
c3_w por_w = strtoul(nam_u->por_c, &end_c, 10);
if ( '\0' == *nam_u->por_c || '\0' != *end_c || por_w > 65536 ) {
if ( '\0' == *nam_u->por_c || '\0' != *end_c || por_w >= 65536 ) {
uL(fprintf(uH, "raft: invalid port %s\n", nam_u->por_c));
_raft_rnam_free(nam_u);
_raft_rnam_free(nex_u);