diff --git a/goldnode/goldnode.cpp b/goldnode/goldnode.cpp index a7cc089..1a1b6ee 100644 --- a/goldnode/goldnode.cpp +++ b/goldnode/goldnode.cpp @@ -134,6 +134,8 @@ struct nl_stat { nl_stat statistic; #endif +char* _MapPath(char* map, bool reverse = false); + // ------------------------------------------------------------------ // Display a "twirly" @@ -368,7 +370,7 @@ static char* make_addr_str(char* str, Addr* addr, char* domain) { // ------------------------------------------------------------------ // Compare two nodes by name/address/file/pos -static bool cmp_nnlsts(const _GEIdx A, const _GEIdx B) { +static bool cmp_nnlsts(const _GEIdx &A, const _GEIdx &B) { int cmp; @@ -391,7 +393,7 @@ static bool cmp_nnlsts(const _GEIdx A, const _GEIdx B) { // ------------------------------------------------------------------ // Compare two nodes by address/name/file/pos -static bool cmp_anlsts(const _GEIdx A, const _GEIdx B) { +static bool cmp_anlsts(const _GEIdx &A, const _GEIdx &B) { int cmp; @@ -411,6 +413,17 @@ static bool cmp_anlsts(const _GEIdx A, const _GEIdx B) { } +// ------------------------------------------------------------------ +#if defined(_MSC_VER) +enum{ sort_by_address=0, sort_by_name } static sort_type; +bool operator<(const _GEIdx &A, const _GEIdx &B) +{ + if (sort_type==sort_by_address) + return cmp_anlsts(A, B); + else + return cmp_nnlsts(A, B); +} +#endif // ------------------------------------------------------------------ static char* CvtName(char* inp) { @@ -882,7 +895,12 @@ static void read_nodelists() { // Sort by name if(not quiet) std::cout << std::endl << "* Sorting by name " << std::flush; +#if defined(_MSC_VER) + sort_type = sort_by_name; + nodeidx.sort(); +#else nodeidx.sort(cmp_nnlsts); +#endif // Write the name-sorted .GXN fp = fsopen(nodeindex.c_str(), "wb", sh_mod); @@ -935,7 +953,12 @@ static void read_nodelists() { // Sort by address if(not quiet) std::cout << ' ' << std::endl << "* Sorting by node " << std::flush; +#if defined(_MSC_VER) + sort_type = sort_by_address; + nodeidx.sort(); +#else nodeidx.sort(cmp_anlsts); +#endif // Write the address-sorted .GXA fp = fsopen(addrindex.c_str(), "wb", sh_mod); @@ -1020,7 +1043,7 @@ static void check_nodelists(bool force) { char* val=buf; getkeyval(&key, &val); key = strxcpy(newpath, strbtrim(key), sizeof(Path)); - MapPath(key); + _MapPath(key); strchg(key, GOLD_WRONG_SLASH_CHR, GOLD_SLASH_CHR); for(n=0; n Set max size of a name in the index." << std::endl - << "\t\t-U Create sorted FIDOUSER.LST userlist file." << std::endl + std::cout << "Commandline syntax: " << CleanFilename(argv[0]) << " [-options] [configfile]\n" + << "\n[-options] =\t-C\t Conditional compile.\n" + << "\t\t-F\t Forced compile.\n" + << "\t\t-D\t Remove duplicate nodes from index while compiling.\n" + << "\t\t-Q\t Quiet compile. No screen output improves speed.\n" + << "\t\t-S Set max size of a name in the index.\n" + << "\t\t-U Create sorted FIDOUSER.LST userlist file.\n" #ifdef GOLDNODE_STATS - << "\t\t-T\t Make statistics." << std::endl + << "\t\t-T\t Make statistics.\n" #endif - << std::endl - << "[configfile] =\t\t The path AND filename of GOLDED.CFG" << std::endl - << "\t\t\t configuration file to read." << std::endl - << std::endl; + << "\n[configfile] =\t\t The path AND filename of GOLDED.CFG\n" + << "\t\t\t configuration file to read.\n\n"; } } else { if(force) - if(not quiet) std::cout << "* Forced compile." << std::endl; + if(not quiet) std::cout << "* Forced compile.\n"; if(read_config(cfg, argv[0])) { if(force or conditional) check_nodelists(force); } else { - if(not quiet) std::cout << std::endl << "Could not find the configuration file!" << std::endl; + if(not quiet) std::cout << "\nCould not find the configuration file!\n"; } } }