Commits (2)
  • Rob Swindell's avatar
    loadfiles() will perform liberal filename matching when len > 12 chars · 60e4d7af
    Rob Swindell authored
    As discovered while making the Synchronet v3.18b feature video (https://www.youtube.com/watch?v=_IWzIV0_sZ4), when only a shortened version of a long filename is displayed (e.g. due to 80 column terminal width limitations), trying to download that filename by specifying the filename at the Download File(s) Filespec [All Files]: prompt can be problematic.
    
    For example (as seen in the video), the file "SyncTERM-1.1-setup.exe" is displayed as "SyncTERM.exe" (on an 80-column terminal), yet trying to download "SyncTERM.exe" (or "syncterm.exe") using the 'D'ownload command would fail to find a file with that name (understandably, but frustratingly so).
    
    This change will transform the requested filename-to-load if it is at least 12 characters in length and contains no wildcards (* or ?), to include a filename extending wildcard: "filename.txt" will become "filename*.txt" and "longfilename" will become "longfilename*".
    
    For requested filespecs of NULL (all files) or specs containing wildcards or specs (filenames) less than 12 characters in length, no filespec transform takes place: so trying to list/download "a" doesn't match "apple.txt".
    60e4d7af
  • Rob Swindell's avatar
    Include some statistics about the release · 1d88d809
    Rob Swindell authored
    These git diff stats are a bit misleading as a lot of files were removed from the git repo and some 3rd party libraries were added.
    1d88d809
......@@ -242,3 +242,9 @@ o New commands to flag/unflag all messages for deletion
o Replace ESC chars with '.' when viewing messages, support '-<count>' with 'r'
o Also, allow continuous reading of 1 or more consecutive messages using the
-<digit> option (no prompting)
Stats
~~~~~
o About 15 months of development (Oct-2020 through Dec-2021)
o 2276 files changed, 326374 insertions(+), 187917 deletions(-)
o v3.19a first appeared in Git (w/new FileBase) on April 4, 2021
\ No newline at end of file
......@@ -189,6 +189,22 @@ str_list_t loadfilenames(smb_t* smb, const char* filespec, time_t t, enum file_s
// Load and optionally-sort files from an open filebase into a dynamically-allocated list of "objects"
file_t* loadfiles(smb_t* smb, const char* filespec, time_t t, enum file_detail detail, enum file_sort order, size_t* count)
{
// Liberal filespec matching when filespec does not contain wildcards and is at least 12 chars in length
char newfilespec[SMB_FILEIDX_NAMELEN + 1] = "";
if(filespec != NULL) {
size_t len = strlen(filespec);
if(len >= 12 && strcspn(filespec, "*?") == len) {
SAFECOPY(newfilespec, filespec);
char* ext = getfext(newfilespec);
if(ext != NULL) {
*ext = 0;
SAFECAT(newfilespec, "*");
SAFECAT(newfilespec, getfext(filespec));
} else
SAFECAT(newfilespec, "*");
filespec = newfilespec;
}
}
*count = 0;
long start = 0;
......