mirror of
https://github.com/bobbimanners/GNO-Extras.git
synced 2024-06-12 06:29:28 +00:00
Added no-op sort for use with -n filename case change option
This commit is contained in:
parent
585e285abd
commit
e2c63be8ae
|
@ -2,7 +2,6 @@
|
||||||
* Bobbi January-February 2020
|
* Bobbi January-February 2020
|
||||||
*
|
*
|
||||||
* TODO: Fix mode
|
* TODO: Fix mode
|
||||||
* TODO: Do-nothing sort option for use with case-change option
|
|
||||||
* TODO: Case insensitive sort option
|
* TODO: Case insensitive sort option
|
||||||
* TODO: Tool for 'extending' volume dir to more than 4 blocks
|
* TODO: Tool for 'extending' volume dir to more than 4 blocks
|
||||||
* TODO: Legacy/extended date format conversion
|
* TODO: Legacy/extended date format conversion
|
||||||
|
@ -195,6 +194,7 @@ int cmp_blocks_asc(const void *a, const void *b);
|
||||||
int cmp_blocks_desc(const void *a, const void *b);
|
int cmp_blocks_desc(const void *a, const void *b);
|
||||||
int cmp_eof_asc(const void *a, const void *b);
|
int cmp_eof_asc(const void *a, const void *b);
|
||||||
int cmp_eof_desc(const void *a, const void *b);
|
int cmp_eof_desc(const void *a, const void *b);
|
||||||
|
int cmp_noop(const void *a, const void *b);
|
||||||
void sortlist(char s);
|
void sortlist(char s);
|
||||||
void printlist(void);
|
void printlist(void);
|
||||||
uint blockidxtoblocknum(uint idx);
|
uint blockidxtoblocknum(uint idx);
|
||||||
|
@ -1159,6 +1159,15 @@ int cmp_eof_desc(const void *a, const void *b) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* No-op sort which just keeps items in the same order
|
||||||
|
*/
|
||||||
|
int cmp_noop(const void *a, const void *b) {
|
||||||
|
struct fileent *aa = (struct fileent*)a;
|
||||||
|
struct fileent *bb = (struct fileent*)b;
|
||||||
|
return aa->order - bb->order;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sort filelist[]
|
* Sort filelist[]
|
||||||
* s defines the field to sort on
|
* s defines the field to sort on
|
||||||
|
@ -1216,6 +1225,10 @@ void sortlist(char s) {
|
||||||
qsort(filelist, numfiles, sizeof(struct fileent),
|
qsort(filelist, numfiles, sizeof(struct fileent),
|
||||||
cmp_eof_desc);
|
cmp_eof_desc);
|
||||||
break;
|
break;
|
||||||
|
case '.':
|
||||||
|
qsort(filelist, numfiles, sizeof(struct fileent),
|
||||||
|
cmp_noop);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
err(FATALBADARG, "Invalid sort option");
|
err(FATALBADARG, "Invalid sort option");
|
||||||
}
|
}
|
||||||
|
@ -1504,7 +1517,10 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
if (optind != argc - 1)
|
if (optind != argc - 1)
|
||||||
usage();
|
usage();
|
||||||
|
|
||||||
|
if ((strlen(caseopts) > 0) && (strlen(sortopts) == 0))
|
||||||
|
strncpy(sortopts, ".", 1);
|
||||||
|
|
||||||
uchar dev;
|
uchar dev;
|
||||||
uint blk;
|
uint blk;
|
||||||
if (firstblk(argv[optind], &dev, &blk) != 0) {
|
if (firstblk(argv[optind], &dev, &blk) != 0) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user