X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.db-test.git;a=blobdiff_plain;f=pctb%2Fconvert.c;h=21445c563b6108ed117304c8a27fb9eb4fdd23ab;hp=70b4769fe41d74b3539d99be65abb337fc7e2658;hb=1c6f4876b9a4f76f89a0df81ec2cc6c4ec76334e;hpb=f8488ba218ce448dc5c02c8d83e85b6c551332eb diff --git a/pctb/convert.c b/pctb/convert.c index 70b4769..21445c5 100644 --- a/pctb/convert.c +++ b/pctb/convert.c @@ -57,12 +57,12 @@ static const char *o_outmode_str= 0; static enum mode o_mode= mode_all; static char *o_screenshot_fn; -static int o_quiet; static const char *o_serv_pctb, *o_serv_dict_fetch, *o_serv_dict_submit; const char *o_resolver= "./dictionary-manager"; FILE *screenshot_file; const char *o_ocean, *o_pirate; +int o_quiet; enum flags o_flags= ff_dict_fetch|ff_dict_submit|ff_dict_pirate; @@ -132,7 +132,8 @@ void fetch_with_rsync(const char *stem) { } static void set_server(const char *envname, const char *defprotocol, - const char *defvalue, const char *userspecified, + const char *defvalue, const char *defvalue_test, + const char *userspecified, int enable) { const char *value; @@ -142,6 +143,8 @@ static void set_server(const char *envname, const char *defprotocol, value= userspecified; else if ((value= getenv(envname))) ; + else if (o_flags & ff_testservers) + value= defvalue_test; else value= defvalue; @@ -188,6 +191,7 @@ int main(int argc, char **argv) { else if (IS("--single-page")) o_flags |= ff_singlepage; else if (IS("--quiet")) o_quiet= 1; else if (IS("--edit-charset")) o_flags |= ff_editcharset; + else if (IS("--test-servers")) o_flags |= ff_testservers; else if (IS("--dict-local-only")) o_flags &= ~ffs_dict; else if (IS("--dict-read-only")) o_flags &= (~ffs_dict | ff_dict_fetch); else if (IS("--dict-anon")) o_flags &= ~ff_dict_pirate; @@ -222,8 +226,14 @@ int main(int argc, char **argv) { /* Consequential changes to options */ if (o_mode & mf_analyse) { - if (!o_outmode_kind) - o_outmode_kind= (o_flags & ff_printisland) ? omk_none : omk_str; + if (!o_outmode_kind) { + if (o_flags & ff_printisland) { + o_outmode_kind= omk_none; + o_flags |= ff_singlepage; + } else { + o_outmode_kind= omk_str; + } + } if (o_outmode_kind==omk_upload) { o_flags |= ffs_upload; @@ -234,15 +244,18 @@ int main(int argc, char **argv) { /* Defaults */ set_server("YPPSC_PCTB_PCTB", - "http://", "pctb.ilk.org", - o_serv_pctb, o_flags & (ff_needisland|ff_upload)); + "http://", "pctb.ilk.org" /*pctb.crabdance.com*/, + "pctb.ilk.org", + o_serv_pctb, o_flags & (ff_needisland|ff_upload)); set_server("YPPSC_PCTB_DICT_UPDATE", - "rsync://", "rsync.pctb.chiark.greenend.org.uk/pctb", + "rsync://", "rsync.pctb.chiark.greenend.org.uk/pctb", + "rsync.pctb.chiark.greenend.org.uk/pctb/test", o_serv_dict_fetch, o_flags & ff_dict_fetch); set_server("YPPSC_PCTB_DICT_SUBMIT", "http://", "dictup.pctb.chiark.greenend.org.uk", + "dictup.pctb.chiark.greenend.org.uk/test", o_serv_dict_submit, o_flags & ff_dict_submit); if (!o_screenshot_fn) @@ -257,12 +270,12 @@ int main(int argc, char **argv) { if (!ocean) ocean= o_ocean; if (!pirate) pirate= o_pirate; - if (o_flags & ff_needisland) { + if (o_flags & ff_needisland) if (!ocean) badusage("need --ocean option when replaying images" " (consider supplying --pirate too)"); + if (ocean) sysassert(! setenv("YPPSC_OCEAN",ocean,1) ); - } if (pirate && (o_flags & ff_dict_pirate)) sysassert(! setenv("YPPSC_PIRATE",pirate,1) );