Commits (1)
  • Rob Swindell's avatar
    Revert to *.XXcol.* being an exact column width, add *.cXX.* support · e3ba2427
    Rob Swindell authored
    That previous commit made all *.40col.msg files display for 80 column users. Not my intention.
    
    So revert to the previous behavior of *.XXcol.* display files. I didn't want to go renaming a bunch of menu files as a result of the previous commit and I didn't want a bunch of sysops with *.XXcol.* files to be suddenly surprised at their new BBS behavior.
    
    And introduce a new file naming convention, *.cXX.* (where XX is a MINIMUM column width). This is the same naming convention used by Mystic, which also treats it is as a minimum terminal width, not a required exact width.
    e3ba2427
......@@ -304,17 +304,22 @@ bool sbbs_t::menu_exists(const char *code, const char* ext, char* path)
FULLPATH(path, prefix, MAX_PATH);
SAFECOPY(prefix, path);
}
// Display specified EXACT width file
safe_snprintf(path, MAX_PATH, "%s.%lucol.%s", prefix, cols, ext);
if(fexistcase(path))
return true;
// Display specified MINIMUM width file
glob_t g = {0};
safe_snprintf(path, MAX_PATH, "%s.*col.%s", prefix, ext);
safe_snprintf(path, MAX_PATH, "%s.c*.%s", prefix, ext);
if(globi(path, GLOB_NOESCAPE|GLOB_MARK, NULL, &g) == 0) {
char* p;
char term[MAX_PATH + 1];
safe_snprintf(term, sizeof(term), "col.%s", ext);
size_t skip = safe_snprintf(path, MAX_PATH, "%s.", prefix);
safe_snprintf(term, sizeof(term), ".%s", ext);
size_t skip = safe_snprintf(path, MAX_PATH, "%s.c", prefix);
long max = 0;
for(size_t i = 0; i < g.gl_pathc; i++) {
long c = strtol(g.gl_pathv[i] + skip, &p, 10);
if(stricmp(p, term) != 0) // Some other weird pattern ending in col.<ext>
if(stricmp(p, term) != 0) // Some other weird pattern ending in c*.<ext>
continue;
if(c <= cols && c > max) {
max = c;
......