Commits (2)
......@@ -305,6 +305,22 @@ static int file_compare_date_d(const void* v1, const void* v2)
return f2->hdr.when_imported.time - f1->hdr.when_imported.time;
}
static int file_compare_size_a(const void* v1, const void* v2)
{
file_t* f1 = (file_t*)v1;
file_t* f2 = (file_t*)v2;
return f1->idx.size - f2->idx.size;
}
static int file_compare_size_d(const void* v1, const void* v2)
{
file_t* f1 = (file_t*)v1;
file_t* f2 = (file_t*)v2;
return f2->idx.size - f1->idx.size;
}
void sortfiles(file_t* filelist, size_t count, enum file_sort order)
{
switch(order) {
......@@ -326,6 +342,12 @@ void sortfiles(file_t* filelist, size_t count, enum file_sort order)
case FILE_SORT_DATE_D:
qsort(filelist, count, sizeof(*filelist), file_compare_date_d);
break;
case FILE_SORT_SIZE_A:
qsort(filelist, count, sizeof(*filelist), file_compare_size_a);
break;
case FILE_SORT_SIZE_D:
qsort(filelist, count, sizeof(*filelist), file_compare_size_d);
break;
}
}
......
/* $Id: fmsgdump.c,v 3.6 2020/04/26 21:01:55 rswindell Exp $ */
// vi: tabstop=4
#include "gen_defs.h"
......@@ -149,13 +148,8 @@ int main(int argc, char** argv)
{
FILE* fp;
int i;
char revision[16];
sscanf("$Revision: 3.6 $", "%*s %s", revision);
fprintf(stderr,"fmsgdump rev %s - Dump FidoNet Stored Messages\n\n"
,revision
);
fprintf(stderr,"fmsgdump rev 3.7 - Dump FidoNet Stored Messages\n\n");
if(argc<2) {
fprintf(stderr,"%s",usage);
......
......@@ -1911,6 +1911,10 @@ JSObject* js_CreateFileBaseClass(JSContext* cx, JSObject* parent, scfg_t* cfg)
, JSPROP_PERMANENT|JSPROP_ENUMERATE|JSPROP_READONLY);
JS_DefineProperty(cx, sort, "DATE_D", INT_TO_JSVAL(FILE_SORT_DATE_D), NULL, NULL
, JSPROP_PERMANENT|JSPROP_ENUMERATE|JSPROP_READONLY);
JS_DefineProperty(cx, sort, "SIZE_A", INT_TO_JSVAL(FILE_SORT_SIZE_A), NULL, NULL
, JSPROP_PERMANENT|JSPROP_ENUMERATE|JSPROP_READONLY);
JS_DefineProperty(cx, sort, "SIZE_D", INT_TO_JSVAL(FILE_SORT_SIZE_D), NULL, NULL
, JSPROP_PERMANENT|JSPROP_ENUMERATE|JSPROP_READONLY);
#ifdef BUILD_JSDOCS
js_DescribeSyncObject(cx, sort, "Sort order numeric constants", 0);
js_CreateArrayOfStrings(cx, sort, "_property_desc_list", filebase_sort_prop_desc, JSPROP_READONLY);
......
/* pktdump.c */
/* $Id: pktdump.c,v 1.17 2020/04/28 05:41:30 rswindell Exp $ */
#include "fidodefs.h"
#include "xpendian.h" /* swap */
#include "dirwrap.h" /* _PATH_DEVNULL */
......@@ -289,13 +287,8 @@ int main(int argc, char** argv)
bool split = false;
bool recover = false;
int i;
char revision[16];
sscanf("$Revision: 1.17 $", "%*s %s", revision);
fprintf(stderr,"pktdump rev %s - Dump FidoNet Packets\n\n"
,revision
);
fprintf(stderr,"pktdump rev 1.18 - Dump FidoNet Packets\n\n");
if(argc<2) {
fprintf(stderr,"%s",usage);
......
......@@ -296,6 +296,8 @@ enum file_sort { /* Values for dir[x].sort */
,FILE_SORT_NAME_DC = 5 /* Sort by filename, descending (case-sensitive) */
,FILE_SORT_DATE_A = 2 /* Sort by upload date, ascending */
,FILE_SORT_DATE_D = 3 /* Sort by upload date, descending */
,FILE_SORT_SIZE_A = 6 /* Sort by file size, ascending */
,FILE_SORT_SIZE_D = 7 /* Sort by file size, descending */
,FILE_SORT_NATURAL = FILE_SORT_DATE_A
};
......
......@@ -31,6 +31,8 @@ char* file_sort_desc[] = {
"Date Descending",
"Name Ascending (case-sensitive)",
"Name Descending (case-sensitive)",
"Size Ascending",
"Size Descending",
NULL
};
......